Problem ignoring local addresses when calling restlet webservices using HtpClientConnector (Ext package)

classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

Problem ignoring local addresses when calling restlet webservices using HtpClientConnector (Ext package)

aronitin
Hi Guys,

I'm facing an issue of proxy not getting bypassed for local addresses that I use to access server rest api's. Here is the description of the scenario.

I have a server with Rest api's running locally on port 8006. I'm using Restlet client (HttpClientHelper) connector to access the services. Client machines access internet through a proxy server.

When the application initialized, I read the proxy settings automatically and set it as displayed below:

client.getContext().getParameters().add("proxyHost", proxySelector.getHostname());
client.getContext().getParameters().add("proxyPort", Integer.toString(proxySelector.getPort()));

I also set the system proxy to bypass proxy for local calls as displayed below:

System.setProperty("nonProxyHosts", "localhost|127.0.0.1");
 
But, calls to http://localhost:8006 still goes through the proxy. I debugged it further and found that
org.restlet.ext.httpclient.HttpClientHelper has no code to read this system property and enable the calls to use this.

I'm stuck on this. Can somebody throw some light on how to make HttpClientHelper read this system property to bypass the proxy while accessing local server?

Thanks in advance.



Reply | Threaded
Open this post in threaded view
|

Re: Problem ignoring local addresses when calling restlet webservices using HtpClientConnector (Ext package)

aronitin
Hi Guys,

Can somebody help with the problem mentioned in the thread? It's urgent as I can't proceed further without resolving this issue.

Jerome, Tim I think you might have the workaround for the issue.

Thanks
Nitin
Reply | Threaded
Open this post in threaded view
|

Re: Problem ignoring local addresses when calling restlet webservices using HtpClientConnector (Ext package)

Tim Peierls
Which Tim do you mean? Not me, I hope -- I don't even understand the question.

--tim


On Mon, Nov 7, 2011 at 6:40 PM, Nitin Arora <[hidden email]> wrote:
Hi Guys,

Can somebody help with the problem mentioned in the thread? It's urgent as I
can't proceed further without resolving this issue.

Jerome, Tim I think you might have the workaround for the issue.

Thanks
Nitin

--
View this message in context: http://restlet-discuss.1400322.n2.nabble.com/Problem-ignoring-local-addresses-when-calling-restlet-webservices-using-HtpClientConnector-Ext-packa-tp6964835p6972553.html
Sent from the Restlet Discuss mailing list archive at Nabble.com.

------------------------------------------------------
http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447&dsMessageId=2876139

Reply | Threaded
Open this post in threaded view
|

Re: Problem ignoring local addresses when calling restlet webservices using HtpClientConnector (Ext package)

aronitin
Hi Tim,

I mentioned your name based on the responses that you have already provided in the restlet forum.

I can try and the explain the issue again.

I've a server running in the LAN which exposes the REST API on port 8006. I've another server which is outside the lan and I consume the REST API on a public url.

All the client machines are using proxy servers to access internet.

I've developed a REST client which is used to consume the API exposed on both the servers. So, I pass the proxy server information while making the restlet calls.

Problem is my first call is intranet server call like http://localhost:8006/info and I'm facing an issue where this call is getting routed through proxy and failing there and I can'r proceed further to execute the internet server call.

Code specifics are in the first post.

Help me if you have understood the problem now.

Thanks
Nitin
Reply | Threaded
Open this post in threaded view
|

Re: Problem ignoring local addresses when calling restlet webservices using HtpClientConnector (Ext package)

Tim Peierls
Ah, OK, I sort of understand the problem, but I can't help, because I don't know anything about proxy servers. Sorry -- I hope someone on the list has some ideas for you.

--tim

On Mon, Nov 7, 2011 at 10:02 PM, Nitin Arora <[hidden email]> wrote:
Hi Tim,

I mentioned your name based on the responses that you have already provided
in the restlet forum.

I can try and the explain the issue again.

I've a server running in the LAN which exposes the REST API on port 8006.
I've another server which is outside the lan and I consume the REST API on a
public url.

All the client machines are using proxy servers to access internet.

I've developed a REST client which is used to consume the API exposed on
both the servers. So, I pass the proxy server information while making the
restlet calls.

Problem is my first call is intranet server call like
http://localhost:8006/info and I'm facing an issue where this call is
getting routed through proxy and failing there and I can'r proceed further
to execute the internet server call.

Code specifics are in the first post.

Help me if you have understood the problem now.

Thanks
Nitin

--
View this message in context: http://restlet-discuss.1400322.n2.nabble.com/Problem-ignoring-local-addresses-when-calling-restlet-webservices-using-HtpClientConnector-Ext-packa-tp6964835p6972976.html
Sent from the Restlet Discuss mailing list archive at Nabble.com.

------------------------------------------------------
http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447&dsMessageId=2876166

Reply | Threaded
Open this post in threaded view
|

RE: Problem ignoring local addresses when calling restlet webservices using HtpClientConnector (Ext package)

jlouvel
Administrator

Hi Nirin,

 

This configuration option isn’t available yet on :

·         The internal HTTP client (org.restlet.engine.connector)

·         The Apache HTTP client (org.restlet.ext.httpclient)

 

I have entered this RFE: “Allow bypassing proxy”

http://restlet.tigris.org/issues/show_bug.cgi?id=1347

 

However, you should be able to make it work by using the client based on HttpURLConnection (org.restlet.ext.net) by setting the System property “nonProxyHosts”.

 

Another option is to create two Client instances or the internal connector, one configured with proxy and the other without and manually dispatch the requests using the Router class :)

 

Best regards,
Jerome
--

http://www.restlet.org

http://twitter.com/#!/jlouvel

 

 

 

De : [hidden email] [mailto:[hidden email]] De la part de Tim Peierls
Envoyé : mardi 8 novembre 2011 15:12
À : [hidden email]
Objet : Re: Problem ignoring local addresses when calling restlet webservices using HtpClientConnector (Ext package)

 

Ah, OK, I sort of understand the problem, but I can't help, because I don't know anything about proxy servers. Sorry -- I hope someone on the list has some ideas for you.

 

--tim

On Mon, Nov 7, 2011 at 10:02 PM, Nitin Arora <[hidden email]> wrote:

Hi Tim,

I mentioned your name based on the responses that you have already provided
in the restlet forum.

I can try and the explain the issue again.

I've a server running in the LAN which exposes the REST API on port 8006.
I've another server which is outside the lan and I consume the REST API on a
public url.

All the client machines are using proxy servers to access internet.

I've developed a REST client which is used to consume the API exposed on
both the servers. So, I pass the proxy server information while making the
restlet calls.

Problem is my first call is intranet server call like
http://localhost:8006/info and I'm facing an issue where this call is
getting routed through proxy and failing there and I can'r proceed further
to execute the internet server call.

Code specifics are in the first post.

Help me if you have understood the problem now.

Thanks
Nitin

--
View this message in context: http://restlet-discuss.1400322.n2.nabble.com/Problem-ignoring-local-addresses-when-calling-restlet-webservices-using-HtpClientConnector-Ext-packa-tp6964835p6972976.html

Sent from the Restlet Discuss mailing list archive at Nabble.com.

------------------------------------------------------

http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447&dsMessageId=2876166