This week's book giveaway is in the Other Languages forum.
We're giving away four copies of Functional Reactive Programming and have Stephen Blackheath and Anthony Jones on-line!
See this thread for details.
Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

HttpServletRequest

 
S Sravs
Ranch Hand
Posts: 85
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
can we get HttpServletRequest object in listeners?
if so how?
if not why?

Thanks inadvance.
 
manokaran.d durairaj
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
HttpServletRequest not in Listeners. Because Listeners only look for event.like attribute added removed and also .don't want the client request or response.
 
Aditya Singh
Ranch Hand
Posts: 62
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Pls refer -http://java.sun.com/j2ee/1.4/docs/api/javax/servlet/ServletRequestEvent.html
 
Steve James
Ranch Hand
Posts: 44
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Definately possible

There is a Listener called as ServletRequestListener , it has got a method called public void requestInitialized(ServletRequestEvent rre)

and from ServletRequestEvent.getServletRequest() which returns the ServletRequest.
 
Abdul Rahman
Ranch Hand
Posts: 63
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Vijaya,

can we get HttpServletRequest object in listeners?
if so how?
if not why?


There are 8 listeners and 6 events associated with these listeners. out of these 6 events only ServletRequestEvent Class has got a method getServletRequest().
so if you are writing a class that implements ServletRequestListener interface, then you get ServletRequestEvent. From this event you can call getServletRequest(). you will have to cast it to HttpServletRequest.
You will not get request objects in other listeners because the API does not provide for it.

Hope this helps.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic