hc-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Chang Sau Sheong" <csshe...@pacific.net.sg>
Subject Re: Slide and Jakarta-commons-httpClient
Date Tue, 10 Dec 2002 16:22:30 GMT
I forgot  ... this is for the latest build, won't work with ur current (old)
build. Get the latest from CVS.
.sausheong
elipva Ltd


----- Original Message -----
From: "Chang Sau Sheong" <cssheong@pacific.net.sg>
To: "Commons HttpClient Project"
<commons-httpclient-dev@jakarta.apache.org>; <Extern.Kiran.Thandra@vw.com>
Sent: Wednesday, December 11, 2002 12:20 AM
Subject: Re: Slide and Jakarta-commons-httpClient


> Code snippet. This works fine for me. Hope it helps.
>
> <snippet>
>
>   InputStream is = nulll;
>
>     try {
>       // 1. create httpclient object
>       HttpClient client = new HttpClient();
>
>       // 2. create config object
>       HostConfiguration config = new HostConfiguration();
>
>       // 3. set the configuration for
>       config.setHost(url, port, protocol);
>
>       // 4. apply the configuration
>       client.setHostConfiguration(config);
>
>       // 5. create a post method
>       UrlPostMethod post = new UrlPostMethod(url + loginPage);
>
>       // 6. set the query parameters you want to post to the page
>       post.addParameter(key, value);
>
>       // 7. execute the method through the client object
>       client.executeMethod(post);
>
>       // 8. get back the response as an input stream
>       is = post.getResponseBodyAsStream();
>
>     }
>     catch (Exception e) {}
>
>     // ... process your input stream
>
> </snippet>
>
>
>
> .sausheong
> elipva Ltd
>
>
> ----- Original Message -----
> From: "Thandra, Kiran" <Extern.Kiran.Thandra@vw.com>
> To: "'Commons HttpClient Project'"
> <commons-httpclient-dev@jakarta.apache.org>
> Sent: Wednesday, December 11, 2002 12:12 AM
> Subject: RE: Slide and Jakarta-commons-httpClient
>
>
> > Hello ,
> >
> > Need some help with using Http Client. Iam new to this technology
> .Basically
> > we are trying to post some form data and get to a internet site and get
> the
> > response back.Iam getting error 405 method not allowed.I was
successfully
> > post this data using Innovation Http Client Api and java.net.Some times
> its
> > taking lot time to execute this request.
> >
> > I think not properly using the API.
> >
> > Any Suggestions are greately appreciated
> >
> > MY CODE:
> >
> > org.apache.commons.httpclient.HttpClient client=new
> > org.apache.commons.httpclient.HttpClient();
> >
> > java.net.URL url=new java.net.URL("http://xyz.abc.com");
> > client.startSession(url);
> > System.out.println("session started");
> >    org.apache.commons.httpclient.methods.PostMethod method = new
> > org.apache.commons.httpclient.methods.PostMethod("/verifyuser.asp");
> >    org.apache.commons.httpclient.NameValuePair form_data[] = new
> > org.apache.commons.httpclient.NameValuePair[2];
> >
> >             form_data[0] = new
> > org.apache.commons.httpclient.NameValuePair("uid", "2");
> >     form_data[1] = new
> > org.apache.commons.httpclient.NameValuePair("pwd","55455545");
> >
> > //org.apache.commons.httpclient.HttpState st=;
> >
> > //System.out.println(st);
> >
> >          //method.addRequestHeader("Expect","100-continue");
> >          method.setFollowRedirects(false);
> >          method.setQueryString(form_data);
> >          method.setUseDisk(false);
> >
> >
> >
> >            try{
> >                 method.execute(new
> > org.apache.commons.httpclient.HttpState(),conn);
> >                  int i=client.executeMethod(method);
> >
> >          java.io.BufferedReader in = new java.io.BufferedReader(new
> > java.io.InputStreamReader
> >         (method.getResponseBodyAsStream()));
> >
> >      while ((line = in.readLine()) != null) {
> >   System.out.println(line);
> >      }
> >
> >
> >       }catch(Throwable t){
> >             t.printStackTrace();
> >
> >          }
> >
> > Regards,
> > Kiran Thandra
> >
> >
> >
> > e
> >
> >
> >
> >
> > -----Original Message-----
> > From: Pill, Juergen [mailto:Juergen.Pill@softwareag.com]
> > Sent: Tuesday, December 10, 2002 9:19 AM
> > To: 'commons-httpclient-dev@jakarta.apache.org'
> > Subject: Slide and Jakarta-commons-httpClient
> >
> >
> > Hello,
> >
> > My name is Juergen Pill and I am committer at the Jakarta Slide project.
> >
> > Currently the Slide Client API is using a very old version of the
> > Jakarta-Commons-HttpClient API. In our night compile, the most recent
> > HttpClient is used thus, giving a series of error messages (with GUMP).
> >
> > I have started porting the Slide Client API to use the current version
of
> > this HttpClient and will remove the local clone of HttpClient from
Slide.
> >
> > I would like to make some changes to the HttpClient API for a better
Slide
> > integration.
> >
> > 1) Performance  [use _socket.setTcpNoDelay(true); in HttpConnection].
This
> > change was applied to Slide and if applied to HttpClient it brings ca.
5%
> > performance in our test suite.
> > 2) Introduce new class HttpRequestBodyMethodBase [cloned from PutMethod]
> to
> > be used in many WebDAV Methods, let PutMethod inherit from this class.
> > 3) HttpState: allow the HttpState class to carry the url encoding
(default
> > UTF-8) [needed, if the content body contains URLs, which must be
encoded,
> > see also next point]
> > 4) HttpClient, HttpMethod, HttpMethodBase: allow the method to carry the
> > HttpState (or WebDAVState inherits from HttpState).
> > 5) Modification in the Head Method to work in an authentication
> enviroment,
> > NPE if only responseBodyConsumed() is called.
> > 6) Performance: Enable the application to send the authentication header
> at
> > the very first call (instead of waiting for a 401 response code) [not
> > finally solved yet]
> >
> > I have changed the sources locally, both HttpClient and Slide API do
> compile
> > again, our WedDAV test suite reports no errors.
> >
> > Would you like me to post the changed sources as a zipped file to this
> list
> > or would you like me to make the changes directly in the HttpClient CVS
> > (please note, I am not a committer (yet)). I am familiar with the
> HttpClient
> > and helped developing it, while it was hosted at the Slide project.
> >
> > Best regards,
> >
> > Juergen Pill
> >
> >
> >
> >
> > --
> > To unsubscribe, e-mail:
> > <mailto:commons-httpclient-dev-unsubscribe@jakarta.apache.org>
> > For additional commands, e-mail:
> > <mailto:commons-httpclient-dev-help@jakarta.apache.org>
> >
> > --
> > To unsubscribe, e-mail:
> <mailto:commons-httpclient-dev-unsubscribe@jakarta.apache.org>
> > For additional commands, e-mail:
> <mailto:commons-httpclient-dev-help@jakarta.apache.org>
> >
>
>
> --
> To unsubscribe, e-mail:
<mailto:commons-httpclient-dev-unsubscribe@jakarta.apache.org>
> For additional commands, e-mail:
<mailto:commons-httpclient-dev-help@jakarta.apache.org>
>


Mime
View raw message