wood burning stoves*
The moose likes Sockets and Internet Protocols and the fly likes something related to request.getAttribute( Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Sockets and Internet Protocols
Bookmark "something related to request.getAttribute("user") in servlet" Watch "something related to request.getAttribute("user") in servlet" New topic
Author

something related to request.getAttribute("user") in servlet

ganesh pol
Ranch Hand

Joined: Apr 29, 2005
Posts: 151
i have client side code

HttpURLConnection connection connection = (HttpURLConnection) urlObject.openConnection();

connection.setRequestProperty("user-agent", userAgent);

which on servlet read as

request.getParameter("user-agent");

but now my requirements are changed

now i want to write client side code where my servlet will read it from

request.getAttribute("user-agent");

which method i must use so that my client side code will work
Stan James
(instanceof Sidekick)
Ranch Hand

Joined: Jan 29, 2003
Posts: 8791
The doc on getAttribute says:

Attributes can be set two ways. The servlet container may set attributes to make available custom information about a request. For example, for requests made using HTTPS, the attribute javax.servlet.request.X509Certificate can be used to retrieve information on the certificate of the client. Attributes can also be set programatically using setAttribute(java.lang.String, java.lang.Object). This allows information to be embedded into a request before a RequestDispatcher call.

This does not give me hope for your quest to set attributes on the client end of the request.


A good question is never answered. It is not a bolt to be tightened into place but a seed to be planted and to bear more seed toward the hope of greening the landscape of the idea. John Ciardi
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 41824
    
  63
Where does the requirement to set attributes on the client side come from? As Stan points out, that is not possible.


Ping & DNS - my free Android networking tools app
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: something related to request.getAttribute("user") in servlet