java - Jetty blocked by company proxy -


i'm developing applicatoin runs in jetty 9.2.0. works fine far.

now have implement feature requires loading webpage. using code load it:

@path( "/bla") @get @produces( mediatype.application_json ) public childlist getbla() {      childlist childlist = new childlist();      string url = "http://www.google.de";     httpget httpget = new httpget( url ) ;     closeablehttpclient httpclient = httpclients.createdefault();     closeablehttpresponse response = null;     try{         response = httpclient.execute( httpget );     } catch ( exception e ) {         e.printstacktrace();     }      return childlist; } 

i getting "unknownhostexception". have tried start jetty -dhttp.proxyhost, -dhttp.proxyport, -dhttp.proxyuser , -dhttp.proxypassword. have tried set these properties in method above using system.setproperty().

then tried set proxy settings in java control panel.

but still "unknownhostexception".

is there way fix issue?

the problem posted source missing setting proxy. following code solve issue:

 httpget request = new httpget( url ) ;  httphost proxy = new httphost( system.getproperty( "http.proxyhost" ), integer.parseint( system.getproperty( "http.proxyport" ) ), "http");  requestconfig config = requestconfig.custom().setproxy( proxy ).build();  request.setconfig( config ); 

Comments

Popular posts from this blog

node.js - Mongoose: Cast to ObjectId failed for value on newly created object after setting the value -

gradle error "Cannot convert the provided notation to a File or URI" -

python - NameError: name 'subprocess' is not defined -