MG>1)the problem calling executeMethod will need to try{..} catch for
IOException and HttpException
/**
308 * Executes the given {@link HttpMethod HTTP method}.
309 *
310 * @param method the {@link HttpMethod HTTP method} to execute.
311 * @return the method's response code
312 *
313 * @throws IOException If an I/O (transport) error occurs. Some
transport exceptions
314 * can be recovered from.
315 * @throws HttpException If a protocol exception occurs. Usually
protocol exceptions
316 * cannot be recovered from.
317 */
318 public int executeMethod(HttpMethod method)
319 throws IOException, HttpException {
320
321 LOG.trace("enter HttpClient.executeMethod(HttpMethod)");
322 // execute this method and use its host configuration, if it
has one
323 return executeMethod(null, method, null);
324 }
MG>2)If you have a "reliable HostConfiguration" why not use that?
MG>
/**
352 * Executes the given {@link HttpMethod HTTP method} using the
given custom
353 * {@link HostConfiguration host configuration} with the given
custom
354 * {@link HttpState HTTP state}.
355 *
356 * @param hostconfig The {@link HostConfiguration host
configuration} to use.
357 * If <code>null</code>, the host configuration returned by {@link
#getHostConfiguration} will be used.
358 * @param method the {@link HttpMethod HTTP method} to execute.
359 * @param state the {@link HttpState HTTP state} to use when
executing the method.
360 * If <code>null</code>, the state returned by {@link #getState}
will be used.
361 *
362 * @return the method's response code
363 *
364 * @throws IOException If an I/O (transport) error occurs. Some
transport exceptions
365 * can be recovered from.
366 * @throws HttpException If a protocol exception occurs. Usually
protocol exceptions
367 * cannot be recovered from.
368 * @since 2.0
369 */
370 public int executeMethod(HostConfiguration hostconfig,
371 final HttpMethod method, final HttpState state)
372 throws IOException, HttpException {The constructors are weak
for HostConfiguration you will need to build empty HostConfiguration
first set the Hostname, port and protocol
setHost(final String host, int port, final Protocol protocol)then set the
ProxyHost and the proxyPort
setProxy(final String proxyHost, int proxyPort)
http://www.docjar.com/html/api/org/apache/commons/httpclient/HostConfiguration.java.html
finally on multi-homed or clustered configurations set the InetAddress
/**
449 * Set the local address to be used when creating connections.
450 * If this is unset, the default address will be used.
451 * This is useful for specifying the interface to use on
multi-homed or clustered systems.
452 *
453 * @param localAddress the local address to use
454 */
455
456 public synchronized void setLocalAddress(InetAddress localAddress)
most people use static route to identify a gateway for a particular IP
configuration
request the static route from your net-admin
http://www.nongnu.org/quagga/docs/docs-multi/Static-Route-Commands.html
it is also possible on linux to configure specific rules for multi-homed systems
details on which rule to use for multi-homed on linux the command on which ip
rule you should also be obtained from net-admin
ip rule
listhttps://blogs.oracle.com/networking/entry/advance_routing_for_multi_homed
the rule will point you to the IP you should use in InetAddress
Martin
______________________________________________
Verzicht und Vertraulichkeitanmerkung/Note de déni et de confidentialité
Diese Nachricht ist vertraulich. Sollten Sie nicht der vorgesehene Empfaenger
sein, so bitten wir hoeflich um eine Mitteilung. Jede unbefugte Weiterleitung
oder Fertigung einer Kopie ist unzulaessig. Diese Nachricht dient lediglich dem
Austausch von Informationen und entfaltet keine rechtliche Bindungswirkung.
Aufgrund der leichten Manipulierbarkeit von E-Mails koennen wir keine Haftung
fuer den Inhalt uebernehmen.
Ce message est confidentiel et peut être privilégié. Si vous n'êtes pas le
destinataire prévu, nous te demandons avec bonté que pour satisfaire informez
l'expéditeur. N'importe quelle diffusion non autorisée ou la copie de ceci est
interdite. Ce message sert à l'information seulement et n'aura pas n'importe
quel effet légalement obligatoire. Étant donné que les email peuvent facilement
être sujets à la manipulation, nous ne pouvons accepter aucune responsabilité
pour le contenu fourni.
> From: [email protected]
> To: [email protected]
> Subject: RSocket Error
> Date: Thu, 19 Sep 2013 04:59:02 +0000
>
>
>
>
> Hi Folks,
>
>
>
> We are getting below random error while sending request from one web
> application to another.
>
>
>
> It is messing up the live application only for some of the requests.
>
>
>
> java.net.SocketException: Connection reset
>
> at java.net.SocketInputStream.read(SocketInputStream.java:168)
>
> at java.io.BufferedInputStream.fill(BufferedInputStream.java:218)
>
> at java.io.BufferedInputStream.read(BufferedInputStream.java:237)
>
> at
> org.apache.commons.httpclient.HttpParser.readRawLine(HttpParser.java:78)
>
> at
> org.apache.commons.httpclient.HttpParser.readLine(HttpParser.java:106)
>
> at
> org.apache.commons.httpclient.HttpConnection.readLine(HttpConnection.java:1116)
>
> at
> org.apache.commons.httpclient.MultiThreadedHttpConnectionManager$HttpConnectionAdapter.readLine(MultiThreadedHttpConnectionManager.java:1413)
>
> at
> org.apache.commons.httpclient.HttpMethodBase.readStatusLine(HttpMethodBase.java:1973)
>
> at
> org.apache.commons.httpclient.HttpMethodBase.readResponse(HttpMethodBase.java:1735)
>
> at
> org.apache.commons.httpclient.HttpMethodBase.execute(HttpMethodBase.java:1098)
>
> at
> org.apache.commons.httpclient.HttpMethodDirector.executeWithRetry(HttpMethodDirector.java:398)
>
> at
> org.apache.commons.httpclient.HttpMethodDirector.executeMethod(HttpMethodDirector.java:171)
>
> at
> org.apache.commons.httpclient.HttpClient.executeMethod(HttpClient.java:397)
>
> at
> org.apache.commons.httpclient.HttpClient.executeMethod(HttpClient.java:323)
>
> at
> com.btsl.flares.apps.mmoney.communicator.HTTPCommunicator.sendHTTPMessage(HTTPCommunicator.java:240)
>
> at
> com.btsl.flares.apps.mmoney.acceptor.handler.OneShotRequestHandler.processResponse(OneShotRequestHandler.java:81)
>
> at
> com.btsl.flares.apps.mmoney.utils.MessageProcessor.run(MessageProcessor.java:96)
>
>
>
>
>
> Please suggest what could be possible reason and fixes for the above issue.
>
>
> TXN = jdk1.6.0_33
>
> OS: Linux on Solaris
>
>
>
> Regards,
>
> Divya
>
> This e-mail and all material transmitted with it are for the use of the
> intended recipient(s) ONLY and contains confidential and/or privileged
> information. If you are not the intended recipient, please contact the sender
> by reply e-mail and destroy all copies and the original message. Any
> unauthorized review, use, disclosure, dissemination, forwarding, printing or
> copying of this email or any action taken pursuant to the contents of the
> present e-mail is strictly prohibited and is unlawful. The recipient
> acknowledges that Comviva Technologies Limited or its management or
> directors, are unable to exercise control or ensure the integrity over /of
> the contents of the information contained in e-mail. Any views expressed
> herein are those of the individual sender only and no binding nature of the
> contents shall be implied or assumed unless the sender does so expressly with
> due authority of Comviva Technologies Limited. E-mail and any contents
> transmitted with it are prone to viruses and related defects despite all
> efforts to avoid such by Comviva Technologies Limited.