File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Servlets and the fly likes doGet() encrypt parameters Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "doGet() encrypt parameters" Watch "doGet() encrypt parameters" New topic
Author

doGet() encrypt parameters

rucha kulkarni
Greenhorn

Joined: Aug 05, 2010
Posts: 22
Hi

When doGet() is called the parameters get appended to url.
Is it possible to encrypt parameters by calling doGet()
Seetharaman Venkatasamy
Ranch Hand

Joined: Jan 28, 2008
Posts: 5575

you can encode the url[name and value parameters] explicitly using URLEncoder or use JSTL's c:url tag, it will do implicitly for you.

and get the value using getParameter - remember here you no need to decode, getParameter do for you...
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 42599
    
  65
As long as the servlet knows how to decrypt them, sure, you can encrypt them. But what are you trying to protect, and from whom? Transport security would be better achieved by using HTTPS.


Ping & DNS - my free Android networking tools app
Seetharaman Venkatasamy
Ranch Hand

Joined: Jan 28, 2008
Posts: 5575

Oops.. Confused with encrypt with encoding... Sorry!

Please refer Ulf post.
rucha kulkarni
Greenhorn

Joined: Aug 05, 2010
Posts: 22
Then how do we hide those parameters in doGet... I was asked both these question in an interview.
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 42599
    
  65
What do you mean by "hiding"? GET parameters are transported in the URL, so they'd always be visible in the browser address bar.
rucha kulkarni
Greenhorn

Joined: Aug 05, 2010
Posts: 22
Hiding means those parameters should not be visible in URL
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 42599
    
  65
GET parameters are part of the URL, period. That's how GET works. If you don't want that then you need to use POST.
Palak Mathur
Ranch Hand

Joined: Jan 29, 2007
Posts: 313

rucha kulkarni wrote:Hiding means those parameters should not be visible in URL


Hi Rucha,

If you don't want to parameters to be visible in URL, then use POST. If you want something else, then be clear.


Palak Mathur | My Blog | TechJaunt | What is JavaRanch? | List of All FAQs
Vineet P Rao
Greenhorn

Joined: Sep 17, 2012
Posts: 3
Rucha,

Can you please clearly specify your requirements?

As suggested by earlier posts, you can use POST method which will submit all the parameters on your form without passing it in URL. But make sure you have the appropriate method implemented in you servlet (doPost()). Hope this helps!


My blog: http://www.quicklyjava.com
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: doGet() encrypt parameters