*
The moose likes Web Component Certification (SCWCD/OCPJWCD) and the fly likes listener question Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Web Component Certification (SCWCD/OCPJWCD)
Bookmark "listener question" Watch "listener question" New topic
Author

listener question

sawan parihar
Ranch Hand

Joined: Aug 24, 2004
Posts: 250
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


Sawan<br />SCJP,SCWCD,SCBCD<br /> <br />Every exit is an entry somewhere.
Naresh Arige
Greenhorn

Joined: Jan 05, 2005
Posts: 13
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

Joined: Aug 24, 2004
Posts: 250
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.
sundar katluri
Greenhorn

Joined: Dec 14, 2004
Posts: 25


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

Joined: Aug 24, 2004
Posts: 250
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
vaidhehi paruchuri
Greenhorn

Joined: Jan 05, 2004
Posts: 4
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
Durgaprasad Guduguntla
Ranch Hand

Joined: Oct 20, 2003
Posts: 99
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


Thanks,<br />Durgaprasad<br />SCJP1.4, SCWCD1.4, SCBCD1.3,<br />SCEA
sawan parihar
Ranch Hand

Joined: Aug 24, 2004
Posts: 250
Hi,
Thanks guys.

sawan
 
 
subject: listener question
 
Similar Threads
HttpSession when cookies are disabled
encode(Redirect)URL, explain it please!
difference between encodeRedirectURL and encodeURL
why Not encodeDispatchURL ????
response.encodeRedirectURL