Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Java Development

Posts: 37
Registered: ‎07-17-2008
My Device: Not Specified

Replacement for java.net Class URI



It seems the the Class URI (http://java.sun.com/javase/6/docs/api/java/net/URI.html) is not present in the J2ME package. Does anyone know of a specific class that I could use to replace it? My main objective is to validate an URI and make sure I encode any invalid character (e.g. replace white spaces for %20) before I make my connections. I could do it manually but I was wondering if there is a Java or BlackBerry class that would do that for me.




Posts: 1,415
Registered: ‎07-30-2008
My Device: Not Specified

Re: Replacement for java.net Class URI

I think the first thing I found for encoding is this but I was a little annoyed it didn't quite work the way I thought,




I think I grepped javadocs for urlencode and that was about the best I came up with. Not sure about validating

but for encoding that seems ok for encoding the query part of a URL. If you find something else let me know.