dummy dum <du...@yahoo.com> wrote:
Hi,
I had posted a html parameter to the a java servlet using org.apache.commons.httpclient.methods.PostMethod
but iam retrive the posted data(param-name) using
javax.servlet.http.HttpServletRequest.getParameter("paramname")
i get a "null" value. I searched forums but Iam not able get the solution.
httpclient version used: commons-httpclient-3.0-rc2
<The code I used is>
HttpClient httpClient = new HttpClient();
PostMethod postMethod = new PostMethod("url");
NameValuePair[] data= new NameValuePair[1];
data[0] = new NameValuePair("paramname", "paramvalue");
postMethod.setRequestBody(data);
int httpStatus = httpClient.executeMethod(postMethod);
InputStream in = postMethod.getResponseBodyAsStream();
...........
<The java servlet code is >
String parameterValue = javax.servlet.http.HttpServletRequest.getParameter("paramname");
could u help in this ASAP.
thanks in advance,
the dummy
---------------------------------
Yahoo! FareChase - Search multiple travel sites in one click.
Re: disable the connection persistence
Posted by Oleg Kalnichevski <ol...@apache.org>.
On Mon, 2005-11-07 at 17:53 +0000, kunal ashar wrote:
> Hi
>
> To disable the connection persistence can I override the releaseConnection() method and close the connection immediately?
>
This is exactly what you should be doing
> For example
>
> public class MyHTTPConnectionManager extends SimpleHttpConnectionManager{
>
> public MyHTTPConnectionManager() {
> super();
> }
>
> public void releaseConnection(HttpConnection conn) {
> super.releaseConnection(conn);
> conn.close();
> }
> }
>
> If I am not wrong, in case of SimpleHttpConnectionManager we are not using any connection pool, if that is the case why persistence connection is used in case of SimpleHttpConnectionManager ?
>
Because connection persistence results in a noticeable performance
improvement and there are enough applications out there that are
intended to communicate with just one host or one host at a time.
Oleg
> Thanks
> Ashar
>
>
>
> ---------------------------------
> Yahoo! Messenger NEW - crystal clear PC to PC calling worldwide with voicemail
---------------------------------------------------------------------
To unsubscribe, e-mail: httpclient-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: httpclient-dev-help@jakarta.apache.org
disable the connection persistence
Posted by kunal ashar <ka...@yahoo.co.uk>.
Hi
To disable the connection persistence can I override the releaseConnection() method and close the connection immediately?
For example
public class MyHTTPConnectionManager extends SimpleHttpConnectionManager{
public MyHTTPConnectionManager() {
super();
}
public void releaseConnection(HttpConnection conn) {
super.releaseConnection(conn);
conn.close();
}
}
If I am not wrong, in case of SimpleHttpConnectionManager we are not using any connection pool, if that is the case why persistence connection is used in case of SimpleHttpConnectionManager ?
Thanks
Ashar
---------------------------------
Yahoo! Messenger NEW - crystal clear PC to PC calling worldwide with voicemail
Re: No Timeout, No Exception, Runs Forever
Posted by Kent Gibson <ke...@yahoo.com>.
thanks! good idea, of course now it seems obvious.
--- Oleg Kalnichevski <ol...@apache.org> wrote:
> On Mon, 2005-10-24 at 03:56 -0700, Kent Gibson
> wrote:
> > I spent a good deal of yesterday trying to read
> this
> > url:
> >
> > http://www.bush-music.com/discover.php
> >
> > Clearly this script is misbehaving, but httpclient
> > just runs for over, no exception, no timeout,
> nada.
> >
> > I have mostly been using get methods, with
> > getResponseBodyAsStream and getResponeBody.
> >
> > I am stumped, does anyone have any ideas?
> >
> > I have tried with rc candidate 3 and 4
> >
> > thanks,
> >
> > kent
> >
>
> Kent,
>
> The CGI script is simply hopelessly broken. It keeps
> on sending
> "fgets(): supplied argument is not a valid stream"
> warning.
>
> [DEBUG] header - >> "GET /discover.php
> HTTP/1.1[\r][\n]"
> [DEBUG] header - >> "User-Agent: Jakarta
> Commons-HttpClient/3.0-rc4[\r][\n]"
> [DEBUG] header - >> "Host:
> www.bush-music.com[\r][\n]"
> [DEBUG] header - >> "[\r][\n]"
> [DEBUG] header - << "HTTP/1.1 200 OK[\r][\n]"
> [DEBUG] header - << "Date: Mon, 24 Oct 2005 17:43:06
> GMT[\r][\n]"
> [DEBUG] header - << "Server: Apache/1.3.33 (Unix)
> PHP/4.3.11[\r][\n]"
> [DEBUG] header - << "P3P: PHY ONL UNI PUR FIN COM
> NAV INT DEM CNT STA
> PRE CURa ADMa DEVa TAIo PSAo PSDo IVAa IVDa CONo
> TELo OTPi OUR UNRo PUBi
> OTRo IND DSP CAO COR[\r][\n]"
> [DEBUG] header - << "X-Powered-By:
> PHP/4.3.11[\r][\n]"
> [DEBUG] header - << "Transfer-Encoding:
> chunked[\r][\n]"
> [DEBUG] header - << "Content-Type:
> text/html[\r][\n]"
> ...
> [DEBUG] content - << "<br />[\n]"
> [DEBUG] content - << "<b>Warning</b>: fgets():
> supplied argument is not
> a valid stream resource in
> <b>/content/www/bush-music.com"
>
> Consider using HttpMethod#abort() to force terminate
> methods that fail
> to complete normally within a given time or content
> length threshold
>
> Oleg
>
>
>
>
---------------------------------------------------------------------
> To unsubscribe, e-mail:
> httpclient-dev-unsubscribe@jakarta.apache.org
> For additional commands, e-mail:
> httpclient-dev-help@jakarta.apache.org
>
>
__________________________________
Start your day with Yahoo! - Make it your home page!
http://www.yahoo.com/r/hs
---------------------------------------------------------------------
To unsubscribe, e-mail: httpclient-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: httpclient-dev-help@jakarta.apache.org
Re: No Timeout, No Exception, Runs Forever
Posted by Oleg Kalnichevski <ol...@apache.org>.
On Mon, 2005-10-24 at 03:56 -0700, Kent Gibson wrote:
> I spent a good deal of yesterday trying to read this
> url:
>
> http://www.bush-music.com/discover.php
>
> Clearly this script is misbehaving, but httpclient
> just runs for over, no exception, no timeout, nada.
>
> I have mostly been using get methods, with
> getResponseBodyAsStream and getResponeBody.
>
> I am stumped, does anyone have any ideas?
>
> I have tried with rc candidate 3 and 4
>
> thanks,
>
> kent
>
Kent,
The CGI script is simply hopelessly broken. It keeps on sending
"fgets(): supplied argument is not a valid stream" warning.
[DEBUG] header - >> "GET /discover.php HTTP/1.1[\r][\n]"
[DEBUG] header - >> "User-Agent: Jakarta
Commons-HttpClient/3.0-rc4[\r][\n]"
[DEBUG] header - >> "Host: www.bush-music.com[\r][\n]"
[DEBUG] header - >> "[\r][\n]"
[DEBUG] header - << "HTTP/1.1 200 OK[\r][\n]"
[DEBUG] header - << "Date: Mon, 24 Oct 2005 17:43:06 GMT[\r][\n]"
[DEBUG] header - << "Server: Apache/1.3.33 (Unix) PHP/4.3.11[\r][\n]"
[DEBUG] header - << "P3P: PHY ONL UNI PUR FIN COM NAV INT DEM CNT STA
PRE CURa ADMa DEVa TAIo PSAo PSDo IVAa IVDa CONo TELo OTPi OUR UNRo PUBi
OTRo IND DSP CAO COR[\r][\n]"
[DEBUG] header - << "X-Powered-By: PHP/4.3.11[\r][\n]"
[DEBUG] header - << "Transfer-Encoding: chunked[\r][\n]"
[DEBUG] header - << "Content-Type: text/html[\r][\n]"
...
[DEBUG] content - << "<br />[\n]"
[DEBUG] content - << "<b>Warning</b>: fgets(): supplied argument is not
a valid stream resource in <b>/content/www/bush-music.com"
Consider using HttpMethod#abort() to force terminate methods that fail
to complete normally within a given time or content length threshold
Oleg
---------------------------------------------------------------------
To unsubscribe, e-mail: httpclient-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: httpclient-dev-help@jakarta.apache.org
No Timeout, No Exception, Runs Forever
Posted by Kent Gibson <ke...@yahoo.com>.
I spent a good deal of yesterday trying to read this
url:
http://www.bush-music.com/discover.php
Clearly this script is misbehaving, but httpclient
just runs for over, no exception, no timeout, nada.
I have mostly been using get methods, with
getResponseBodyAsStream and getResponeBody.
I am stumped, does anyone have any ideas?
I have tried with rc candidate 3 and 4
thanks,
kent
__________________________________
Start your day with Yahoo! - Make it your home page!
http://www.yahoo.com/r/hs
---------------------------------------------------------------------
To unsubscribe, e-mail: httpclient-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: httpclient-dev-help@jakarta.apache.org
Re: <<
Posted by Ortwin Glück <od...@odi.ch>.
Dummy (cute),
You may want to use an actual *instance* of the servlet request in your
servlet code:
protected void doGet(HttpServletRequest req, HttpServletResponse resp) {
String parameterValue = req.getParameter("paramname");
}
Cheers
Ortwin Glück
dummy dum wrote:
>
> dummy dum <du...@yahoo.com> wrote:
> Hi,
> I had posted a html parameter to the a java servlet using org.apache.commons.httpclient.methods.PostMethod
> but iam retrive the posted data(param-name) using
> javax.servlet.http.HttpServletRequest.getParameter("paramname")
> i get a "null" value. I searched forums but Iam not able get the solution.
>
> httpclient version used: commons-httpclient-3.0-rc2
>
>
> <The code I used is>
>
>
>
> HttpClient httpClient = new HttpClient();
> PostMethod postMethod = new PostMethod("url");
>
>
>
> NameValuePair[] data= new NameValuePair[1];
> data[0] = new NameValuePair("paramname", "paramvalue");
> postMethod.setRequestBody(data);
>
>
>
> int httpStatus = httpClient.executeMethod(postMethod);
>
>
>
> InputStream in = postMethod.getResponseBodyAsStream();
>
> ...........
>
>
>
> <The java servlet code is >
>
>
> String parameterValue = javax.servlet.http.HttpServletRequest.getParameter("paramname");
>
>
> could u help in this ASAP.
>
>
>
> thanks in advance,
>
>
>
> the dummy
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
> ---------------------------------
> Yahoo! FareChase - Search multiple travel sites in one click.
--
[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