hc-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ortwin Gl├╝ck <...@odi.ch>
Subject Re: cannot load rss xml with httpclient 3.0 .
Date Mon, 27 Feb 2006 08:42:01 GMT
Why are you using a POST method? Have you tried using a GET method?

RZG wrote:
>  Hi! everybody,
> 
>   when i attempted load a rss url using PostMethod in httpclient 3.0,an 403
> status returned.
> but i can access this rss url  through the ie or other browsers.
> would there be any parameters must be setted?
> 
> *my code as follow:*
> 
>   MultiThreadedHttpConnectionManager connectionManager = new
> MultiThreadedHttpConnectionManager();
>   HttpClient httpClient = new HttpClient(connectionManager);
>   GetMethod postMethod = new GetMethod(
>     "
> http://groups.google.com/group/PowereEngin/feed/rss_v2_0_msgs.xml?num=50");
>   int httpStatus = httpClient.executeMethod (postMethod);
>   char abyte1[] = new char[10240];
>   System.out.println(httpStatus);
>   try {
>    Reader reader = new InputStreamReader(postMethod
>      .getResponseBodyAsStream());
>    int readlen = reader.read (abyte1);
>    char b[] = new char[readlen];
>    System.arraycopy(abyte1, 0, b, 0, readlen);
>    System.out.println(b);
>   } catch (Exception ex) {
>    ex.printStackTrace();
>   } finally {
>    postMethod.releaseConnection ();
>   }
> 

-- 
[web]  http://www.odi.ch/
[blog] http://www.odi.ch/weblog/
[pgp]  key 0x81CF3416
        finger print F2B1 B21F F056 D53E 5D79 A5AF 02BE 70F5 81CF 3416

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


Mime
View raw message