Hello
Just to answer my own question.
//How can I pass proxy information to Fedora/Apache HttpClient?
I've found some explanation on Apache HttpClient FAQ page and following
there is a patch which can resolve this problem. However, Fedora
behaviour in this case isn't how I was expected. Basically there is no
any URL parsing and all relative URLs are death and displayed page is
incomplete. I've just realize that in this case I should use (R)
datastream instead.
Sebastian
RCS file: fedora-3.0-src/src/java/fedora/common/http/WebClient.java,v
retrieving revision 1.1.1.1
diff -r1.1.1.1 WebClient.java
36a37,38
> import org.apache.log4j.Logger;
>
48a51,54
> /** Logger for this class */
> private static Logger LOG =
Logger.getLogger(WebClient.class.getName());
>
>
112a119,130
>
> String proxyHost = System.getProperty("http.proxyHost");
> String proxyPort = System.getProperty("http.proxyPort");
> if(proxyHost!=null & proxyPort!=null){
> LOG.info("http.proxyHost == " + proxyHost);
> LOG.info("http.proxyPort == " + proxyPort);
>
client.getHostConfiguration().setProxy(proxyHost,Integer.parseInt(proxyP
ort));
> }else{
> LOG.info("http.proxyHost == " + "null");
> LOG.info("http.proxyPort == " + "null");
> }
//On Oct 14, 2008, 12:18:58 PM, Sebastian Palucha wrote:
//
//I'm using Fedora 3.0 with datastreams (E)type - Externally Referenced
and when accessing it I had following errors "500 Internal Server Error"
//caused by "SocketTimeoutException".
//
//I believe this is because our repository server is behind university
proxy/firewall; without user authentication. So I've added properties
such as http.proxyHost=wwwcache.our.domain http.proxyPort=8080 in
CATALINA/conf/catalina.properties file in order to propagate them in JVM
and Fedora software.
//
//Unfortunately this didn't help. I've started looking in source code,
and externally reference contend is accessed with WebClient.java class
which uses Apache Http Components library. In this class there is 20000
ms time out limit and I believe this should be enough to download and
process standard Google web page.
//
//How can I pass proxy information to Fedora/Apache HttpClient? Did
anybody solve similar problem?
//
//Thanks
//
//Sebastian Palucha
//
//Durham University Library
//UK
//
//Ps. Stack trace produced
//
//fedora.server.errors.GeneralException: Error getting
http://www.google.co.uk/
// at
//fedora.server.storage.DefaultExternalContentManager.get(DefaultExterna
lC
//ontentManager.java:130)
// at
//fedora.server.storage.DefaultExternalContentManager.getExternalContent
(D
//efaultExternalContentManager.java:203)
// at
//fedora.server.access.DefaultAccess.getDatastreamDissemination(DefaultA
cc
//ess.java:1109)
// at
//fedora.server.access.FedoraAccessServlet.getDatastreamDissemination(Fe
do
//raAccessServlet.java:626)
// at
//fedora.server.access.FedoraAccessServlet.doGet(FedoraAccessServlet.jav
a:
//478)
// at javax.servlet.http.HttpServlet.service(HttpServlet.java:690)
// at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
// at
//org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Appli
ca
//tionFilterChain.java:269)
// at
//org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFi
lt
//erChain.java:188)
// at
//fedora.server.security.servletfilters.FilterSetup.doFilter(FilterSetup
.j
//ava:235)
// at
//org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Appli
ca
//tionFilterChain.java:215)
// at
//org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFi
lt
//erChain.java:188)
// at
//fedora.server.security.servletfilters.FilterSetup.doFilter(FilterSetup
.j
//ava:235)
// at
//org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Appli
ca
//tionFilterChain.java:215)
// at
//org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFi
lt
//erChain.java:188)
// at
//fedora.server.security.servletfilters.FilterSetup.doFilter(FilterSetup
.j
//ava:235)
// at
//org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Appli
ca
//tionFilterChain.java:215)
// at
//org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFi
lt
//erChain.java:188)
// at
//fedora.server.security.servletfilters.FilterSetup.doFilter(FilterSetup
.j
//ava:235)
// at
//org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Appli
ca
//tionFilterChain.java:215)
// at
//org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFi
lt
//erChain.java:188)
// at
//fedora.server.security.servletfilters.FilterSetup.doFilter(FilterSetup
.j
//ava:235)
// at
//org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Appli
ca
//tionFilterChain.java:215)
// at
//org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFi
lt
//erChain.java:188)
// at
//org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperVa
lv
//e.java:213)
// at
//org.apache.catalina.core.StandardContextValve.invoke(StandardContextVa
lv
//e.java:174)
// at
//org.apache.catalina.authenticator.AuthenticatorBase.invoke(Authenticat
or
//Base.java:433)
// at
//org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.ja
va
//:127)
// at
//org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.ja
va
//:117)
// at
//org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValv
e.
//java:108)
// at
//org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java
:1
//74)
// at
//org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:
87
//4)
// at
//org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.pr
oc
//essConnection(Http11BaseProtocol.java:665)
// at
//org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoi
nt
//.java:528)
// at
//org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFoll
ow
//erWorkerThread.java:81)
// at
//org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPo
ol
//.java:689)
// at java.lang.Thread.run(Thread.java:619)
//Caused by: org.apache.commons.httpclient.ConnectTimeoutException: The
host did not accept the connection within timeout of 20000 ms
// at
//org.apache.commons.httpclient.protocol.ReflectionSocketFactory.createS
oc
//ket(ReflectionSocketFactory.java:154)
// at
//org.apache.commons.httpclient.protocol.DefaultProtocolSocketFactory.cr
ea
//teSocket(DefaultProtocolSocketFactory.java:124)
// at
//org.apache.commons.httpclient.HttpConnection.open(HttpConnection.java:
70
//6)
// at
//org.apache.commons.httpclient.MultiThreadedHttpConnectionManager$HttpC
on
//nectionAdapter.open(MultiThreadedHttpConnectionManager.java:1319)
// at
//org.apache.commons.httpclient.HttpMethodDirector.executeWithRetry(Http
Me
//thodDirector.java:386)
// at
//org.apache.commons.httpclient.HttpMethodDirector.executeMethod(HttpMet
ho
//dDirector.java:170)
// at
//org.apache.commons.httpclient.HttpClient.executeMethod(HttpClient.java
:3
//96)
// at
//org.apache.commons.httpclient.HttpClient.executeMethod(HttpClient.java
:3
//24)
// at fedora.common.http.HttpInputStream.(HttpInputStream.java:39)
// at fedora.common.http.WebClient.get(WebClient.java:144)
// at fedora.common.http.WebClient.get(WebClient.java:103)
// at
//fedora.server.storage.DefaultExternalContentManager.get(DefaultExterna
lC
//ontentManager.java:122)
// ... 36 more
//Caused by: java.net.SocketTimeoutException: connect timed out
// at java.net.PlainSocketImpl.socketConnect(Native Method)
// at java.net.PlainSocketImpl.doConnect(PlainSocketImpl.java:333)
// at
//java.net.PlainSocketImpl.connectToAddress(PlainSocketImpl.java:195)
// at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:182)
// at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:366)
// at java.net.Socket.connect(Socket.java:519)
// at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
// at
//sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.j
av
//a:39)
// at
//sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccess
or
//Impl.java:25)
// at java.lang.reflect.Method.invoke(Method.java:597)
// at
//org.apache.commons.httpclient.protocol.ReflectionSocketFactory.createS
oc
//ket(ReflectionSocketFactory.java:139)
// ... 47 more
-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Fedora-commons-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/fedora-commons-users