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 Thom Hehl <th...@nowhereatall.com> on 2005/09/10 14:34:43 UTC
Port problem
I need to communicate with HTTP port 3642 for a given session. Here's
the code I'm using to create my client:
//create a singular HttpClient object
Client = new HttpClient();
//establish a connection within 5 seconds
Client.getHttpConnectionManager().
getParams().setConnectionTimeout(TIMEOUT);
Client.getHostConfiguration().setHost(Host, Port, "http");
HttpClientParams parms=Client.getParams();
parms.setBooleanParameter(HttpMethodParams.SINGLE_COOKIE_HEADER,
true);
parms.setCookiePolicy(CookiePolicy.RFC_2109);
Now I create my get and send it...
public InputStream get(String url, NameValuePair[] parms)
throws heavyweight.Exception
{
GetMethod method = new GetMethod(url);
method.setQueryString(parms);
//execute the method
InputStream responseBody = null;
Client.executeMethod(method);
responseBody = method.getResponseBodyAsStream();
The problem is that when I do this, it appears to be opening port 80.
Here's a portion of the log:
2005/09/10 08:24:18:542 EDT [DEBUG] DefaultHttpParams - Set parameter
http.connection.timeout = 5000
2005/09/10 08:24:18:592 EDT [DEBUG] DefaultHttpParams - Set parameter
http.protocol.single-cookie-header = true
2005/09/10 08:24:18:592 EDT [DEBUG] DefaultHttpParams - Set parameter
http.protocol.cookie-policy = rfc2109
865 [main] DEBUG heavyweight.io.CgiProcessor -
http://orgmeta.xmlsweb.com/xmlsos/xml/v5/login.asp
865 [main] DEBUG heavyweight.io.CgiProcessor -
http://orgmeta.xmlsweb.com/xmlsos/xml/v5/login.asp
866 [main] DEBUG heavyweight.io.CgiProcessor -
http://orgmeta.xmlsweb.com/http://orgmeta.xmlsweb.com/xmlsos/xml/v5/login.asp
866 [main] DEBUG heavyweight.io.CgiProcessor -
http://orgmeta.xmlsweb.com/http://orgmeta.xmlsweb.com/xmlsos/xml/v5/login.asp
*2005/09/10 08:24:18:870 EDT [DEBUG] HttpConnection - Open connection to
orgmeta.xmlsweb.com:80*
2005/09/10 08:24:23:343 EDT [DEBUG] header - >> "GET
/http://orgmeta.xmlsweb.com/xmlsos/xml/v5/login.asp?org_id=nors&userid=AGT4&password=pics44&app=xmlsphoto
HTTP/1.1[\r][\n]"
It is trying to connect on port 80 anyway and I haven't found any way to
tell it to use a specifc port on an HttpMethod. Can someone give me some
guidance on this, please?
Thanks.
--
"In every revolution, there is one man with a vision."--Jerome Bixby
Thom Hehl
<A href="www.heavyweightsoftware.com"> www.heavyweightsoftware.com</A>
---------------------------------------------------------------------
To unsubscribe, e-mail: httpclient-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: httpclient-user-help@jakarta.apache.org
Re: Port problem
Posted by Roland Weber <RO...@de.ibm.com>.
Hi Thom,
> absolute. I was having problems with relative ones. That makes sense
> though. How do i code a relative one?
I'm not familiar with that part of the code myself.
But if you use an absolute URL with an explicit port
specification that gets ignored, this is worth a
thorough investigation. If you are using an absolute
URL without explicit port specification, I would expect
that the default port is used rather than anything set
in a HostConfiguration. But I'm not sure about it.
hope that helps anyway,
Roland
>
> Roland Weber wrote:
>
> >Hello Thom,
> >
> >could you tell us about the value of the "url" variable?
> >Is it an absolute URL like http://where.ever:3642/path/,
> >or a relative one?
> >
> >cheers,
> > Roland
> >
> >
> >
> >
> >Thom Hehl <th...@nowhereatall.com>
> >10.09.2005 14:34
> >Please respond to
> >"HttpClient User Discussion"
> >
> >
> >To
> >HttpClient User Discussion <ht...@jakarta.apache.org>
> >cc
> >
> >Subject
> >Port problem
> >
> >
> >
> >
> >
> >
> >I need to communicate with HTTP port 3642 for a given session. Here's
> >the code I'm using to create my client:
> >
> > //create a singular HttpClient object
> > Client = new HttpClient();
> >
> > //establish a connection within 5 seconds
> > Client.getHttpConnectionManager().
> > getParams().setConnectionTimeout(TIMEOUT);
> > Client.getHostConfiguration().setHost(Host, Port, "http");
> > HttpClientParams parms=Client.getParams();
> > parms.setBooleanParameter(HttpMethodParams.SINGLE_COOKIE_HEADER,
> >true);
> > parms.setCookiePolicy(CookiePolicy.RFC_2109);
> >
> >Now I create my get and send it...
> >
> > public InputStream get(String url, NameValuePair[] parms)
> > throws heavyweight.Exception
> > {
> > GetMethod method = new GetMethod(url);
> >
> > method.setQueryString(parms);
> >
> > //execute the method
> > InputStream responseBody = null;
> > Client.executeMethod(method);
> > responseBody = method.getResponseBodyAsStream();
> >
> >The problem is that when I do this, it appears to be opening port 80.
> >Here's a portion of the log:
> >
> >2005/09/10 08:24:18:542 EDT [DEBUG] DefaultHttpParams - Set parameter
> >http.connection.timeout = 5000
> >2005/09/10 08:24:18:592 EDT [DEBUG] DefaultHttpParams - Set parameter
> >http.protocol.single-cookie-header = true
> >2005/09/10 08:24:18:592 EDT [DEBUG] DefaultHttpParams - Set parameter
> >http.protocol.cookie-policy = rfc2109
> >865 [main] DEBUG heavyweight.io.CgiProcessor -
> >http://orgmeta.xmlsweb.com/xmlsos/xml/v5/login.asp
> >865 [main] DEBUG heavyweight.io.CgiProcessor -
> >http://orgmeta.xmlsweb.com/xmlsos/xml/v5/login.asp
> >866 [main] DEBUG heavyweight.io.CgiProcessor -
>
>http://orgmeta.xmlsweb.com/http://orgmeta.xmlsweb.com/xmlsos/xml/v5/login.asp
> >
> >866 [main] DEBUG heavyweight.io.CgiProcessor -
>
>http://orgmeta.xmlsweb.com/http://orgmeta.xmlsweb.com/xmlsos/xml/v5/login.asp
> >
> >*2005/09/10 08:24:18:870 EDT [DEBUG] HttpConnection - Open connection
to
> >orgmeta.xmlsweb.com:80*
> >2005/09/10 08:24:23:343 EDT [DEBUG] header - >> "GET
> >/http://orgmeta.xmlsweb.com/xmlsos/xml/v5/login.asp?
> org_id=nors&userid=AGT4&password=pics44&app=xmlsphoto
> >
> >HTTP/1.1[\r][\n]"
> >
> >It is trying to connect on port 80 anyway and I haven't found any way
to
> >tell it to use a specifc port on an HttpMethod. Can someone give me
some
> >guidance on this, please?
> >
> >Thanks.
> >
> >
> >
>
>
> --
> "In every revolution, there is one man with a vision."--Jerome Bixby
>
> Thom Hehl
> <A href="www.heavyweightsoftware.com"> www.heavyweightsoftware.com</A>
>
>
> ---------------------------------------------------------------------
> 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
Re: Port problem
Posted by Thom Hehl <th...@nowhereatall.com>.
absolute. I was having problems with relative ones. That makes sense
though. How do i code a relative one?
Roland Weber wrote:
>Hello Thom,
>
>could you tell us about the value of the "url" variable?
>Is it an absolute URL like http://where.ever:3642/path/,
>or a relative one?
>
>cheers,
> Roland
>
>
>
>
>Thom Hehl <th...@nowhereatall.com>
>10.09.2005 14:34
>Please respond to
>"HttpClient User Discussion"
>
>
>To
>HttpClient User Discussion <ht...@jakarta.apache.org>
>cc
>
>Subject
>Port problem
>
>
>
>
>
>
>I need to communicate with HTTP port 3642 for a given session. Here's
>the code I'm using to create my client:
>
> //create a singular HttpClient object
> Client = new HttpClient();
>
> //establish a connection within 5 seconds
> Client.getHttpConnectionManager().
> getParams().setConnectionTimeout(TIMEOUT);
> Client.getHostConfiguration().setHost(Host, Port, "http");
> HttpClientParams parms=Client.getParams();
> parms.setBooleanParameter(HttpMethodParams.SINGLE_COOKIE_HEADER,
>true);
> parms.setCookiePolicy(CookiePolicy.RFC_2109);
>
>Now I create my get and send it...
>
> public InputStream get(String url, NameValuePair[] parms)
> throws heavyweight.Exception
> {
> GetMethod method = new GetMethod(url);
>
> method.setQueryString(parms);
>
> //execute the method
> InputStream responseBody = null;
> Client.executeMethod(method);
> responseBody = method.getResponseBodyAsStream();
>
>The problem is that when I do this, it appears to be opening port 80.
>Here's a portion of the log:
>
>2005/09/10 08:24:18:542 EDT [DEBUG] DefaultHttpParams - Set parameter
>http.connection.timeout = 5000
>2005/09/10 08:24:18:592 EDT [DEBUG] DefaultHttpParams - Set parameter
>http.protocol.single-cookie-header = true
>2005/09/10 08:24:18:592 EDT [DEBUG] DefaultHttpParams - Set parameter
>http.protocol.cookie-policy = rfc2109
>865 [main] DEBUG heavyweight.io.CgiProcessor -
>http://orgmeta.xmlsweb.com/xmlsos/xml/v5/login.asp
>865 [main] DEBUG heavyweight.io.CgiProcessor -
>http://orgmeta.xmlsweb.com/xmlsos/xml/v5/login.asp
>866 [main] DEBUG heavyweight.io.CgiProcessor -
>http://orgmeta.xmlsweb.com/http://orgmeta.xmlsweb.com/xmlsos/xml/v5/login.asp
>
>866 [main] DEBUG heavyweight.io.CgiProcessor -
>http://orgmeta.xmlsweb.com/http://orgmeta.xmlsweb.com/xmlsos/xml/v5/login.asp
>
>*2005/09/10 08:24:18:870 EDT [DEBUG] HttpConnection - Open connection to
>orgmeta.xmlsweb.com:80*
>2005/09/10 08:24:23:343 EDT [DEBUG] header - >> "GET
>/http://orgmeta.xmlsweb.com/xmlsos/xml/v5/login.asp?org_id=nors&userid=AGT4&password=pics44&app=xmlsphoto
>
>HTTP/1.1[\r][\n]"
>
>It is trying to connect on port 80 anyway and I haven't found any way to
>tell it to use a specifc port on an HttpMethod. Can someone give me some
>guidance on this, please?
>
>Thanks.
>
>
>
--
"In every revolution, there is one man with a vision."--Jerome Bixby
Thom Hehl
<A href="www.heavyweightsoftware.com"> www.heavyweightsoftware.com</A>
---------------------------------------------------------------------
To unsubscribe, e-mail: httpclient-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: httpclient-user-help@jakarta.apache.org
Re: Port problem
Posted by Roland Weber <RO...@de.ibm.com>.
Hello Thom,
could you tell us about the value of the "url" variable?
Is it an absolute URL like http://where.ever:3642/path/,
or a relative one?
cheers,
Roland
Thom Hehl <th...@nowhereatall.com>
10.09.2005 14:34
Please respond to
"HttpClient User Discussion"
To
HttpClient User Discussion <ht...@jakarta.apache.org>
cc
Subject
Port problem
I need to communicate with HTTP port 3642 for a given session. Here's
the code I'm using to create my client:
//create a singular HttpClient object
Client = new HttpClient();
//establish a connection within 5 seconds
Client.getHttpConnectionManager().
getParams().setConnectionTimeout(TIMEOUT);
Client.getHostConfiguration().setHost(Host, Port, "http");
HttpClientParams parms=Client.getParams();
parms.setBooleanParameter(HttpMethodParams.SINGLE_COOKIE_HEADER,
true);
parms.setCookiePolicy(CookiePolicy.RFC_2109);
Now I create my get and send it...
public InputStream get(String url, NameValuePair[] parms)
throws heavyweight.Exception
{
GetMethod method = new GetMethod(url);
method.setQueryString(parms);
//execute the method
InputStream responseBody = null;
Client.executeMethod(method);
responseBody = method.getResponseBodyAsStream();
The problem is that when I do this, it appears to be opening port 80.
Here's a portion of the log:
2005/09/10 08:24:18:542 EDT [DEBUG] DefaultHttpParams - Set parameter
http.connection.timeout = 5000
2005/09/10 08:24:18:592 EDT [DEBUG] DefaultHttpParams - Set parameter
http.protocol.single-cookie-header = true
2005/09/10 08:24:18:592 EDT [DEBUG] DefaultHttpParams - Set parameter
http.protocol.cookie-policy = rfc2109
865 [main] DEBUG heavyweight.io.CgiProcessor -
http://orgmeta.xmlsweb.com/xmlsos/xml/v5/login.asp
865 [main] DEBUG heavyweight.io.CgiProcessor -
http://orgmeta.xmlsweb.com/xmlsos/xml/v5/login.asp
866 [main] DEBUG heavyweight.io.CgiProcessor -
http://orgmeta.xmlsweb.com/http://orgmeta.xmlsweb.com/xmlsos/xml/v5/login.asp
866 [main] DEBUG heavyweight.io.CgiProcessor -
http://orgmeta.xmlsweb.com/http://orgmeta.xmlsweb.com/xmlsos/xml/v5/login.asp
*2005/09/10 08:24:18:870 EDT [DEBUG] HttpConnection - Open connection to
orgmeta.xmlsweb.com:80*
2005/09/10 08:24:23:343 EDT [DEBUG] header - >> "GET
/http://orgmeta.xmlsweb.com/xmlsos/xml/v5/login.asp?org_id=nors&userid=AGT4&password=pics44&app=xmlsphoto
HTTP/1.1[\r][\n]"
It is trying to connect on port 80 anyway and I haven't found any way to
tell it to use a specifc port on an HttpMethod. Can someone give me some
guidance on this, please?
Thanks.
--
"In every revolution, there is one man with a vision."--Jerome Bixby
Thom Hehl
<A href="www.heavyweightsoftware.com"> www.heavyweightsoftware.com</A>
---------------------------------------------------------------------
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