Re: [Httpunit-develop] httunit session handling
Brought to you by:
russgold
|
From: Wolfgang F. <wf...@bi...> - 2014-11-05 08:29:29
|
Hi Santosh, thank you for your question, you might want to place your question at: http://stackoverflow.com/questions/tagged/http-unit so that other's can profit from the discussion. To get an answer for your question you also might want to supply a stripped down example that shows exactly what your problem is. The stripped down example should be in a shape that other's can try out what you are experiencing. Please note that javascript support in http-unit is limited. Your mileage regarding ajax calls might therefore vary. Cheers Wolfgang Am 04.11.14 um 14:17 schrieb Santosh Gdr: > Hi... > > I am using HttpClient to handle session.Here is my code to handle > session using httpclient. But httpclient won't handle ajax calls.I am > planning to move to httpunit to overcome my problem.Basically I have a > referral URL(or authentication server) from which I need to get > cookies and session and store it in client.And use this client across > website to get logged user information. > What is the appropriate solution for this using httpunit. > credentialsURL="https://www.,,,,.com./sapLogin.aspxHOOK_URL=https://authentication.server.address&username=<username>&password=<password>"; > > try{ > HttpEntity entity=null; > HttpGet httpget=null; > HttpResponse response=null; > httpclient = new DefaultHttpClient(); > httpget = new HttpGet(credentialsURL); > > httpget.setHeader(HttpHeaders.USER_AGENT, "Mozilla/5.0 (Windows > NT 6.1; WOW64) AppleWebKit/535.2 (KHTML, like Gecko) > Chrome/15.0.874.120 Safari/535.2"); > response = httpclient.execute(httpget); > > entity = response.getEntity(); > > if (entity != null) { > > EntityUtils.consume(entity); > } > } > catch(Exception e){ > } > return httpclient; > > > ------------------------------------------------------------------------------ > > > _______________________________________________ > Httpunit-develop mailing list > Htt...@li... > https://lists.sourceforge.net/lists/listinfo/httpunit-develop -- BITPlan - smart solutions Wolfgang Fahl Pater-Delp-Str. 1, D-47877 Willich Schiefbahn Tel. +49 2154 811-480, Fax +49 2154 811-481 Web: http://www.bitplan.de BITPlan GmbH, Willich - HRB 6820 Krefeld, Steuer-Nr.: 10258040548, Geschäftsführer: Wolfgang Fahl |