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.
Sawan<br />SCJP,SCWCD,SCBCD<br /> <br />Every exit is an entry somewhere.
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.
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
----------------------------------------------------------------------- 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.
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.