1
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;

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.aspx?HOOK_URL=https://authentication.server.address&username=&password= ";

  • as one of the httpunit committers I'am sorry to say that httpunit's javascript support might be too limited for your ajax expectations. Your mileage may vary and you'd have to try it out and ask with a more elaborate example here. – Wolfgang Fahl Nov 05 '14 at 13:06
  • I felt performance of HttpUnit is not good.So, I have moved to selenium webdrivers to overcome my problems. – Santosh Gdr Aug 10 '15 at 11:37

0 Answers0