You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@hc.apache.org by Bob Arnott <bo...@aungate.com> on 2007/04/19 13:54:27 UTC

HttpConnectionParams

Is there a reason why HttpConnectionParams doesn't extend BasicHttpParams?
I'm having a play and am trying to create a HTTP Server based on the
non-blocking example.

I've been trying to use Spring to inject all the necessary bits together,
but I see no way of creating a HttpParams object. The reason for this is
all the setX methods on HttpConnectionParams take a HttpParams object. Also,
all the methods on BasicHttpParams take two properties as well, i.e. key +
value, so I can't do:

<bean id="connectionParams" class="org.apache.http.params.HttpConnectionParams">
   <property name="soTimeout"            value="5000" />
   <property name="socketBufferSize"     value="8192" />
   <property name="staleCheckingEnabled" value="false" />
   <property name="tcpNoDelay"           value="true" />
</bean>

Which I can in HttpClient:

<bean id="httpClient" class="org.apache.commons.httpclient.HttpClient">
   <constructor-arg>
     <bean class="org.apache.commons.httpclient.MultiThreadedHttpConnectionManager">
       <property name="params">
         <bean class="org.apache.commons.httpclient.params.HttpConnectionManagerParams">
           <property name="defaultMaxConnectionsPerHost" value="10" />
           <property name="maxTotalConnections"          value="20" />
           <property name="connectionTimeout"            value="7000" />
           <property name="linger"                       value="-1" />
           <property name="receiveBufferSize"            value="4096" />
           <property name="sendBufferSize"               value="4096" />
           <property name="soTimeout"                    value="900000" />
           <property name="staleCheckingEnabled"         value="true" />
           <property name="tcpNoDelay"                   value="true" />
         </bean>
       </property>
     </bean>
   </constructor-arg>
   <property name="params">
     <bean class="org.apache.commons.httpclient.params.HttpClientParams">
       <property name="connectionManagerTimeout" value="10000" />
       <property name="contentCharset"           value="UTF-8" />
     </bean>
   </property>
</bean>

Are there any plans to provide for this kind of functionality, or am I going
to have to write my own implementation of HttpParams...?

Thanks,

-- 
Bob Arnott


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


Re: HttpConnectionParams

Posted by Bob Arnott <bo...@aungate.com>.
Oleg Kalnichevski wrote:

[snipped...]

> This issue has been discussed before. Please see this thread for some
> background info:
> 
> http://www.opensubscriber.com/message/httpcomponents-dev@jakarta.apache.org/5874226.html

I must have missed that thread, I didn't think I'd be the first somehow...

> Please let me know if you need some more input on the subject.

That's more than enough info for the moment.

Cheers,

-- 
Bob Arnott


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


Re: HttpConnectionParams

Posted by Oleg Kalnichevski <ol...@apache.org>.
On Thu, 2007-04-19 at 12:54 +0100, Bob Arnott wrote:
> Is there a reason why HttpConnectionParams doesn't extend BasicHttpParams?
> I'm having a play and am trying to create a HTTP Server based on the
> non-blocking example.
> 
> I've been trying to use Spring to inject all the necessary bits together,
> but I see no way of creating a HttpParams object. The reason for this is
> all the setX methods on HttpConnectionParams take a HttpParams object. Also,
> all the methods on BasicHttpParams take two properties as well, i.e. key +
> value, so I can't do:
> 

Bob,

This issue has been discussed before. Please see this thread for some
background info:

http://www.opensubscriber.com/message/httpcomponents-dev@jakarta.apache.org/5874226.html


> <bean id="connectionParams" class="org.apache.http.params.HttpConnectionParams">
>    <property name="soTimeout"            value="5000" />
>    <property name="socketBufferSize"     value="8192" />
>    <property name="staleCheckingEnabled" value="false" />
>    <property name="tcpNoDelay"           value="true" />
> </bean>
> 
> Which I can in HttpClient:
> 
> <bean id="httpClient" class="org.apache.commons.httpclient.HttpClient">
>    <constructor-arg>
>      <bean class="org.apache.commons.httpclient.MultiThreadedHttpConnectionManager">
>        <property name="params">
>          <bean class="org.apache.commons.httpclient.params.HttpConnectionManagerParams">
>            <property name="defaultMaxConnectionsPerHost" value="10" />
>            <property name="maxTotalConnections"          value="20" />
>            <property name="connectionTimeout"            value="7000" />
>            <property name="linger"                       value="-1" />
>            <property name="receiveBufferSize"            value="4096" />
>            <property name="sendBufferSize"               value="4096" />
>            <property name="soTimeout"                    value="900000" />
>            <property name="staleCheckingEnabled"         value="true" />
>            <property name="tcpNoDelay"                   value="true" />
>          </bean>
>        </property>
>      </bean>
>    </constructor-arg>
>    <property name="params">
>      <bean class="org.apache.commons.httpclient.params.HttpClientParams">
>        <property name="connectionManagerTimeout" value="10000" />
>        <property name="contentCharset"           value="UTF-8" />
>      </bean>
>    </property>
> </bean>
> 
>
> Are there any plans to provide for this kind of functionality, or am I going
> to have to write my own implementation of HttpParams...?
> 

Absolutely. I for one would love to be able to assemble HTTP services
out of HttpComponents using Spring DI framework. Initialization of
HttpParams is probably the only non-trivial problem that needs to be
resolved to make that feasible. Please see this Jira ticker for some
ideas about possible solutions:

https://issues.apache.org/jira/browse/HTTPCORE-37

Please let me know if you need some more input on the subject.

Oleg

> Thanks,
> 


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