• 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
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

listener question

 
Ranch Hand
Posts: 250
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
HEY GUYS,
Please help me out. I have posted these questions previously but didn't got any respons thats why posting again.

Do we need to declare the HttpSessionActivationListener in the deployment descriptor. According to H&F we need to specifiy the the DD but I think its wrong.

Can someone please tell me the difference between encodeURL and encodeRedirectURL. I understand that we have to use encodeRedirectURL on the URL that will be passed to sendRedirect() function . My question is why can't we use encodeURL in the place of encodeRedirectURL.


Thanks.

Sawan
 
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Go to this link to know the diffence between encodeURL and encodeRedirectURL http://www.theserverside.com/discussions/thread.tss?thread_id=6039
 
sawan parihar
Ranch Hand
Posts: 250
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
Thnaks for the reply. I thought no one is going to reply. Well that link was helpful but its not very clear that why we have two methods(encodeURL and encodeRedirectURL).

Also any help regarding the HttpSessionActivationListener is appretiated.

Thanks.
 
Greenhorn
Posts: 25
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator


point 1:
------ read these lines from java api ---
Encodes the specified URL for use in the sendRedirect method or, if encoding is not needed, returns the URL unchanged. The implementation of this method includes the logic to determine whether the session ID needs to be encoded in the URL. Because the rules for making this determination can differ from those used to decide whether to encode a normal link, this method is separated from the encodeURL method
------ end java api-----
so behind the scene there is a diference! I think if you want to know actually what's happending behind the scene and what logic they need to determine whether the session ID needs to be encoded in the URL?

Answers for those kind of questions i dont know may be some one in the forum needs to help me/us.

point 2:

As far as i know we need to declare the HttpSessionActivationListener in the DD.
think this way --> session can be passivated and activated(in a distrubuted app session migrates!!) and its a call back mechanism provided to us to do our work
Why do you think this is wrong???


let me know if i am making any wrong assumptions for myself
 
sawan parihar
Ranch Hand
Posts: 250
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Sundara,
I searched again and found this.

http://e-docs.bea.com/wls/docs70/webapp/app_events.html

-----------------------------------------------------------------------
Note: The Servlet 2.3 specification also contains the javax.servlet.http.HttpSessionBindingListener and the javax.servlet.http.HttpSessionActivationListener interfaces. These interfaces are implemented by objects that are stored as session attributes and do not require registration of an event listener in web.xml. For more information, see the Javadocs for these interfaces.

-------------------------------------------------------------------------

This makes sense. Thanks for the reply.

Sawan
 
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Both encodeURL and encodeRedirectURL do the same job but the only difference is if the URL is empty in the case of encodeURL it is replaced by "http://webApp".

Hope I answered your questions.

Vaidhehi
 
Ranch Hand
Posts: 99
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

What I understand from the HFSJ book is that both encodeURL() and encodeRedirectURL() are the methods used for enabling URL rewriting for session tracking purposes in case cookies are disabled at client side. If we encode the URLs, the container would append jsessionid parameter to track the session if cookies are disabled. If we want to 'redirect' the URL and at the same time perform encode, we need to use encodeRedirectURL(). In case if you are doing 'forward' or a normal href link, encode the URL first using encodeURL() method and then use it. Hope this helps.

Thanks,

Durga
 
sawan parihar
Ranch Hand
Posts: 250
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
Thanks guys.

sawan
 
The fastest and most reliable components of any system are those that are not there. Tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic