• Post Reply Bookmark Topic Watch Topic
  • New Topic

encoding with URLEncoder

 
mandar kharat
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am trying to encoding a large data(2.5MB) with URLEncoder class. But there is not output from the class,i.e. String. Is there any restriction for the size of data Encoding with this class. Has anyone come across this problem?
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 65524
105
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You didn't mention why you were trying to do this. The only reason to URL encode something is to be able to use it as part of a URL. Now, if you are trying to pass a 2.5M string as a request parameter encoded in the query string of a URL as part of a GET, well, that's way too large.
What exactly are you trying to accomplish?
bear
 
mandar kharat
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am trying to do this to send the data over the wire, to another servlet with HttpUrlConnection . I am transmitting this data after establishing a connection with this remote servlet, for that reason I have to encode this data using URLEncoder.
 
Mike Curwen
Ranch Hand
Posts: 3695
IntelliJ IDE Java Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Bear, you were confusing the EncodeURL() method of the HttpServletResponse with the java.net.URLEncoder class.

mandar, I'm not really sure you need to use URLEncoder. If the 2.5MB file you are sending has a ' ' (space) character in it, does it make sense to turn this into a '+' character? You'd only have to use URLDecoder at the other end. Maybe it's a requirement to encode anything going over HTTP, but I thought that sending files as a stream of bytes "as is" was acceptable.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!