• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Devaka Cooray
  • Tim Cooke
  • Jeanne Boyarsky
  • Ron McLeod
Sheriffs:
Saloon Keepers:
  • Piet Souris
Bartenders:

Encoding URL path.

 
Greenhorn
Posts: 22
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have a URL in form http://localhost:8080/custserver/customer/{custId}
The custId I receive can have any characters. It could be cust#101, cust/101, [email protected] etc.

If I encode the URL on client side, the other url delimiters are encoded. The other option is to extract the custId part and encode and append again to URL and send to server. On the server side, I decode it again to get the original custId. Is there a way where I can avoid this explicit encoding/decoding. ?
 
Ranch Hand
Posts: 1376
Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
please explain your requirement clearly

do you want URL encoding OR you do not want URL encding ?

~ abhay
 
Tejas Aryan
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I want the encoding scheme but I should not do it explicitly everywhere in my application. It should be somewhat like declaring char-encoding in Connector element of tam server.xml file.
 
Abhay Agarwal
Ranch Hand
Posts: 1376
Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
i think other option can be to use Servlet Filters.

You can catch all your incoming requests in Filter and then perform URL encoding with required character coding scheme. after that request will contine to go forward to required servlet/action/controller class.
in this way, all your encoding stuff is at one place in your application
~ abhay
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic