You are viewing a plain text version of this content. The canonical link for it is here.
Posted to httpclient-users@hc.apache.org by Melvin Mah <me...@yahoo.com> on 2006/10/02 11:26:51 UTC

Re: Entity Enclosing Requests

Hi Oleg,

I just referred back to LoginDemo - one of the samples
for HTTPClient - to test the Redirect and changed a
little using some parameters for the site Engineering
Village.

Now that the login status is successful, I want to
entering a key term and then EV will redirect to
another page and send me the results based on the
keyword I would enter.

Currently, the pointer link is at
/Servlet/Controller/CID?=quicksearch&database=1.
(after login)

The link shown after the search results are returned
would be at: 

The question is can I just simply reuse the last half
of PostMethod in LoginDemo (modified) and just adding
new NameValuePair variables? Do I have to modify
anything substantially?

Thanks



--- Oleg Kalnichevski <ol...@apache.org> wrote:

> Melvin Mah wrote:
> > I am currently using HttpClients v3.0.1 and I just
> > tried writing a class that utilizes a POST method.
> 
> >
> > This class allows inserting of username and
> password
> > for a website (as parameters) such as SCOPUS,
> Emerald,
> > etc.. and then once it logs into the website's
> > database, the page will be redirected to a subpage
> in
> > which I can perform my search queries.
> >
> > For that purpose, I've put in a line - 
> >
> > method.setFollowRedirects
> >
> > but upon running the program,
> > I get the message that 'Entity Enclosing Requests'
> > cannot be redirected without user intervention.
> >
> > I understand that this is in violation with RFC
> 2616
> > but somehow I need to redirect it to a subpage.
> Any
> > workarounds behind this obstacle is very much
> appreciated.
> >   
> Melvin,
> 
> You have to handle POST redirects manually because
> this requires change 
> of the method type from POST to GET, which
> HttpClient 3.x cannot do 
> automatically.
> 
> For details see the HttpClient Redirects Handling
> guide:
> 
>
http://jakarta.apache.org/commons/httpclient/redirects.html
> 
> Hope this helps
> 
> Oleg
> 
> > __________________________________________________
> > Do You Yahoo!?
> > Tired of spam?  Yahoo! Mail has the best spam
> protection around 
> > http://mail.yahoo.com 
> >
> >
>
---------------------------------------------------------------------
> > To unsubscribe, e-mail:
> httpclient-user-unsubscribe@jakarta.apache.org
> > For additional commands, e-mail:
> httpclient-user-help@jakarta.apache.org
> >
> >
> >   
> 
> 
>
---------------------------------------------------------------------
> To unsubscribe, e-mail:
> httpclient-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail:
> httpclient-user-help@jakarta.apache.org
> 
> 


__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 

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


Re: Entity Enclosing Requests

Posted by Roland Weber <ht...@dubioso.net>.
Hello Melvin,

> The question is can I just simply reuse the last half
> of PostMethod in LoginDemo (modified) and just adding
> new NameValuePair variables? Do I have to modify
> anything substantially?

That totally depends on the server application. You should
first try to make it as simple as possible. If that doesn't
work, the primer explains how to proceed:
http://wiki.apache.org/jakarta-httpclient/ForAbsoluteBeginners

cheers,
  Roland

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