hc-httpclient-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Oleg Kalnichevski <ol...@apache.org>
Subject Re: help with httpclient methods please!!!! Any bug with httpclient ???
Date Thu, 02 Feb 2006 13:22:56 GMT
On Thu, 2006-02-02 at 05:15 -0800, afmustac wrote:
> Hello Oleg,
> 
> Thank you for your suggesstions. I am doing method.release() after each method in my
loop. I read the user guide, and I searched the archives. But, I could not find any similar
topic to mine.Could you please send me the link or any idea which months archives has similar
questions?Here also my code,
> 
> HttpClient client = new HttpClient();
> 
> for(int i=0;i<size;i++)
> {
> 
> GetMethod getAddForm = new GetMethod(LOGON_SITE+"/add");
>                  status =  client.executeMethod(getAddForm);
>  
> getAddForm.releaseConnection();
>  PostMethod postAddForm = new PostMethod(LOGON_SITE+"/add");
>                  postAddForm.setRequestBody(ref);
>                  status = client.executeMethod(postAddForm);
>  
>  locationHeader = postAddForm.getResponseHeader("location");
>                 
>  postAddForm.releaseConnection();
>                  if (locationHeader != null) {
>                      redirectLocation = locationHeader.getValue();
>                      System.out.println("Redirect after posting:"
>                               + redirectLocation + "\n");
>                      GetMethod getRedirectPostForm = new GetMethod(
>                              redirectLocation);
>                      getRedirectPostForm.setFollowRedirects(true);
>                      status = 
> client.executeMethod(getRedirectPostForm);
> getRedirectPostForm.releaseConnection();                
> }
> 
> I really could not find my mistake..is there anything wrong in here?I really do appreciate
your time. Thank you.

(1) use a common browser to do whatever stuff you want your application
to do 
(2) capture the HTTP packets generated by the browser using a traffic
analyzer or a browser plug-in
(3) search the archive for suggestions how to capture HTTP packets. 
(4) try simulating the captured HTTP session using HttpClient
(5) post any _specific_ HttpClient related questions to this list  

Oleg

> 
> --teo
> 
> Oleg Kalnichevski <olegk@apache.org> wrote: On Wed, 2006-02-01 at 16:11 -0800,
afmustac wrote:
> > Hello Roland,
> > 
> > I tried to see if there is anything in the URL or in posted
> > data, but I could not see anything special.
> > 
> > Do you think there is a bug in httpclient,since I run my code 
> > in 2 different machine and I logged-in into my account.
> 
> No I do not
> 
> > Both code run simultaneously, and guess what!!!just one record 
> > was showing up in my library everytime, when I refresh the browser
> > to see what is in my library. At least, there should be 2 different
> > records, and each records should be updated by each program, which
> > is running on seperate pc.
> > 
> > I am using httpclient version 
> > commons-httpclient-src-20060130.zip or commons-httpclient-src-20060131.zip.
> > 
> > And in my code I am not doing httpclient.release() after I post my each data..am
I supposed to do that?
> 
> Please do try reading the documentations on the subject and searching
> the archive prior to posting your questions to this list
> 
> > Thank you so much for any help..I really appreiate them..
> > 
> > --teo
> > 
> > 
> > Roland Weber  wrote: Hi teo,
> > 
> > trace the requests sent by the browser to answer the following question:
> > 
> > > Is there anything in the URL or
> > > the posted data that could be a counter or transaction identifier which 
> > you
> > > have to update?
> > 
> > You can use a packet sniffer or a proxy with logging option
> > to get the requests sent by the browser. You can also scan
> > the form page visually for any differences between the first
> > and second upload when using the browser.
> > 
> > hope that helps,
> >   Roland
> > 
> > 
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: httpclient-user-unsubscribe@jakarta.apache.org
> > For additional commands, e-mail: httpclient-user-help@jakarta.apache.org
> > 
> > 
> > 
> > 
> >   
> > ---------------------------------
> > Bring words and photos together (easily) with
> >  PhotoMail  - it's free and works with Yahoo! Mail.
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: httpclient-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: httpclient-user-help@jakarta.apache.org
> 
> 
> 
> 
> 		
> ---------------------------------
>  
>  What are the most popular cars? Find out at Yahoo! Autos 


---------------------------------------------------------------------
To unsubscribe, e-mail: httpclient-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: httpclient-user-help@jakarta.apache.org


Mime
View raw message