Hi Roshan, Correct. Server session is managed by Servlet container and Client session handled by Cookie, We need to get the cookie from first response and pass it to server via second request. BTW I tried it and not working properly.
On Thu, Oct 23, 2014 at 10:05 AM, Roshan Deniyage <[email protected]> wrote: > Hi, > AFAIK, client session management should be handled by both client side and > server side. If you use Servlet container like tomat, it automatically > manage session and send the relevant session cookie to client side. If you > want to use that session, in subsequent requests you have to send the same > session cookie from client side. There may have easy mechanism to pass back > and forth the session cookie in org.apache.http.client.HttpClient. Or > otherwise you have to get the session cookie from previous http response > and set it to the next http request manually. > > Thanks, > > Roshan Deniyage > Associate Technical Lead > WSO2, Inc: http://wso2.com > > Mobile : +94 777636406 > Twitter : *https://twitter.com/roshku <https://twitter.com/roshku>* > LinkedIn : https://www.linkedin.com/in/roshandeniyage > > > On Wed, Oct 22, 2014 at 10:35 PM, Lakshman Udayakantha <[email protected] > > wrote: > >> Hi Amila, >> >> As I understood session should maintain in server not client right? and >> is these two Jsp pages reside in same web application? if they are in same >> web app, one thing to notice is your session may be time out. make sure it >> is not. you can try adding below code in your jsp2 >> >> <%@ page language="java" contentType="text/html" session="true" %> >> >> the solution in thread [1] may be helpful for setting session variable. >> >> http://www.experts-exchange.com/Programming/Misc/Q_21903762.html >> >> Thanks >> >> On Wed, Oct 22, 2014 at 7:29 PM, Manoj Gunawardena <[email protected]> >> wrote: >> >>> Hi Amila, >>> >>> Use same httpContext object to create httpclient connections to test1 >>> and test2 jsps. >>> >>> Thanks >>> >>> >>> On Wed, Oct 22, 2014 at 5:45 PM, Godwin Amila Shrimal <[email protected]> >>> wrote: >>> >>>> Hi, >>>> >>>> I am using org.apache.http.client.HttpClient to send http request, here >>>> I want to maintain the session. >>>> >>>> Ex. I have a web application hosted in tomcat. web app has a >>>> *test1.jsp* which set session attribute *code. *there is a another JSP >>>> called *test2.jsp* which get the session attribute *code *and print it*. >>>> *I use HttpClient and send a request to *test1.jsp *and then *test2.jsp, >>>> *when I call the *test2.jsp *it cannot get the session attribute *code >>>> *and session is not maintained. >>>> >>>> Can anyone suggest a solution for this. >>>> >>>> >>>> Thanks >>>> Godwin >>>> >>>> -- >>>> *Godwin Amila Shrimal* >>>> Senior Software Engineer >>>> WSO2 Inc.; http://wso2.com >>>> lean.enterprise.middleware >>>> >>>> mobile: *+94772264165* >>>> linkedin: *http://lnkd.in/KUum6D <http://lnkd.in/KUum6D>* >>>> twitter: https://twitter.com/godwinamila >>>> >>>> _______________________________________________ >>>> Dev mailing list >>>> [email protected] >>>> http://wso2.org/cgi-bin/mailman/listinfo/dev >>>> >>>> >>> >>> >>> -- >>> Manoj Gunawardena >>> Tech Lead >>> WSO2, Inc.: http://wso2.com >>> lean.enterprise.middleware >>> Mobile : +94 77 2291643 >>> >>> _______________________________________________ >>> Dev mailing list >>> [email protected] >>> http://wso2.org/cgi-bin/mailman/listinfo/dev >>> >>> >> >> >> -- >> Lakshman Udayakantha >> WSO2 Inc. www.wso2.com >> lean.enterprise.middleware >> Mobile: *0711241005* >> >> >> _______________________________________________ >> Dev mailing list >> [email protected] >> http://wso2.org/cgi-bin/mailman/listinfo/dev >> >> > > _______________________________________________ > Dev mailing list > [email protected] > http://wso2.org/cgi-bin/mailman/listinfo/dev > > -- *Godwin Amila Shrimal* Senior Software Engineer WSO2 Inc.; http://wso2.com lean.enterprise.middleware mobile: *+94772264165* linkedin: *http://lnkd.in/KUum6D <http://lnkd.in/KUum6D>* twitter: https://twitter.com/godwinamila
_______________________________________________ Dev mailing list [email protected] http://wso2.org/cgi-bin/mailman/listinfo/dev
