Hi! I have pretty simple code to download XML file using Apache HTTP client:
HttpClient client = if(configurationSettings!= null) {client.getHostConfiguration().setProxy( Integer.parseInt(configurationSettings.get("http.proxyHost"), configurationSettings.get("http.proxyPort")));} GetMethod method = method.getParams().setParameter(HttpMethodParams. System. }newGetMethod(url);RETRY_HANDLER, newDefaultHttpMethodRetryHandler(3,false));try{intstatusCode = client.executeMethod(method);if(statusCode != HttpStatus.SC_OK) {err.println("Methods failed: "+method.getStatusLine()); ByteArrayInputStream input = } e.printStackTrace(); } method.releaseConnection(); }byte[] responseBody = method.getResponseBody();newByteArrayInputStream(responseBody);returninput;catch(Exception e) {finally{returnnull;} if I am using the configurationSettings as null (actually - it was class variable, but I added it to the method parameters because I wanted the code to be consistent, I am not sure that synatx for this parameter is correct), then proxy settings are not used and the response is what I want, but if configurationSettings is not null - i.e. I am using proxy server, then there is HTTP 404 error, I tried to save the result stream in file the the resuls was a bit different for different proxy servers - but all are like the following: <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN"> <html><head> <title>404 Not Found</title> </head><body> <h1>Not Found</h1> <p>The requested URL /cat1/cat2/cat3.xml was not found on this server.</p> <p>Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request.</p> <hr> <address>Apache/2 Server at www.catserver.com Port 80</address> </body></html> I changed the actual URL and server name. I am not sure wether it is security problem, because - when I am trying to use this cat-URL from the editbox, that is usually provided in proxy servers webpage, then the response is what I intended. Well - maybe public prxy servers are not suitable to test such programs? If they are not suitable, then - could you provide some names of proxy servers that are suitable for such tests. Thanks in advance for any usefull hint! Meinhardt publicjava.io.InputStream download(String url, Map configurationSettings){newHttpClient();