hc-httpclient-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Agustin Palacios" <apalac...@itconvergence.com>
Subject Problem with QueryString
Date Wed, 07 Nov 2007 17:52:09 GMT
Hi, I'm experiencing the following problem:

 

1)       If I write the (A) url in a browser, it works ok ( the user poe is successfully logged
into the appliacation )

2)       If I write the (B) url in a browser, it also works ok ( the user e.poe is successfully
logged into the appliacation )

3)       If I execute the above source code using poe user, it works ok ( HttpStatus.SC_OK
)

4)       If I execute the above source code using e.poe user, it does NOT work ( HttpStatus.SC_TEMPORARY_REDIRECT
)

5)       If I execute the above source code using an invalid user, I received the same response
as in (4) ( HttpStatus.SC_TEMPORARY_REDIRECT )

 

Is something wrong in the above source code?

 

N.B.: does the . ( dot ) in the user may be causing this problem?

 

 

Thanks in advance,

Agustín

 

 

(A)  http://www.mysite.com/index.cfm?username=poe&password=password

 

(B)  http://www.mysite.com/index.cfm?username=e.poe&password=password

 

 

HttpClient client = new HttpClient();

      

            PostMethod post = new PostMethod("http://www.mysite.com/index.cfg"); 

            NameValuePair[] data = { new NameValuePair("username", "e.poe"),

                        new NameValuePair("password", "password") };

            post.setQueryString(data);

            

 

            post.getParams().setParameter(HttpMethodParams.RETRY_HANDLER, new DefaultHttpMethodRetryHandler(3,
false));

 

            try {

                  

                  int c = client.executeMethod(post);

 

                  if (c == HttpStatus.SC_OK) {

                        System.out.println("Ok");

                  } else {

                        System.out.println("Failed");

                  }

 

            } catch (HttpException e) {

                  // TODO Auto-generated catch block

                  e.printStackTrace();                

            } catch (IOException e) {

                  // TODO Auto-generated catch block

                  e.printStackTrace();

            } finally {

                  post.releaseConnection();

            }


Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message