File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Beginning Java and the fly likes validation Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "validation" Watch "validation" New topic


lanshu usav

Joined: Aug 18, 2005
Posts: 3
Dear friends,

I have a Srting that is passed to me. I need to verify that the string passed is an object of a URLEncodedString class. I request you guys for an idea how to do it.

Thomas Paul Bigbee
Ranch Hand

Joined: Jun 28, 2005
Posts: 71
Create a boolean good flag

Try and create URL object with your string
if the object can be created, set the good flag to true
else catch the exception and take appropriate action.

public URL(String spec)
throws MalformedURLException

Creates a URL object from the String representation.

This constructor is equivalent to a call to the two-argument constructor with a null first argument.


spec - the String to parse as a URL.


MalformedURLException - If the string specifies an unknown protocol.

See Also:

URL(, java.lang.String)
Norm Radder
Ranch Hand

Joined: Aug 10, 2005
Posts: 694
Where is the URLEncodedString class defined?
I find something with a similiar name: in the 1.5 doc.

If you are asking how to detect if a String has been encoded:
You could run it thru the decode and then encode it and compare to original.
I agree. Here's the link:
subject: validation
jQuery in Action, 3rd edition