You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@hc.apache.org by "Gowda, Prasad" <Pr...@bankofamerica.com> on 2004/05/25 22:46:57 UTC

Help on getting started using HttpClient

Hi guys,

I am using HttpClient for the first time. Wrote a program on the same lines
as described in the tutorial
section on the HttpClient documentation website

Here is the output I get when I invoked one of the URL's using the GetMethod

<HTML>
<!-- File: redirectmeta.html -->
<HEAD>
<TITLE>Livelink - Redirection</TITLE>
<META HTTP-EQUIV="Refresh" CONTENT="0;
URL=/customapp/view/ASE_Roles.html?func=loadParentPage">
</HEAD>
</HTML>

Now my question, how do I get the HttpClient to go to this redirect url and
retrieve the actual content.

Could any of you guide me to a website/book which has some examples and
detailed documentation 

Any help in this regard is appreciated.

Thanks,
Prasad

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


Re: Help on getting started using HttpClient

Posted by Oleg Kalnichevski <ol...@apache.org>.
Prasad,

Start off by taking a look at the HttpClient redirect guide

http://jakarta.apache.org/commons/httpclient/redirects.html

If the document does answer all your questions, get back to us 

Oleg

On Tue, 2004-05-25 at 22:46, Gowda, Prasad wrote:
> Hi guys,
> 
> I am using HttpClient for the first time. Wrote a program on the same lines
> as described in the tutorial
> section on the HttpClient documentation website
> 
> Here is the output I get when I invoked one of the URL's using the GetMethod
> 
> <HTML>
> <!-- File: redirectmeta.html -->
> <HEAD>
> <TITLE>Livelink - Redirection</TITLE>
> <META HTTP-EQUIV="Refresh" CONTENT="0;
> URL=/customapp/view/ASE_Roles.html?func=loadParentPage">
> </HEAD>
> </HTML>
> 
> Now my question, how do I get the HttpClient to go to this redirect url and
> retrieve the actual content.
> 
> Could any of you guide me to a website/book which has some examples and
> detailed documentation 
> 
> Any help in this regard is appreciated.
> 
> Thanks,
> Prasad
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: commons-httpclient-dev-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: commons-httpclient-dev-help@jakarta.apache.org
> 


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


Re: Help on getting started using HttpClient

Posted by Ortwin Glück <or...@nose.ch>.

Gowda, Prasad wrote:
> <HTML>
> <!-- File: redirectmeta.html -->
> <HEAD>
> <TITLE>Livelink - Redirection</TITLE>
> <META HTTP-EQUIV="Refresh" CONTENT="0;
> URL=/customapp/view/ASE_Roles.html?func=loadParentPage">
> </HEAD>
> </HTML>
> 
> Now my question, how do I get the HttpClient to go to this redirect url and
> retrieve the actual content.


Prasad,

Let me explain, that normally redirects are caused by the Location HTTP 
header and a redirect status code.
But the redirect in your case is requested by the body of the HTTP 
message, that is the HTML code. HttpClient is not HTML specific and not 
a web browser. Therefore HttpClient does not look into the HTTP message 
body and can not interprete HTML. You will need to parse the HTML code 
and find the meta tag yourself. You could either just write a simple 
parser for this specific purpose or employ a full-blown HTML parser [1].

[1] ask Google: 
http://www.google.com/search?q=java+HTML+parser&hl=de&btnG=Search

-- 
  _________________________________________________________________
  NOSE applied intelligence ag

  ortwin glück                      [www]      http://www.nose.ch
  software engineer                 [email] ortwin.glueck@nose.ch
  hardturmstrasse 171               [pgp id]           0x81CF3416
  8005 zürich                       [office]      +41-1-277 57 35
  switzerland                       [fax]         +41-1-277 57 12

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