hc-httpclient-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From RZG <renzengg...@gmail.com>
Subject cannot load rss xml with httpclient 3.0 .
Date Sun, 26 Feb 2006 03:39:36 GMT
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();
  }

*returned msg from the google group's host:*

<html><head>
<meta http-equiv="content-type" content="text/html;charset=utf-8">
<title>403 Forbidden</title>
<style><!--
body {font-family: arial,sans-serif}
div.nav {margin-top: 1ex}
div.nav A {font-size: 10pt; font-family: arial,sans-serif}
span.nav {font-size: 10pt; font-family: arial,sans-serif; font-weight: bold}
div.nav A,span.big {font-size: 12pt; color: #0000cc}
div.nav A {font-size: 10pt; color: black}
A.l:link {color: #6f6f6f}
A.u:link {color: green}
//--></style>

</head>
<body text=#000000 bgcolor=#ffffff>
<table border=0 cellpadding=2 cellspacing=0 width=100%><tr><td rowspan=3
width=1% nowrap>
<b><font face=times color=#0039b6 size=10>G</font><font face=times
color=#c41200 size=10>o</font><font face=times color=#f3c518
size=10>o</font><font face=times color=#0039b6 size=10>g</font><font
face=times color=#30a72f size=10>l</font><font face=times color=#c41200
size=10>e</font>&nbsp;&nbsp;</b>
<td>&nbsp;</td></tr>
<tr><td bgcolor=#3366cc><font face=arial,sans-serif
color=#ffffff><b>Error</b></td></tr>
<tr><td>&nbsp;</td></tr></table>
<blockquote>
*<H1>Forbidden</H1>
Your client does not have permission to get URL
<code>/group/PowereEngin/feed/rss_v2_0_msgs.xml?num=50</code> from this
server.*

*<*p>
</blockquote>
<table width=100% cellpadding=0 cellspacing=0><tr><td bgcolor=#3366cc><img
alt="" width=1 height=4></td></tr></table>
</body></html>
*tks for veryone's help!*

--
RenZenggang
Renzenggang@gmail.com
Renzenggang@csii.com
MSN:rzg117@hotmail.com

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message