You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@abdera.apache.org by "James M Snell (JIRA)" <ji...@apache.org> on 2007/12/08 06:06:43 UTC
[jira] Resolved: (ABDERA-83) Allow access to some essential
parameters to HttpClient from AbderaClient
[ https://issues.apache.org/jira/browse/ABDERA-83?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
James M Snell resolved ABDERA-83.
---------------------------------
Resolution: Fixed
Fix Version/s: 0.4.0
Committed to trunk
> Allow access to some essential parameters to HttpClient from AbderaClient
> -------------------------------------------------------------------------
>
> Key: ABDERA-83
> URL: https://issues.apache.org/jira/browse/ABDERA-83
> Project: Abdera
> Issue Type: Improvement
> Reporter: Chris Berry
> Fix For: 0.4.0
>
> Attachments: AbderaClient.patch
>
>
> The AbderaClient does not expose a way to set the ConnectionTimeout and SocketTimeout in its wrapped HttpClient.
> (We are using 0.3.0 BTW)
> Setting this value is critical. Without it clients can hang (unless they add their own timeout mechanism)
> Unfortunately, the wrapped HttpClient in AbderaClient is private -- not protected -- so there is no easy fix for this (without hacking AbderaClient itself)
> I have attached a patch (built as "svn diff > patch" from the toplevel of 0.3.0)
> This patch exposes socketTimeout, connectionTimeout, HttpConnectionManagetTimeout, and TCP_NoDelay, all of which are important for use in a Production application
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
Re: [jira] Resolved: (ABDERA-83) Allow access to some essential parameters to HttpClient from AbderaClient
Posted by Chris Berry <ch...@gmail.com>.
James,
Here is the JUnit I used to test, in case you want it as well.
I did include it cuz it is based on a TestCase of my own...
// test out some additional options added to Abdera client
public void testAbderaClient() throws Exception {
String urlPath = getURLPath();
String fullURL = getServerURL() + urlPath;
String id = urlPath;
// UPDATE
// this one should fail cuz we set
setTestingAlternatelyFailOnPut
AbderaClient client = new AbderaClient();
RequestOptions options = client.getDefaultRequestOptions();
options.setHeader("Connection", "close");
int soTimeout = 1;
client.setSoTimeout( soTimeout );
assertEquals(soTimeout, client.getSoTimeout());
try {
ClientResponse response = client.get( fullURL);
fail( "should not get here" );
} catch ( org.apache.abdera.protocol.client.ClientException
ee ) {
assertTrue( ee.getCause() instanceof
java.net.SocketTimeoutException );
}
client.setSoTimeout(5000);
int connTimeout = 1;
client.setConnectionTimeout( connTimeout );
assertEquals(connTimeout, client.getConnectionTimeout() );
try {
ClientResponse response = client.get( "http://
www.foo.com/nowhere" );
fail( "should not get here" );
} catch ( org.apache.abdera.protocol.client.ClientException
ee ) {
assertTrue( ee.getCause() instanceof
org.apache.commons.httpclient.ConnectTimeoutException );
}
client.setConnectionTimeout( 5000 );
client.setTcpNoDelay( true );
assertEquals( true, client.getTcpNoDelay() );
// we have to trust that this one times out cuz even at 1ms
it doesn't -- since it is all in memory
long conMngrTimeout = 5000L;
client.setConnectionManagerTimeout( conMngrTimeout );
assertEquals(conMngrTimeout,
client.getConnectionManagerTimeout() );
ClientResponse response = client.get( fullURL );
assertEquals(400, response.getStatus());
}
}
On Dec 7, 2007, at 11:06 PM, James M Snell (JIRA) wrote:
>
> [ https://issues.apache.org/jira/browse/ABDERA-83?
> page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
>
> James M Snell resolved ABDERA-83.
> ---------------------------------
>
> Resolution: Fixed
> Fix Version/s: 0.4.0
>
> Committed to trunk
>
>> Allow access to some essential parameters to HttpClient from
>> AbderaClient
>> ---------------------------------------------------------------------
>> ----
>>
>> Key: ABDERA-83
>> URL: https://issues.apache.org/jira/browse/ABDERA-83
>> Project: Abdera
>> Issue Type: Improvement
>> Reporter: Chris Berry
>> Fix For: 0.4.0
>>
>> Attachments: AbderaClient.patch
>>
>>
>> The AbderaClient does not expose a way to set the
>> ConnectionTimeout and SocketTimeout in its wrapped HttpClient.
>> (We are using 0.3.0 BTW)
>> Setting this value is critical. Without it clients can hang
>> (unless they add their own timeout mechanism)
>> Unfortunately, the wrapped HttpClient in AbderaClient is private
>> -- not protected -- so there is no easy fix for this (without
>> hacking AbderaClient itself)
>> I have attached a patch (built as "svn diff > patch" from the
>> toplevel of 0.3.0)
>> This patch exposes socketTimeout, connectionTimeout,
>> HttpConnectionManagetTimeout, and TCP_NoDelay, all of which are
>> important for use in a Production application
>
> --
> This message is automatically generated by JIRA.
> -
> You can reply to this email to add a comment to the issue online.
>
S'all good --- chriswberry at gmail dot com