Re: Auto-detecting proxy settings in a standalone Java app
Roland Weber wrote: Wait, here is another idea: you could write a startup script that does the proxy settings lookup, then passes the settings through -D definitions as system properties, which can be accessed by your Java application. That's a bit less ugly than calling native code from within the app. The proxy settings for the HttpURLConnection of the JDK are expected as system properties, too. Of course that implies you need to restart your app, everytime the proxy settings change... Odi - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: downloading a ZIP file with HttpClient...
Massimo, HttpClient makes no assuptions about the transferred entity. So, yes, you can download a ZIP file as any other file from a webserver. O. Glück Massimo Signori wrote: Is it possibile to download a ZIP file using HttpClient? Best regards, Massimo - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- _ NOSE applied intelligence ag ortwin glück [www] http://www.nose.ch software engineer hardturmstrasse 171 [pgp id] 0x81CF3416 8005 zürich [office] +41-1-277 57 35 switzerland [fax] +41-1-277 57 12 - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: too many TCP connections using httpClient?
Make sure to *always* call method.releaseConnection() e.g. a finally block. Even if the request was unsuccessful. Massimo Signori wrote: Hi everybody, this is my code: private void notifyTimeServer() { // logger.debug(notifyTimeServer, + timerURL); // HttpClient client = new HttpClient(); HttpMethod method = new GetMethod(timerURL); int statusCode = -1; for (int attempt = 0; statusCode == -1 attempt MAX_CALLING_ATTEMPTS; attempt++) { // logger.debug(Establishing connection); // try { statusCode = client.executeMethod(method); } catch (Exception e) { // logger.error(Error calling jsp); // } } if (statusCode != -1) { // logger.debug(Connection estabilished); // byte[] responseBody = method.getResponseBody(); method.releaseConnection(); } } I was looking with TCPView the number of TCP connections that this piece of code is opening when talking to the server and I saw that opens an incredible number of connections. All TCP connections are in TIME_WAIT state. Is there something wrong in this code? Or I'm forgetting something? Best regards, Massimo - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- _ NOSE applied intelligence ag ortwin glück [www] http://www.nose.ch software engineer hardturmstrasse 171 [pgp id] 0x81CF3416 8005 zürich [office] +41-1-277 57 35 switzerland [fax] +41-1-277 57 12 - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: can not turn off log under HttpClient
If you use Log4J, put the following in your log4j.properties: log4j.rootLogger=ERROR, stdout log4j.appender.stdout=org.apache.log4j.ConsoleAppender log4j.appender.stdout.layout=org.apache.log4j.PatternLayout log4j.appender.stdout.layout.ConversionPattern=%5p [%c] %m%n Alternatively you can use System properties to control commons-logging: System.setProperty(org.apache.commons.logging.Log, org.apache.commons.logging.impl.SimpleLog); System.setProperty(org.apache.commons.logging.simplelog.showdatetime, true); System.setProperty(org.apache.commons.logging.simplelog.log.org.apache.commons.httpclient, error); O. [EMAIL PROTECTED] wrote: Hello, When I read trace in my catalina.out, I find this information many many time : 20 oct. 2004 10:21:27 org.apache.commons.httpclient.HttpMethodBase processRedirectResponse INFO: Redirect requested but followRedirects is disabled I read carefully the HttpClient user guide about logging and Apache common logging guide, but I don't find how turn off thoses traces. I tried this but it s don' t work : MyClass{ /** logging **/ private static Log log1 = LogFactory.getLog(org.apache.commons.logging.Log); private static Log log2 = LogFactory.getLog(org.apache.commons.logging.impl.SimpleLog); private static Log log3 = LogFactory.getLog(org.apache.commons.logging.simplelog.log.httpclient.wire ); private static Log log4 = LogFactory.getLog(org.apache.commons.logging.simplelog.log.org.apache.commo ns.httpclient); private static Log log5 = LogFactory.getLog(org.apache.commons.logging.simplelog.defaultlog); ... MyClassConstructor(){ log1.isFatalEnabled(); log2.isFatalEnabled(); log3.isFatalEnabled(); log4.isFatalEnabled(); log5.isFatalEnabled(); ... } } If someone have an idea ... Thx - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- _ NOSE applied intelligence ag ortwin glück [www] http://www.nose.ch software engineer hardturmstrasse 171 [pgp id] 0x81CF3416 8005 zürich [office] +41-1-277 57 35 switzerland [fax] +41-1-277 57 12 - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: can not turn off log under HttpClient
[EMAIL PROTECTED] wrote: I have nothing against log4J, but I can not add easyly a new packagge in my application (someone else has to decide it...). So I test with System properties. But the log message is traced again : 20 oct. 2004 10:55:17 org.apache.commons.httpclient.HttpMethodBase processRedirectResponse INFO: Redirect requested but followRedirects is disabled As the logging guide states: Note: The system properties must be set before a reference to any Commons Logging class is made. So set those properties as early as possible in your application or set them on the command line withe the -D option of the JVM. O. -- _ NOSE applied intelligence ag ortwin glück [www] http://www.nose.ch software engineer hardturmstrasse 171 [pgp id] 0x81CF3416 8005 zürich [office] +41-1-277 57 35 switzerland [fax] +41-1-277 57 12 - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: File Uploading using HttpClient
IndianAtTech wrote: OK, Thanks for the Information. I have found FileUpload API from Jakarta commons project Why do we have 2 API for Uploading from Same project 1. MultipartFileUpload - (Jakarta-commons)HttpClient - Project This is a client side interface to upload to a server. 2. FileUpload - (Jakarta Commons) This is a server side interface to consume the uploaded file. Or, Is there any conceptual difference between two API?? Yes. See above. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: File Uploading using HttpClient
Michael McGrady wrote: Not sure what you are saying here, Gluck. Can you explain? I personally see these two implementations as competing applications. Michael McGrady Michael, (My first name is Ortwin btw) No they are not competing but they are complementary. You would use HttpClient to read a file from disk, wrap it in a HTTP request and send it to a server. On the server you would use FileUpload to receive the file via HTTP, decode the MIME and save it somewhere on the server. FileUpload is typically used by webapp frameworks. Cheers Ortwin Glück - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Is it possible to send and email using HTTPCLIENT?
Gerdes, Tom wrote: Thanks, for the example! Question though about it... In the main you use the send class. Is this supposed to be SendApp, or am I missing something about the code? Tom, send is a static method of SendApp. For further questions about the Java language, please refer to your favourite Java book or online resources other than this mailing list. Thanks. Odi - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: threads problem with many connections
Guillaume Cottenceau wrote: If, for example, the HTTP server sends one a byte once per second forever, HttpClient will never exit from executeMethod - if I'm correct. Yes. It's up to you to decide if that sort of communication makes sense. HTTP allows it however. 2. Open connections You can set timeouts for idle connections, so you will get a timeout exception after a while. If the connection is active (i.e. client is Yes, but that's out of the scope of the described problem. Sorry if I am missing the point!? receiving data), your application should be able to figure out if it is legitimate to stay open for such a long time and otherwise just abort the method. There's no such thing available in HttpClient, as far as I know? What 'thing'? Abort? see HttpMethod#abort in 3.0 This needs a monitor Thread setting a timeout in our application. You call try { client.execute(method) s = method.getResponseAsStream try { processStream(s) } catch(MyException) { method.abort(); } } finally { method.releaseConnection(); } Inside your stream processing you are free to throw an exception. It could make sense to implement this timeout in HttpClient, as I've said in previous mail, however I am not sure it is allowed by the HTTP protocol. No it doesn't. HttpClient doesn't care what you send over the wire, and it does not care how fast you are doing this either, because HTTP does not specify that of course. Your problem is completely in the application domain and not in the protocol domain. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: threads problem with many connections
Guillaume Cottenceau wrote: What 'thing'? Abort? see HttpMethod#abort in 3.0 I was assuming stable httpclient, sorry to not making it clear before. All right. It's true that 2.0 does not have built-in abort due to design limits. I can't say for 3.0 but in 2.0 it seems that client.execute is blocked until the server finishes sending the headers (does make sense because executeMethod returns the HTTP response code). Correct. In my upper example (a server not sending any actual header) your code excerpt is blocked forever, if I'm correct. You are. What you could do, is the following then: Wrap the client.execute call: import org.apache.commons.httpclient.util.TimeoutController; Runnable task = new Runnable() { public void run() { client.execute(method); } } long timeout = ...; //millis try { TimeoutController.execute(task, timeout); } catch(TimeoutController.TimeoutException e) { /* task has been sent an interrupt signal by now */ } I see. HttpClient uses socket timeouts for data transfer timeouts, following your reasoning this is in the HTTP protocol? HTTP is a connection based protocol and therefore requires a connection-aware transport layer. This is normally TCP. Timouts are available in all modern TCP implementations to prevent OS-level resource leaks. That's the reason why there is a timeout feature in Java (TCP-)Sockets. If you don't like socket timeouts you are free to use a custom socket factory which produces sockets that behave to your taste. Ortwin Glück -- _ NOSE applied intelligence ag ortwin glück [www] http://www.nose.ch software engineer hardturmstrasse 171 [pgp id] 0x81CF3416 8005 zürich [office] +41-1-277 57 35 switzerland [fax] +41-1-277 57 12 - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
back in two weeks
I am off to China now. See you in two weeks, guys. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: threads problem with many connections
Guillaume Cottenceau wrote: Ok, thanks for this precise code excerpt. Welcome... Is it considered safe to interrupt the execute task that way? Define 'safe'... Is method.releaseConnection() the way to go for full cleanup of underlying resources, or the interruption might leave things in a bad state? Paranoid code: import org.apache.commons.httpclient.util.TimeoutController; Runnable task = new Runnable() { public void run() { try { client.execute(method); } finally { method.releaseConnection(); } } } long timeout = ...; //millis try { TimeoutController.execute(task, timeout); } catch(TimeoutController.TimeoutException e) { /* task has been sent an interrupt signal by now */ } That way the connection will be returned to an eventual connection pool. It's just not well defined when that will happen. You might want to use the SimpleConnectionManager instead and create a new HttpClient object for every request if you want to be really safe against resource leaks. -- _ NOSE applied intelligence ag ortwin glück [www] http://www.nose.ch software engineer hardturmstrasse 171 [pgp id] 0x81CF3416 8005 zürich [office] +41-1-277 57 35 switzerland [fax] +41-1-277 57 12 - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Problem with Preferences Architecture
Vikram Goyal wrote: Hello, I am not sure if this is a bug or I am not running this right. I am trying to get the preferences architecture to modify the http.useragent property at the client level, and then retrieve the value at the method and host level. The value gets percolated down to the Method level but the Host level value does not change and gives the global value. See code below. As per the 3.0 B2 documentation, the Method and Host params should try and retrieve the value of the http.useragent from their local cache, and if it they do not find it, should go up the heirarchy, till they reach the global params. Since in the code below, the value is set at the Client level, one lower than the Global level, it should be retrieved from the Client level for both Method and Host params. Regards, Vikram The problem in your code is, that the host params are not set at all. You should add something along the lines of: host.setParams(new HostParams(client.getParams())); Ortwin Glück -- _ NOSE applied intelligence ag ortwin glück [www] http://www.nose.ch software engineer hardturmstrasse 171 [pgp id] 0x81CF3416 8005 zürich [office] +41-1-277 57 35 switzerland [fax] +41-1-277 57 12 - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Problem with Preferences Architecture
Vikram Goyal wrote: Hello, I am not sure if this is a bug or I am not running this right. I am trying to get the preferences architecture to modify the http.useragent property at the client level, and then retrieve the value at the method and host level. The value gets percolated down to the Method level but the Host level value does not change and gives the global value. See code below. As per the 3.0 B2 documentation, the Method and Host params should try and retrieve the value of the http.useragent from their local cache, and if it they do not find it, should go up the heirarchy, till they reach the global params. Since in the code below, the value is set at the Client level, one lower than the Global level, it should be retrieved from the Client level for both Method and Host params. Vikram, please ignore my first post. The problem is, that HttpClient creates a new HostConfiguration object internally and sets default on that. So your original object is not modified. So within HttpClient the host configuration will use the right user agent string. But you can not see this from the outside. This is line 389 in HttpClient.java (HEAD): HostConfiguration methodConfiguration = new HostConfiguration(hostConfiguration); Ortwin Glück -- _ NOSE applied intelligence ag ortwin glück [www] http://www.nose.ch software engineer hardturmstrasse 171 [pgp id] 0x81CF3416 8005 zürich [office] +41-1-277 57 35 switzerland [fax] +41-1-277 57 12 - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Problem with Preferences Architecture
Vikram Goyal wrote: No that is not right either. Because the HostConfiguration is created using the supplied HostConfiguration in line 389 as you say, the parameters from the supplied HostConfiguration are used to clone parameters for the new HostConfiguration, so they should all be same. See HostConfiguration.java line 126. Yes, but the information is only held in a temporary object and is not fed back to the object you pass into the execute call. Even if I use the Client's HostConfiguration using client.getHostConfiguration instead of using my own HostConfiguration and using it in the executeMethod call, the problem remains. Of course. Why do you want to query the params objects outside HttpClient anyway? Vikram -- _ NOSE applied intelligence ag ortwin glück [www] http://www.nose.ch software engineer hardturmstrasse 171 [pgp id] 0x81CF3416 8005 zürich [office] +41-1-277 57 35 switzerland [fax] +41-1-277 57 12 - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [VOTE] 2.0.2 release
+1 from me Michael Becke wrote: I propose that we mark the latest code in CVS HTTPCLIENT_2_0 as 2.0.2 and proceed with a release. Please vote as follows: -- Vote: HttpClient 2.0.2 release [X] +1 I am in favor of the release, and will help support it. [ ] +0 I am in favor of the release, but am unable to help support it. [ ] -0 I am not in favor of the release. [ ] -1 I am against this proposal (must include a reason). -- -- _ NOSE applied intelligence ag ortwin glück [www] http://www.nose.ch software engineer hardturmstrasse 171 [pgp id] 0x81CF3416 8005 zürich [office] +41-1-277 57 35 switzerland [fax] +41-1-277 57 12 - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Problem with Preferences Architecture
Vikram Goyal wrote: Sorry, I must be missing something, because I don't see it that way. The temporary object that you are talking about, methodConfiguration, is used to create the MethodDirector object that is used to execute the request. So it is passed to the execute call. Okay. I explain in detail: Your code: public class HttpClientTest { public static void main(String args[]) throws Exception { HttpClient client = new HttpClient(); client.getParams().setParameter(http.useragent, My Browser); // set the value here HostConfiguration host = new HostConfiguration(); host.setHost(www.google.com); GetMethod method = new GetMethod(/); int returnCode = client.executeMethod(host, method); System.err.println(User-Agent: + host.getParams().getParameter(http.useragent)); // does not print My Browser System.err.println(User-Agent: + method.getParams().getParameter(http.useragent)); // prints My Browser method.releaseConnection(); } } - http.useragent is set in the params object of client. You create a new HostConfiguration host, that carries another new params object. Upon the executeMethod call the following happens: 1. host is passed in 2. A copy of host ist created (methodConfiguration). This is a *deep* copy, i.e. carries it's own params object that is different from host's param object. 3. methodConfiguration and client params are passed to HttpMethodDirector 4. client params are set as the defaults for methodConfiguration param 5. methodConfiguration param are set as the defaults for method params In step 4 your http.useragent value ends up beeing the default value for params object of the *copy* created in 2 of your HostConfiguration object. Your original host object has never been passsed to HttpMethodDirector and has not been altered. That's simply why. Now, the question of course is, *if* it is correct to create this deep copy in 2. I thinks we should always clone params objects that we receive from the outside. Otherwise this may get us into trouble if they are modified concurrently from another thread or so. It would be more OO design anyway (do not expose intrinsic state). I am testing the new Preferences Architecture before writing about it in a Book that I am working on. I have spent the whole of today looking at the source code but could not locate the problem, so it is bugging me now. It makes sense, the architecture I mean, but it is just not working right for the HostConfiguration. Oh... now that you mention it, your name looks familiar. I guess the book will contain those three articles about Jakarta Commons as well. Watch out, 3.0 is ALPHA! API and contract may still change until the final version! Good luck with your book. May it become a bestseller. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Problem with Preferences Architecture
Hentzen, Rudy wrote: Does that mean you don't recommend 3.0 for use...u, damm I am boned, I was coding with it. Hopefully I can change to 2.0.2 quite easily!! Rudy No, I (along mit all other committers) really do recommend 3.0 for use as stated in our release announcement. I am just saying that API is not frozen yet. So be prepared for changes. Whether you are writing a book or are wiriting software does not matter. Both will be likely to change if we decide to change something in the API. You must decide for your project what is feasible and what is not. The advantages of using 3.0 may well outweigh this disadvantage. Ortwin Glück -Original Message- From: Ortwin Glück [mailto:[EMAIL PROTECTED] Watch out, 3.0 is ALPHA! API and contract may still change until the final version! Good luck with your book. May it become a bestseller. -- _ NOSE applied intelligence ag ortwin glück [www] http://www.nose.ch software engineer hardturmstrasse 171 [pgp id] 0x81CF3416 8005 zürich [office] +41-1-277 57 35 switzerland [fax] +41-1-277 57 12 - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Quick Question
Hentzen, Rudy wrote: Phew, good stuff, I am not doing anything particularly complicated, just a few method calls. Lucky you :-) Another thing, it is possible to, for example, get all the of the form actions from a html page, I have managed to get what I need using reg exps but just wondering if it is in the HttpClient package??? Many thanks Rudy No, Rudy, unfortunately we provide no support for that. HttpClient focuses on the transport with HTTP. HTML is out of our scope. You may want to use a read-to-use HTML parser library for that. If your page is XHTML you can just use JAXP with the XML parser of your choice of course. Ortwin Glück -- _ NOSE applied intelligence ag ortwin glück [www] http://www.nose.ch software engineer hardturmstrasse 171 [pgp id] 0x81CF3416 8005 zürich [office] +41-1-277 57 35 switzerland [fax] +41-1-277 57 12 - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Proxy
Hentzen, Rudy wrote: Thanks for the swift reply, I have a proxy ip address, is that supported?? Rudy Sure. Just fill it into the example, where it says myproxyhost and 8080 is the TCP port. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Performance
This is very good news, Eric! Thanks a lot. Eric Johnson wrote: And I've finally gotten test results back from the appropriate people here. In our test lab, between HttpClient 2.0.1 and the nightly, we found a difference of about 4ms per request. As this was a live-test environment, with all of our application environment around HttpClient, the total numbers are probably mostly irrelevant to HttpClient, but the measurable improvement was entirely due to HttpClient changes. We have some other statistics, but I worry that those are misleading for now, so I'm not mentioning those. Hopefully, I'll be able to pass along some concrete data at some point. For our purposes, the build otherwise looks stable. -Eric. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: HttpClient 3.0 is kind of done. Feedback needed
Oliver Köll wrote: I only have a minor feature request for the preferences architecture: it would be nice to be able to define default HttpMethodParams per HttpClient instance. (i'm not sure, but you may already have taken care of that). Actually that was one of the design goals of the new preferences architecture: To be able to set and override any parameter at any level. -- _ NOSE applied intelligence ag ortwin glück [www] http://www.nose.ch software engineer hardturmstrasse 171 [pgp id] 0x81CF3416 8005 zürich [office] +41-1-277 57 35 switzerland [fax] +41-1-277 57 12 - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
2.0 Webapp tests failing
Some of the Cookie tests are currently failing. Can some Cookie expert have a look into this? - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: HttpClient 3.0 is kind of done. Feedback needed
Gerdes, Tom wrote: What is the web site... I guess we should upload a copy of the 3.0 website and place a link to it. Users can create the website by checking out the CVS and run Maven 1.0: maven site:generate You will then find the Site under target/docs/index.htm Odi -- _ NOSE applied intelligence ag ortwin glück [www] http://www.nose.ch software engineer hardturmstrasse 171 [pgp id] 0x81CF3416 8005 zürich [office] +41-1-277 57 35 switzerland [fax] +41-1-277 57 12 - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: unable to find line starting with HTTP
Juan, please take a look at our logging guide: http://jakarta.apache.org/commons/httpclient/logging.html Try and get a wirelog of the communication. That will help to track down the problem. Cheers Ortwin Glück Juan Pedro López Sáez wrote: Hello all. From time to time I'm getting the following exception in my application: org.apache.commons.httpclient.HttpRecoverableException: org.apache.commons.httpclient.HttpRecoverableException: Error in parsing the status line from the response: unable to find line starting with HTTP at org.apache.commons.httpclient.HttpMethodBase.readResponse(HttpMethodBase.java:1965) at org.apache.commons.httpclient.HttpMethodBase.processRequest(HttpMethodBase.java:2659) at org.apache.commons.httpclient.HttpMethodBase.execute(HttpMethodBase.java:1093) at org.apache.commons.httpclient.HttpClient.executeMethod(HttpClient.java:675) at org.apache.commons.httpclient.HttpClient.executeMethod(HttpClient.java:558) How can I manage it in my application? Can I find out what's going wrong? Is it a server side issue? Thank you very much. Juan Pedro Lopez - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- _ NOSE applied intelligence ag ortwin glück [www] http://www.nose.ch software engineer hardturmstrasse 171 [pgp id] 0x81CF3416 8005 zürich [office] +41-1-277 57 35 switzerland [fax] +41-1-277 57 12 - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: DO NOT REPLY [Bug 28728] - HttpUrl does not accept unescaped passwords
Hey Roland, Unfortunately this has nothing to do with the URL Scheme in use (HTTP here). But only with the authentication scheme used for the specific URL and the software that interpretes the userinfo part of the URL. If the server requires NTLM for instance, userinfo could contain a NT domain attribute as well. Until now I have never encountered anything else than the username:password format, however. Also to my knowledge, there is no RFC for a HTTP URL specification where those formats for userinfo were defined. The username:password format merley seems to be an established quasi-standard that has been adopted by many software products. That means we can basically do what we think is right :-) Odi Roland Weber wrote: Hi Odi, since the class is named HttpURL (or HttpsURL), I don't think we need to bother about non-HTTP URL schemes :-) Anyway, I like your version with separate constructors for escaped and non-escaped authentication data. It gives maximum flexibility. cheers, Roland -- _ NOSE applied intelligence ag ortwin glück [www] http://www.nose.ch software engineer hardturmstrasse 171 [pgp id] 0x81CF3416 8005 zürich [office] +41-1-277 57 35 switzerland [fax] +41-1-277 57 12 - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: problem with reading response of a multipart post
Tomislav Dedus wrote: Hi, first of all great project. But I'm having little trouble with a multipart post.All other requests are working fine. After I execute the MultipartPostMethod with a few (120) StringParts nothing happens. The log shows that I get the response header HTTP/1.1 100 continue but thats all. Then after while (9ms) a SocketTimeoutException occures. Is there a problem in my code or is that a known problem? Toislav, it seems that IIS expects you to use a 100 continue handshake. Try and enable it in HttpClient. -- _ NOSE applied intelligence ag ortwin glück [www] http://www.nose.ch software engineer hardturmstrasse 171 [pgp id] 0x81CF3416 8005 zürich [office] +41-1-277 57 35 switzerland [fax] +41-1-277 57 12 - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: HttpClient Reading Partial Response
Manish Moorjani wrote: Hi Mike, Thanks for the quick response. What I mean by partial response is as follows : When I try accessing the url directly the application can do do things 1) Returns the response in one go 2) Keep on flushing after some data is fetched(say there are total 100 records, it displays 100 records first still the other 900 are getting fetched) How do I implement the option 2 using HttpClient, that is can I get some part of the response from the URL and display it on screen and then make a request for remaining part so that timeout doesnt take place. Manish, This is a server-side problem. You need to establish a custom protocol on top of HTTP to accomplish what you want. You could do it very simple and just use a custom HTTP header to tell your server that you want the data in chunks of a certain size: X-Chunksize: 100 Of course your server must interprete this header and send appropriate data that the client can handle. On the client side you must not use HttpClients response buffering. So get the response as a stream from the HttpMethod. HTH Ortwin Glück -- _ NOSE applied intelligence ag ortwin glück [www] http://www.nose.ch software engineer hardturmstrasse 171 [pgp id] 0x81CF3416 8005 zürich [office] +41-1-277 57 35 switzerland [fax] +41-1-277 57 12 - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Status Bar keeps on going
Manish Moorjani wrote: When I use the HttpClient even after the page is fetched and displayed on the browser, I still see the status bar(of browser) movng for about 20 seconds. Manish, I guess you need to explain the relation between Internet Explorer and HttpClient. Because by default there is none. Ortwin Glück - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: HttpRecoverableException
Dennis, The question is, why does the method need to be retried in the first place. You should avoid having to retry expensive methods like POST and PUT normally. Furthermore a lot of questinos arise here: * Which version of HttpClient are you using? * Is it an authentication problem? (would expect a different exception) * Are you using a proxy by any chance? * Are you opening many simultanous connections to the same host? * Which HTTP Version does the server use? * Can you provide a wire log or packet log of the communication? Thanks Ortwin Glück Labajo, Dennis wrote: Hi all. I badly need help on an error (HttpRecoverableException) I'm getting. Here's part of my java source code: the class where httpclient instance is created MultiThreadedHttpConnectionManager cmgr = new MultiThreadedHttpConnectionManager(); cmgr.setConnectionStaleCheckingEnabled( true ); cmgr.setMaxConnectionsPerHost( 10 ); cmgr.setMaxTotalConnections( 100 ); HttpClient httpclient = new HttpClient(cmgr); httpclient.setConnectionTimeout(3); httpclient.setTimeout(3); httpclient.setState( this.commonHttpState); class where httppost is made DefaultMethodRetryHandler methodretry = new DefaultMethodRetryHandler(); methodretry.setRequestSentRetryEnabled(true); PostMethod httppost = new PostMethod(this.server_url.toString()); httppost.setMethodRetryHandler(methodretry); httpClient.executeMethod(httppost); I do see the recoverable exception caught three times: 2004/08/19 11:55:44:650 CDT [INFO] HttpMethodBase - -Recoverable exception caught when processing request But on the fourth recoverable exception, I get this: 2004/08/19 11:56:07:440 CDT [WARN] HttpMethodBase - -Recoverable exception caught but MethodRetryHandler.retryMethod() returned false, rethrowing exception 2004/08/19 11:56:07:440 CDT [DEBUG] MultiThreadedHttpConnectionManager - -Freeing connection, hostConfig=HostConfiguration[host=nwapeople2.nwa.com, protocol=https:443, port=443] 2004/08/19 11:56:07:440 CDT [DEBUG] MultiThreadedHttpConnectionManager - -Notifying no-one, there are no waiting threads 2004/08/19 11:56:07:490 CDT [WARN] MainMenu - -Web Service Exception: he.commons.httpclient.HttpRecoverableException: Error in parsing the status line from the response: unable to find line starting with HTTP Is there something I'm not doing right? Thanks. Dennis -- _ NOSE applied intelligence ag ortwin glück [www] http://www.nose.ch software engineer hardturmstrasse 171 [pgp id] 0x81CF3416 8005 zürich [office] +41-1-277 57 35 switzerland [fax] +41-1-277 57 12 - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: HttpClient performance
Zulfi, I ran the profiler on HttpClient 2.0-alpha3 and HttpClient 2.0 Branch latest CVS I basically used Oleg's test case provided in the email thread you mentioned (code included). I turned off logging and stale connection checking. I ran the tests against a local Tomcat on a Win2k Pro workstation with JDK 1.4.2_02 in Eclipse 3.0. The profiler used was: http://eclipsecolorer.sourceforge.net/index_profiler.html Feel free to discuss the results attached to this email. Ortwin Glück Zulfi Umrani wrote: Hi, Just wanted to get the latest information on the performance issues reported earlier. I have gone through the below emails from Archive, but could not get a definite solution to the performance problem. Wondering whether a definite solution was found and whether there is a patch available. We tested the performance using pre-release-candidate version of HttpClient(2.0) and it was much better than the release-candidate versions and the final 2.0 version of HttpClient. Please note that I did try using the SimpleHttpConnectionManager and calling the setConnectionStaleCheckingEnabled method with false argument. The performance does improve, but it is still slower than using JDK-1.4.2. I will appreciate if someone who knows the solution can respond. http://nagoya.apache.org/eyebrowse/[EMAIL PROTECTED]msgId=781750 http://nagoya.apache.org/eyebrowse/[EMAIL PROTECTED]msgId=781859 http://nagoya.apache.org/eyebrowse/[EMAIL PROTECTED]msgId=781909 http://nagoya.apache.org/eyebrowse/[EMAIL PROTECTED]msgId=779703 Thanks. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- _ NOSE applied intelligence ag ortwin glück [www] http://www.nose.ch software engineer hardturmstrasse 171 [pgp id] 0x81CF3416 8005 zürich [office] +41-1-277 57 35 switzerland [fax] +41-1-277 57 12 - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: HttpClient performance (with download URL)
Zulfi, I ran the profiler on HttpClient 2.0-alpha3 and HttpClient 2.0 Branch latest CVS I basically used Oleg's test case provided in the email thread you mentioned (code included). I turned off logging and stale connection checking. I ran the tests against a local Tomcat on a Win2k Pro workstation with JDK 1.4.2_02 in Eclipse 3.0. The profiler used was: http://eclipsecolorer.sourceforge.net/index_profiler.html Feel free to discuss the results. Results are available for 7 days at: ftp://ftp.nose.ch/pub/outgoing/httpclient/profiling.zip Ortwin Glück Zulfi Umrani wrote: Hi, Just wanted to get the latest information on the performance issues reported earlier. I have gone through the below emails from Archive, but could not get a definite solution to the performance problem. Wondering whether a definite solution was found and whether there is a patch available. We tested the performance using pre-release-candidate version of HttpClient(2.0) and it was much better than the release-candidate versions and the final 2.0 version of HttpClient. Please note that I did try using the SimpleHttpConnectionManager and calling the setConnectionStaleCheckingEnabled method with false argument. The performance does improve, but it is still slower than using JDK-1.4.2. I will appreciate if someone who knows the solution can respond. http://nagoya.apache.org/eyebrowse/[EMAIL PROTECTED]msgId=781750 http://nagoya.apache.org/eyebrowse/[EMAIL PROTECTED]msgId=781859 http://nagoya.apache.org/eyebrowse/[EMAIL PROTECTED]msgId=781909 http://nagoya.apache.org/eyebrowse/[EMAIL PROTECTED]msgId=779703 Thanks. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- _ NOSE applied intelligence ag ortwin glück [www] http://www.nose.ch software engineer hardturmstrasse 171 [pgp id] 0x81CF3416 8005 zürich [office] +41-1-277 57 35 switzerland [fax] +41-1-277 57 12 - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Response content length is not known
Kalnichevski, Oleg wrote: The best thing you could do to help solve the problem is to capture the HTTP traffic between the browser and the web server using a traffic analyzer. Have a look at Ethereal: http://www.ethereal.com/ You can send us a packet log. (List may refuse large attachments and binary files). - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: DO NOT REPLY [Bug 30388] - Performance Increase by setting the initial ByteArrayOS length
[EMAIL PROTECTED] wrote: --- Additional Comments From [EMAIL PROTECTED] 2004-08-10 17:12 --- I have a complete template system that browses and parses webpages using multi-line regex'es. The test page was about 6-10K, on a local server with little delay. The measure was on the number of pages I could process in the whole system with a limit on memory (256MB). I can't send you the complete code (my boss would hang me), but what I can say is that before that method was one of the main bottlenecks, now it's the regular expression code. The system being tested is massively parallel, limited only by the number of threads on the MultiThreadedHttpConnectionManager and on my executor (I'm using Doug Lea's excelent concurrent library to manage works). My settings were 500-1000 concurrent conns to that website. Anything else? When dealing with such a complex system, just measuring the overall throughput can be totally wrong and misleading. I suggest you run a decent profiling of your application to see where the *real* bottlenecks are. I mean 1000 concurrent connections to a webserver are extreme. -- _ NOSE applied intelligence ag ortwin glück [www] http://www.nose.ch software engineer hardturmstrasse 171 [pgp id] 0x81CF3416 8005 zürich [office] +41-1-277 57 35 switzerland [fax] +41-1-277 57 12 - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Follow up to Bug 30514
[EMAIL PROTECTED] wrote: What I'd like to know is - is there a case when the cleaner thread realizes it can clean these not-closed connections out? A connection will always be closed at some point. You just need to wait long enough. HTTP Servers will typically drop unused connections after 15 to 60 seconds because connections are valuable resources. Then it depends on the underlying OS how long it takes until the local resources are freed and the socket object can be collected. -- _ NOSE applied intelligence ag ortwin glück [www] http://www.nose.ch software engineer hardturmstrasse 171 [pgp id] 0x81CF3416 8005 zürich [office] +41-1-277 57 35 switzerland [fax] +41-1-277 57 12 - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Wrong getResponseBody() length and too long request
Giorgi Javrishvili wrote: Hi, I need to make some crash-tests on web application, so I found the example in CVS - MultiThreadedExample.java fine But the problem is, that the request lasts much longer then in reality and method.getResponseBody() returns completely wrong data - 18MB for 600kb file. What is 'reality'? Why do you think the data is wrong? Did you check what you were getting back from the server? - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: AW: AW: Wrong getResponseBody() length and too long request
Giorgi Javrishvili wrote: Man, you are a MAN!!! Although I was pretty sure about that before, thanks for the confirmation :-) - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: setRequestHeader, GetMethod, non-HTTP
Is there a way to set non HTTP headers, i.e. if I set XYZ I want to receive XYZ on the server? I tried setting the headers using GetMethod class's setRequestHeader method. This is the way to go. Apparently I receive them as HTTP headers on the server (i.e.on setting XYZ I receive HTTP_XYZ on the server.). If you set XYZ, then XYZ will be sent over the network. I guess you are using a CGI interface on that server. So you need to handle the translation yourself. Nothing we can do here I fear. Ortwin Glück -- _ NOSE applied intelligence ag ortwin glück [www] http://www.nose.ch software engineer hardturmstrasse 171 [pgp id] 0x81CF3416 8005 zürich [office] +41-1-277 57 35 switzerland [fax] +41-1-277 57 12 - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: multipart/form-data Boundary issues
Eric Dalquist wrote: I've been looking through the code dealing with multipart form uploads and have a few questions. First off, what happens if the text that someone is uploading contains the boundary text since it is hard coded in this implementation? Eric, Actually a hard coded boundary string is bad practice. It should be randomly generated each time. Feel free to file a bug report. If your text is likely to contain the boundary string, you should use some Content-Transfer-Encoding like Base64 or quoted-printable or something. Please refer to the respective MIME specification (RFC-2045, RFC-2046, RFC-2047 and RFC-2049). Also I'm actually looking at the code to reconstruct a multipart/form-data message body from a set of files and named parameters. I don't actually want to send a request, just create the body and write it to a stream. That should pose no problem. My only issue is that I need to be able to set the boundary string from my code. Why would one want to set the boundary string explicitly? A MIME compliant server does not care about the actual boundary string value. -- _ NOSE applied intelligence ag ortwin glück [www] http://www.nose.ch software engineer hardturmstrasse 171 [pgp id] 0x81CF3416 8005 zürich [office] +41-1-277 57 35 switzerland [fax] +41-1-277 57 12 - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Question regarding Bug 20744
Marius Barbulescu wrote: I see a strange '--' in each part but I don't know if it correct or not. They are not strange but conform to RFC-2046. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Resend: disable httpclient logging
darren jiang wrote: additional info: 1. this is a standalone java program, 2. the script to launch the java process as follows: - #!/bin/sh CDS_HOME=/opt/cvm CDS_RUNTIME=$CDS_HOME/deployment/cvm echo CDS_HOME =$CDS_HOME echo CDS_RUNTIME=$CDS_RUNTIME #classpath for CDS_RUNTIME CLASSPATH=../.:$CDS_HOME/enhancements/lib/commons-httpclient-2.0.jar:$CDS_RUNTIM E/lib/struts-plus-apache-commons.jar:$CDS_RUNTIME/lib/log4j-1.2.8.jar:$CDS_RUNTI ME/lib/cdslib/cdsapi.jar:$CDS_RUNTIME/lib/cdslib/foundation.jar:$CDS_RUNTIME/ser vice/postpaidservice/lib/postpaidservice.jar:$CDS_HOME/enhancements/lib/infranet /cdk.jar:$CDS_HOME/enhancements/lib/infranet/pcm.jar:$CDS_HOME/enhancements/lib/ infranet/pcmext.jar:$CDS_HOME/enhancements/enhancements.jar:$CDS_HOME/enhancemen ts The classpath contains Log4J. So Log4J will be used by commons-logging. #classpath for deactive Account /cancel subscription CLASSPATH=$CLASSPATH:$CDS_RUNTIME/lib/classes12.zip:$CDS_RUNTIME/lib/xerces.jar: $CDS_RUNTIME/lib/xalan.jar echo $CLASSPATH $JAVA_HOME/bin/java -Djava.util.logging.config.file=/opt/cvm/enhancements/BatchL og.properties -cp $CLASSPATH com.telstra.cvm.cancellation.BatchMain $1 The java.util.logging property will be ignored, since Log4J is preferred over JDK1.4 logging. 3. in its classpath, it contains both httpclient-20.jar and struts-plus-apache-commons.jar I think HttpClient is not shipped with Struts. No problem here. 4. I change the last line to be one of the following: In which file? The default config file for Log4J is log4j.properties and is expected on the top level of the classpath. If you want to use a different filename or location you must configure Log4J manually from within your application. a) log4j.logger.org.apache.commons=ERROR b) log4j.category.org.apache.commons=ERROR c) log4j.logger.org.apache.commons.httpclient=ERROR NONE of them works! ANYONE CAN THINK OF THE REASON? many thanks! Darren Jiang -- _ NOSE applied intelligence ag ortwin glück [www] http://www.nose.ch software engineer hardturmstrasse 171 [pgp id] 0x81CF3416 8005 zürich [office] +41-1-277 57 35 switzerland [fax] +41-1-277 57 12 - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: PostMethod 's recycle method has problem
Himanshu Thube wrote: Thanks for all your answers for my questions till now. I have a problem with PostMethod. When I reuse the same method it gives a exception that PostMethod needs to be recycled. So I had put a check with help of hasbeenUsed() method of PostMethod and trying to recycle the PostMethod. Unfortunately my program hangs :( when it reaches recycle() call or even if I try to print the ResponseBody of method. Himanshu, is there any good reason for recycling the PostMethod instead of creating a new one? I personally don't like this whole recycling thing and I think it should be deprecated. I recommend creating a new Object for every request. Ortwin Glück - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [newbie-question] Port Management for HttpClient
bagas wrote: What Platform are you on? Windows XP (but I might change the platform for the real deployment) And this is the JVM : java version 1.4.1_02 Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.1_02-b06) Java HotSpot(TM) Client VM (build 1.4.1_02-b06, mixed mode) Can you provide a full stack trace please? OK ---java.net.BindException: Address already in use: connect at java.net.PlainSocketImpl.socketConnect(Native Method) This looks like a platform specific bug in the JDK. I can not find anything in Sun's Bug database though - only older stuff that matches. Can you try 1.4.2_04 and check if the bug is still there? 1.4.1 is known to be buggy... Ortwin Glück -- _ NOSE applied intelligence ag ortwin glück [www] http://www.nose.ch software engineer hardturmstrasse 171 [pgp id] 0x81CF3416 8005 zürich [office] +41-1-277 57 35 switzerland [fax] +41-1-277 57 12 - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: HttpClient 2.0 problems
Kalnichevski, Oleg wrote: Arturo, unable to find line starting with 'HTTP' error is reported or if the content-length or transfer encoding sent by the server is malformed etc. -- _ NOSE applied intelligence ag ortwin glück [www] http://www.nose.ch software engineer hardturmstrasse 171 [pgp id] 0x81CF3416 8005 zürich [office] +41-1-277 57 35 switzerland [fax] +41-1-277 57 12 - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Deprecate HttpMethod#recycle
+1 from me (although this is not a vote) :-) Kalnichevski, Oleg wrote: Folks, I suggest HttpMethod#recycle method be deprecated in 2.0 and 3.0. This has already been suggested by Eric a while ago. We should have listened - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: PostMethod 's recycle method has problem
Foran, Christopher wrote: But what if you want a persistent connection? HTTPClient handles persistent connections with the connection manager. If you call releaseConnection() are you not dropping the line? No, you are returning the connection to the pool. There is no guarantee that you will obtain the same connection to the server with the next request. But this is normally not necessary, as all connections are interchangable. I was assuming that .recycle() was the correct way to maintain a persistent connection. Don't assume, read the docs. Thanks. you're welcome Ortwin Glück -- _ NOSE applied intelligence ag ortwin glück [www] http://www.nose.ch software engineer hardturmstrasse 171 [pgp id] 0x81CF3416 8005 zürich [office] +41-1-277 57 35 switzerland [fax] +41-1-277 57 12 - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: HttpClient Consultant Needed Immediately
Lukas Bradley wrote: Because we only issue certificates for personal security reasons, we are not a valid certificate authority in Java's eyes. All you need to do is import their private CA's certificate into the keystore, so their SSL certs can be verified. -- _ NOSE applied intelligence ag ortwin glück [www] http://www.nose.ch software engineer hardturmstrasse 171 [pgp id] 0x81CF3416 8005 zürich [office] +41-1-277 57 35 switzerland [fax] +41-1-277 57 12 - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [newbie-question] Port Management for HttpClient
bagas wrote: I think using 20 thread in the same time means I only use 20 ports (and another 20 ports use by the Webserver) at the same time and there is still a lot of ports in my computer that HttpClient can bind but still HttpClient often throws exception because trying to bind already bound Socket. What Platform are you on? Can you provide a full stack trace please? Thanks Ortwin Glück - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: HttpClient problems
Some comments on the posted code: 1. You should execute releaseConnection in a finally block, to ensure the connection is returned to the pool in any case: PostMethod post = null; try { post = new PostMethod(urlAddress); /* ... */ } finally { if (post != null) post.releaseConnection(); } Otherwise you the connection pool might run out of connections if exceptions occur. 2. You are setting the Authorization header manually. You could use HttpClient's built-in authentication logic instead. 3. You are setting the encoding in the Content-Type header to ISO-8859-1, but you do not specify any encoding in xmlStr.getBytes(). This assumes that the default platform encoding be ISO-8859-1, which is true for Windows in certain locales but not for most other platforms. Furthermore this assumes your ?xml ? Header uses encoding=ISO-8859-1, which I can not verify from the code. I suggest you get the XML Stream (not a String) from a DOM directly and specify the same encoding as in the Content-Type header. paul wrote: Ortwin, It seems from the wire logs I gathered, that's the normal behaviour. I am creating a new HttpMethod object for every send. Only when I receive the response, then releaseConnection was called. Here's the code : = //convert trade to xml String xmlStr = convertTradeToXMLString(trade, some1id, someid); PostMethod post = new PostMethod(urlAddress); post.setRequestHeader(Content-type, text/xml; charset=ISO-8859-1); post.setRequestHeader (Authorization, Basic + encoding); post.setRequestHeader(HTTP-Version, HTTP/1.1); post.setRequestHeader (Connection, Keep-Alive); xmlInBytes =new ByteArrayInputStream(xmlStr.getBytes()); post.setRequestBody(xmlInBytes); if (xmlStr.length() Integer.MAX_VALUE) { post.setRequestContentLength(xmlStr.length()); } else { post.setRequestContentLength(EntityEnclosingMethod.CONTENT_LENGTH_CHUNKED); } // Execute request toConsole(B4 sending xml, connMgr.getConnectionsInUse()=+connMgr.getConnectionsInUse()); toConsole( Send xml to somewhere @ + new java.sql.Timestamp(System.currentTimeMillis())); int result = httpClient.executeMethod(post); //System.out.println(Response body: ); MQClientConstants.toConsole( Reply from fxlink received @ + new java.sql.Timestamp(System.currentTimeMillis())); String xml = post.getResponseBodyAsString(); post.releaseConnection(); = Httpclient was created like this : == connMgr = new MultiThreadedHttpConnectionManager(); connMgr.setMaxConnectionsPerHost( MAXHOSTCONNECTIONS );//20 connections MQClientConstants.toConsole(MultiThreadedHttpConnectionManager setMaxConnectionsPerHost = +MAXHOSTCONNECTIONS); connMgr.setConnectionStaleCheckingEnabled( true ); MQClientConstants.toConsole(MultiThreadedHttpConnectionManager setConnectionStaleCheckingEnabled = +true); httpClient = new HttpClient(connMgr); httpClient.setTimeout(TIMEOUT);//5 secs httpClient.setStrictMode(true); == Paul -- _ NOSE applied intelligence ag ortwin glück [www] http://www.nose.ch software engineer hardturmstrasse 171 [pgp id] 0x81CF3416 8005 zürich [office] +41-1-277 57 35 switzerland [fax] +41-1-277 57 12 - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: HttpClient problems
paul wrote: Ortwin, About 1, I have added the changes. 2, I need to add some id, pwd into the authentication logic, does httpclient api allow for setting this details? I don't think there is anything special. You can just create a UsernamePasswordCredentials object and add with the HttpState #setCredentials method. You might want to set an individual HttpState object per execute call as well. You should enable preemtive authentication as well. If you do that, set the realm to null in the setCredentials method. See API doc for details, and bug 29062 for not yet documented stuff : http://nagoya.apache.org/bugzilla/show_bug.cgi?id=29062 3, Point noted, I will add that in. I suggest you set up a test system, and run some massive multithreading tests against it to reproduce the problem reliably. So you can tell when you have fixed the problem. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: does HttpClient transparently send proxy auth after getting HTTP 403 code?
Alex Hunsley wrote: My main question is: if I don't call setAuthenticationPreemptive(true), and if HttpClient tries to use a proxy and receives an HTTP 403 (proxy auth required) message back, will it transparently then give the proxy auth that I have set, or will it just give me the 403 code it received? On a 403 response from the proxy, HttpClient will try to authenticate with the proxy by repeating the request, if (and only if) you have set credentials that are applicable to the host and realm. If all auth attempts fail, you will get the 403 response back as a last resort. Please make sure you set the correct hostname and realm for your credentials. p.s. I have had no luck at all finding a simple proxy that is runnable under cygwin or windows that will let me enable basic proxy authorization so I can test this. Check out Squid, which is available for Cygwin (Web category) and native Window (which is kinda not well-supported). Its config file is huge (squid can do a lot) but quite straight forward. HTH Ortwin Glück - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: HttpClient problems
paul wrote: 2004/05/26 20:09:50:564 SGT [DEBUG] MultiThreadedHttpConnectionManager - -Notifying no-one, there are no waiting threads org.apache.commons.httpclient.HttpRecoverableException: java.net.SocketException: Connection reset at org.apache.commons.httpclient.HttpMethodBase.readResponse(HttpMethodBase.java:1965) at org.apache.commons.httpclient.HttpMethodBase.processRequest(HttpMethodBase.java:2659) Does anybody know what causes the SocketException ? Not yet, but we're gonna find out for you :-) Please produce a wirelog and send the section with the request / response immediately preceding the exception. For instructions about how to make a wirelog please see our Logging Guide: http://jakarta.apache.org/commons/httpclient/logging.html Please note that wire logging will slow down your application considerably! This is escpecially bad, because the problem you are experiencing seems to happen randomly. Please make sure you disable logging after you have successfully captured the output. Is it becos I didn't set a higher maximum connection per host using setMaxConnectionsPerHost on the MultiThreadedHttpConnectionManager object ? Probably not - just doesn't look like it. Pls help. This is urgent as I am currently using it on a production system. You are welcome. Maybe we should start offering commercial support and make A LOT of money :-) -- _ NOSE applied intelligence ag ortwin glück [www] http://www.nose.ch software engineer [email] [EMAIL PROTECTED] hardturmstrasse 171 [pgp id] 0x81CF3416 8005 zürich [office] +41-1-277 57 35 switzerland [fax] +41-1-277 57 12 - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: NTLMv2
Fuhrmann, Hauke wrote: Hi there finally seem to find my problem: The IIS I want to request web pages from uses NTLMv2 authentification. I guess, the httpclient only supports NTLMv1, is that true? As the password hashes in v1 and v2 are different, the handshake will fail. Will v2 be implemented in short term? This question has been asked a while ago. See http://nagoya.apache.org/eyebrowse/[EMAIL PROTECTED]msgNo=5973 The answer you are looking for is the last in that thread. (follow links on bottom of page) -- _ NOSE applied intelligence ag ortwin glück [www] http://www.nose.ch software engineer [email] [EMAIL PROTECTED] hardturmstrasse 171 [pgp id] 0x81CF3416 8005 zürich [office] +41-1-277 57 35 switzerland [fax] +41-1-277 57 12 - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: HttpClient problems
paul wrote: 2004/05/26 20:09:50:290 SGT [DEBUG] EntityEnclosingMethod - -Request body sent 2004/05/26 20:09:50:562 SGT [DEBUG] HttpMethodBase - -Closing the connection. Why is the connection closed here? Who is doing this? The response has not been read yet! Could this be a threading issue? Are you reusing HttpMethod objects? At what point you call HttpMethod#releaseConnection()? Any code from your app available? 2004/05/26 20:09:50:563 SGT [INFO] HttpMethodBase - -Recoverable exception caught when processing request 2004/05/26 20:09:50:563 SGT [WARN] HttpMethodBase - -Recoverable exception caught but MethodRetryHandler.retryMethod() returned false, rethrow ing exception 2004/05/26 20:09:50:564 SGT [DEBUG] MultiThreadedHttpConnectionManager - -Freeing connection, hostConfig=HostConfiguration[host=somewhere.com, protocol=https:443, port=443] 2004/05/26 20:09:50:564 SGT [DEBUG] MultiThreadedHttpConnectionManager - -Notifying no-one, there are no waiting threads org.apache.commons.httpclient.HttpRecoverableException: java.net.SocketException: Connection reset at org.apache.commons.httpclient.HttpMethodBase.readResponse(HttpMethodBase.java:1965) -- _ NOSE applied intelligence ag ortwin glück [www] http://www.nose.ch software engineer [email] [EMAIL PROTECTED] hardturmstrasse 171 [pgp id] 0x81CF3416 8005 zürich [office] +41-1-277 57 35 switzerland [fax] +41-1-277 57 12 - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: is this mailing list protected against spam harvesters?
Alex Hunsley wrote: Btw, is this mailing list protected against spam harvesters? No, as far as I can see not. I complained about this issue when Eyebrowse went online but my complaints were graciously ignored. Anybody on the PMC who is responsible for that? I know the archives are published online, are the email addresses in the messages online protected in any way, or are they ripe for the harvesters? Even worse, we have archives in mbox format here accessible for the public: http://jakarta.apache.org/mail/bsf-dev/ There are some more archives that archive our lists: * mail-archive.com does a very good job at filtering out email addresses * marc.theaimsgroup.com is not bad, but not good enough Don't know about the rest. Actually 95% of email I get is uninteresting mailing list junk, SPAM or virii, about 10-20 MB per day. Ortwin Glück - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Help on getting started using HttpClient
Gowda, Prasad wrote: HTML !-- File: redirectmeta.html -- HEAD TITLELivelink - Redirection/TITLE META HTTP-EQUIV=Refresh CONTENT=0; URL=/customapp/view/ASE_Roles.html?func=loadParentPage /HEAD /HTML Now my question, how do I get the HttpClient to go to this redirect url and retrieve the actual content. Prasad, Let me explain, that normally redirects are caused by the Location HTTP header and a redirect status code. But the redirect in your case is requested by the body of the HTTP message, that is the HTML code. HttpClient is not HTML specific and not a web browser. Therefore HttpClient does not look into the HTTP message body and can not interprete HTML. You will need to parse the HTML code and find the meta tag yourself. You could either just write a simple parser for this specific purpose or employ a full-blown HTML parser [1]. [1] ask Google: http://www.google.com/search?q=java+HTML+parserhl=debtnG=Search -- _ NOSE applied intelligence ag ortwin glück [www] http://www.nose.ch software engineer [email] [EMAIL PROTECTED] hardturmstrasse 171 [pgp id] 0x81CF3416 8005 zürich [office] +41-1-277 57 35 switzerland [fax] +41-1-277 57 12 - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: retrieved wired code for Unicode
K.M. Ku wrote: Hi Mike Thx for info. However, I cannot get the correct Unicode character after storing in String. It is oK for ISO8859 (as it is the default charset of httpclient, right?). Can you share me the correct method to store the Unicode characters into String variable? Thx a millon. KMKU The server should set the correct encoding in the Content-Type header. Then you can use HttpMethod#getResponseAsString. Otherwise use HttpMethod#getResponseAsStream and use a java.io.InputStreamReader with a specified encoding. -- _ NOSE applied intelligence ag ortwin glück [www] http://www.nose.ch software engineer [email] [EMAIL PROTECTED] hardturmstrasse 171 [pgp id] 0x81CF3416 8005 zürich [office] +41-1-277 57 35 switzerland [fax] +41-1-277 57 12 - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Sun's javax.net.ssl and HttpClient
Himanshu Thube wrote: Hi I am trying to suggest Apache Http client library against SUN javax.net.ssl for our application, our application requirement is as follows : 1. SSL support HttpClient makes no assumptions about the underlying Transport Level Security. This is completely abstracted away by Socket Factories. You may use any SSL Implementation of your choice. see the SSL Guide for more detailed information: http://jakarta.apache.org/commons/httpclient/sslguide.html 2. Reuse the SSLSession / HttpState while reconnecting to web server (Apache) HttpClient can reuse open connections through a connection pool. You must do proper SSL session handling yourself. 3. Restablishing Http(s) connection multiple times to web server No problem. 4. HttpClient should have same behaviour like a Browser (IE) What do you mean exactly? HTTP is a standard. We follow the standards. For convenience we have support for 'browser compatibility' mode in some places like Cookie handling, to mimic common bugs in popular browsers. HttpClient also has an option (strict mode = off) to be forgiving about server-side HTTP misbehaviour (like plain wrong headers). 5. Asynchronous communication where Http client opens connection and should recieve data from server whenever server has some data for http client. You can get the response data as a non-buffered input stream. Reading is blocking. However you will need to account for connection timeouts. 6. Other requirements are Performance, etc.. HttpClient performs extremely well (set logging to a high level). From the web I found few comparisons but some of them were vague (e.g. One features page of Http client it is written The jdk has the HttpUrlConnection which is limited and in many ways flawed) but there is no concrete explaination for this. Another comparison link http://www.nogoop.com/product_16.html#compare does not provide sufficient comparison for my requirement. That comparison seems up to date, even though it has been online for several years now. I would say 'fix turnaround' is very high here though. Can someone provide concrete link or information, about comparison between Apache Http client library against SUN javax.net.ssl for my requirements ? None that I know of. If you find any third party reviews of HttpClient, please let us know. For my requirement, I came up with only one valid point where Apache Http client library provides a API where I can associate HttpState with Http(s) connection. I guess if I dig more into JDK I will also find a way to do this over there. One more question - Does HttpState contain the Credentials ? Does this also contain SSL information (certificates, etc...) It is just a marker interface at the moment. So does it contain certificates, etc... like SUN's SSLSession ? HttpState does contain the credentials. However SSL certificates are completely handled by the underlying SSL implementation. HttpClient does not handle those for you. Regards Himanshu HTH Ortwin Glück -- _ NOSE applied intelligence ag ortwin glück [www] http://www.nose.ch software engineer [email] [EMAIL PROTECTED] hardturmstrasse 171 [pgp id] 0x81CF3416 8005 zürich [office] +41-1-277 57 35 switzerland [fax] +41-1-277 57 12 - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: StatusLine IndexOutOfBounds
Sam Berlin wrote: I'm not sure if this problem is still on CVS HEAD, but we're seeing it against 2.0rc2. Sam, would you mind writing a JUnit test case exhibiting the problem against CVS HEAD? Thanks. Ortwin Glück - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [VOTE] 3.0 alpha 1 release
-0 I would like to see issue http://nagoya.apache.org/bugzilla/show_bug.cgi?id=28728 fixed first. Odi Michael Becke wrote: I propose that we mark the latest code in CVS HEAD as 3.0 alpha 1 and proceed with a release. Please vote as follows: -- Vote: HttpClient 3.0 alpha 1 release [ ] +1 I am in favor of the release, and will help support it. [ ] +0 I am in favor of the release, but am unable to help support it. [ ] -0 I am not in favor of the release. [ ] -1 I am against this proposal (must include a reason). -- - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [VOTE] 3.0 alpha 1 release
Oleg Kalnichevski wrote: Odi, The sole purpose of 3.0 alpha1 release to get people look at the API and give us some feedback on how it is shaping up. Alpha1 release is hardly expected to be bug free I really can't see why #28728 should be a release blocker Oleg Oleg, I agree it's not a release blocker. I don't wanna be a dick here. It is just a bug that requires nearly no effort to fix. So why not include the fix in alpha. Odi - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [VOTE] 3.0 alpha 1 release
+0 with the patch for #28728 that was just committed. cheers Odi Michael Becke wrote: I propose that we mark the latest code in CVS HEAD as 3.0 alpha 1 and proceed with a release. Please vote as follows: -- Vote: HttpClient 3.0 alpha 1 release [ ] +1 I am in favor of the release, and will help support it. [ ] +0 I am in favor of the release, but am unable to help support it. [ ] -0 I am not in favor of the release. [ ] -1 I am against this proposal (must include a reason). -- -- _ NOSE applied intelligence ag ortwin glück [www] http://www.nose.ch software engineer [email] [EMAIL PROTECTED] hardturmstrasse 171 [pgp id] 0x81CF3416 8005 zürich [office] +41-1-277 57 35 switzerland [fax] +41-1-277 57 12 - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Posting XML over authenticated connection using SSL
Lee Francis Wilhelmsen wrote: - The server responds saying not authorized with a realm value - HTTP Client then resends the post using the credentitals I have supplied (why doesn't it do this the first time?) This is the standard behaviour. You can enable preemtive authentication. org.apache.commons.httpclient.HttpRecoverableException: Error in parsing the status line from the response: unable to find line starting with HTTP DEBUG [main] httpclient.wire - HTTP/1.1 401 Unauthorized [\r][\n] DEBUG [main] httpclient.wire - Server: IBM HTTP Server/V5R3M0[\r][\n] DEBUG [main] httpclient.wire - Date: Fri, 14 May 2004 11:18:33 GMT[\r][\n] DEBUG [main] httpclient.wire - Accept-Ranges: bytes[\r][\n] DEBUG [main] httpclient.wire - Content-Type: text/html; charset=IBM-1047[\r][\n] DEBUG [main] httpclient.wire - Content-Length: 282[\r][\n] DEBUG [main] httpclient.wire - Last-Modified: Fri, 14 May 2004 11:18:33 GMT[\r][\n] DEBUG [main] httpclient.wire - Expires: Fri, 14 May 2004 11:18:33 GMT[\r][\n] DEBUG [main] httpclient.wire - Pragma: no-cache[\r][\n] DEBUG [main] httpclient.wire - Cache-Control: no-cache[\r][\n] DEBUG [main] httpclient.wire - WWW-Authenticate: Basic realm=STING_Restricted[\r][\n] DEBUG [main] httpclient.wire - IMW0254E HTMLHEADTITLEError/TITLE/HEADBODY bgcolor=[0xfffd][0xfffd]FFF7E7H1Error 401/H1IMW0216E Not authorized. Authentication failed.PHRADDRESSA HREF=https://e-torg.no.ihost.com/; target=_topIBM HTTP Server - North American Edition V5R3M0/A/ADDRESS/BODY/HTML DEBUG [main] httpclient.wire - POST /sting/StingServlet Notice there is no closing character and this seems to be the cause of this particular problem. Why is this happening? Can anyone help? Best regards Lee Francis Wilhelmsen Lee, The problem is that your server reports an incorrect Content-Length on the 401 Response body. Count yourself: It sais 282 bytes. But the response is 283 bytes. (the two [0xfffd] sequences are one byte each). Nothing we can do here I fear. Ortwin Glück -- _ NOSE applied intelligence ag ortwin glück [www] http://www.nose.ch software engineer [email] [EMAIL PROTECTED] hardturmstrasse 171 [pgp id] 0x81CF3416 8005 zürich [office] +41-1-277 57 35 switzerland [fax] +41-1-277 57 12 - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Posting XML over authenticated connection using SSL
Kalnichevski, Oleg wrote: I agree with Odi that incorrect Content-Length value appears to be the culprit. I suggest you also file a bug report with IBM. Not setting the content length correctly is a really gross violation of the HTTP 1.1 Protocol. It makes reusing the same connection completely impossible as the client must get out of sync. Maybe you can also try and modify the 401 error document on the server side and see if that makes any difference. -- _ NOSE applied intelligence ag ortwin glück [www] http://www.nose.ch software engineer [email] [EMAIL PROTECTED] hardturmstrasse 171 [pgp id] 0x81CF3416 8005 zürich [office] +41-1-277 57 35 switzerland [fax] +41-1-277 57 12 - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: HTTP 302 Console output handle question
Mahamood, Saad (SD) wrote: org.apache.commons.httpclient.HttpException: Redirect from host www.bgis.gov.bb to www.barbados.gov.bb is not supported WARNING: Invalid Redirect URI from: http://www.bgis.gov.bb:80/ to: http://www.barbados.gov.bb/bgis.htm My question is, how do I get a handle on this output within in my code? Since I want to be able to display to the end user the redirected website that they should be referencing to. Please read: http://jakarta.apache.org/commons/httpclient/redirects.html The website below talks somthing about logging, but again I have no idea how to use it: Please refer to the Commons Logging and the Log4J websites. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: A few remaining issues to be discussed before we cut 3.0a1
Oleg Kalnichevski wrote: (1) Since this release is going to be incompatible with 2.0 API anyways, I suggest HttpException be changed to derive from Exception and not IOException. As you know, I have a very relaxed oppinion of breaking API compatibility. I am in favour of this change. (2) I no longer want to conceal my frustration with the way bugzilla is managed. Frankly I am fed up. I suggest we seriously consider moving to Jira. Anything I can help here? -- _ NOSE applied intelligence ag ortwin glück [www] http://www.nose.ch software engineer [email] [EMAIL PROTECTED] hardturmstrasse 171 [pgp id] 0x81CF3416 8005 zürich [office] +41-1-277 57 35 switzerland [fax] +41-1-277 57 12 - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: A few remaining issues to be discussed before we cut 3.0a1
Kalnichevski, Oleg wrote: As you know, I have a very relaxed oppinion of breaking API compatibility. I am in favour of this change. Same here. But I have to admit we might be a minority on this issue You know, the Swiss like votes, and democracy :-) Anything I can help here? Only to help me drown my frustration in a few beers ;-) On a more serious note, I do not think there's much we can do. Our only option is to vote in favour of migration to Jira and hope that Jira is better supported You got my +1 Odi - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [VOTE] Migrate HttpClient issue tracking from Bugzilla to Jira
+1 Vote: Migrate HttpClient issue tracking from Bugzilla to Jira [x] +1 I am in favor of the proposal, and will help support it. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [newbie] Logger Appender
log4.properties log4j.rootCategory=DEBUG, C log4j.appender.F=org.apache.log4j.FileAppender log4j.appender.F.File=C:/Temp/my.log log4j.appender.F.layout=org.apache.log4j.PatternLayout log4j.appender.F.layout.ConversionPattern = %d %-5p [%t] %c %3x - %m\n log4j.appender.N=org.apache.log4j.net.SocketAppender log4j.appender.N.RemoteHost=localhost log4j.appender.N.Port=4445 log4j.appender.N.ReconnectionDelay=5000 log4j.appender.N.layout=org.apache.log4j.PatternLayout log4j.appender.N.layout.ConversionPattern = %d %-5p [%t] %c %3x - %m\n log4j.appender.C=org.apache.log4j.ConsoleAppender log4j.appender.C.layout=org.apache.log4j.PatternLayout log4j.appender.C.layout.ConversionPattern = %d %-5p [%t] %c %3x - %m\n The above defines 3 different appenders and uses the console appender for DEBUG level (all) output. To use the file appender instead, change the first line to: log4j.rootCategory=DEBUG, F Please refer to the Log4J documentation or other resources on the web for more information. Ortwin Glück bagas wrote: Hi all, I try to use log4j as httpclient logger but I receive a warning : log4j:WARN No appenders could be found for logger (org.apache.commons.httpclient.HttpClient). log4j:WARN Please initialize the log4j system properly. How can set an appender to a logger ? please give me a example Thanx -- _ NOSE applied intelligence ag ortwin glück [www] http://www.nose.ch software engineer [email] [EMAIL PROTECTED] hardturmstrasse 171 [pgp id] 0x81CF3416 8005 zürich [office] +41-1-277 57 35 switzerland [fax] +41-1-277 57 12 - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: IIS (NTLM) + proxy server (NTLM or basic) problem
Adrian Sutton wrote: There is absolutely no way that HttpClient can authenticate with both an NTLM proxy and an NTLM host at the same time. The protocol just doesn't allow for it, It would be worth mentioning that in a sentence or two in our authentication guide. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Using HttpClient for a servlet include
Beller, Maximilian wrote: But I need the external action to access my HttpServletRequest(session) and HttpServletResponse. Those are local objects you can not and should not expose to external applications. Please consider the use of web services in conjunction with EJBs. Otherwise I fear you will end up in a terrible mess. Ortwin Glück -- _ NOSE applied intelligence ag ortwin glück [www] http://www.nose.ch software engineer [email] [EMAIL PROTECTED] hardturmstrasse 171 [pgp id] 0x81CF3416 8005 zürich [office] +41-1-277 57 35 switzerland [fax] +41-1-277 57 12 - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Bug in HTTPUrl?
Oleg Kalnichevski wrote: Folks, Any idea what to do with one? First of all, user name and password in HTTP url is something completely new to me. Any idea what Sung-Gu had in mind? Oleg We need to check what is the allowed character range that is supported in the username/password part of a HTTP-URL and how that is compatible with the URI specs and if there is any escaping defined. Maybe we'll just raise an exception if invalid characters are found. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Bug in HTTPUrl?
Roland Weber wrote: Hi Oleg, see RFC 2396, URI: Generic Syntax, section 3.2.2: userinfo@host:port Some URL schemes use the format user:password in the userinfo field. This practice is NOT RECOMMENDED, because the passing of authentication information in clear text (such as URI) has proven to be a security risk in almost every case where it has been used. cheers, Roland Roland, of course it is out of question that this poses security problems. But this fact does not make the URI classes less buggy. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Bug in HTTPUrl?
Roland Weber wrote: Hi Ortwin, the quote was not meant as an estimation. Just a hint why that part of the URI spec might be less well known as others. Ok :-) BTW, the section also defines the valid characters: userinfo = *( unreserved | escaped | ; | : | | = | + | $ | , ) unreserved= alphanum | mark mark = - | _ | . | ! | ~ | * | ' | ( | ) escaped = % hex hex alphanum = (is just [a-zA-Z0-9]) So, actually this seems not to be a bug in the URI classes directly. The hash # character should have been escaped with %23 in the first place. All we could do is check for invalid characters and throw an exception here. I'm just not sure if this check is actually worth it. Probably not. It makes parsing overly complicated. We should just well formatted input for URI and HttpURL classes. Gustav, can you live with this answer? Ortwin Glück - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: customizing debugging levels per httpclient instance
Jorrit Kronjee wrote: I would like to see the wire of one of the threads, but suppress the other. Currently this is not possible. A simple workaround with Log4J is: * set your logging string to include the thread name * grep the log for the thread name you whish HTH Ortwin Glück - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [newbie] SSL
bagas wrote: Dear All, I am sorry let me rephrase my question. What I want to ask are 1. How do I check and approve a certificate sent by a web server in https request? So that I don't get error like : javax.net.ssl.SSLHandshakeException:sun.security.validator.ValidatorExce ption: No trusted certificate found. 2. Can a HttpClient uses a certificate so that it can be verified by a webserver that it trying to connect? If this can be done please give me an example? Thank You. Regards, Rahmat Bagas Santoso Please check out the SSL guide http://jakarta.apache.org/commons/httpclient/sslguide.html which should answer your questions. As statet frequently on this list, HttpClient makes no assumptions about the underlying SSL implementation. Please refer to the documentation of your SSL implementation for further information. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: using it as a http-url-handler...
There is o.a.c.h.util.HttpURLConnection. It's ancient and I don't know if it will work for you, but it's certainly a starting point. gabor wrote: i know this has been asked before, but maybe some progress has been made i need to use httpclient as a http url-handler in java (registering it with java.protocol.handler.pkgs and so on). - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Socket redirect
Thorsten Scherler wrote: I have written a sonar for web services. One part of that application is the httpClient. Thorsten, which version of HttpClient are you using? - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Socket redirect
Thorsten Scherler wrote: 2.0 rc2 Please consider updrading to 2.0 final. This should not need any changes in your application. ...but like I stated in the last mail it was NOT a problem of the httpClient after all. The problem was a misconfiguration of our server! ...by the way sorry for the hassle! King regards Thorsten Never mind. Ortwin Glück - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: License 2.0 Broilerplate
Jandalf wrote: Any objections? I completely agree. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: question about performance
Alvarez, Gil wrote: After the port, we saw a significant increase in cycles used by the machines, about 2-3 times (ie, the load on the boxes increased from using up 20% of the cpu, to about 50%-60% of the cpu. Besides the hints already given, you should profile your application to find out where the most CPU time is spent. Using Eclipse Profiler Plugin, this is a simple task. Ortwin Glück - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: JRE problem
Thiago Kleinubing wrote: java.lang.VerifyError: (class: AppTeste, method: init signature: ()V) Incompatible object argument for function call The Exception suggests that the class AppTeste is causing the problem. You should try and recompile your Applet with a Sun JDK 1.3 or use the -target 1.3 option. Please note that this has nothing to do with the HttpClient library. Ortwin Glück - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Logging issue
paul wrote: Michael, Both classpaths are the same and both don't have log4j. The jars are commons-httpclient-2.0.jar commons-logging.jar . But when compiling, it have log4j before commons-logging.jar, does it matter? Paul Are you running the same JDK version on both machines? Commons-logging will use JDK 1.4 logging automatically if available. You can also try and pass the System properties on the java command line (-D option). - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Bug in HTTPUrl?
It seems that the problem is in URI.java line 1886 that does not like meta characters in the userinfo. Should we be escaping the userinfo somehow (?) before passing the string to URI? Odi Gustav Munkby wrote: hi, If I do: HTTPUrl url = new HTTPUrl(kurt, nicepass#, hostname, 80, path); throws a URIException with message port number invalid. First of all the message is wrong... Next attempt was to urlencode the password, which resulted in the above line working, but the password was sent url-encoded to the destination, which can hardly be the desired behaviour? regards, Gustav Munkby - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- _ NOSE applied intelligence ag ortwin glück [www] http://www.nose.ch software engineer [email] [EMAIL PROTECTED] hardturmstrasse 171 [pgp id] 0x81CF3416 8005 zürich [office] +41-1-277 57 35 switzerland [fax] +41-1-277 57 12 - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: The httpclient.wire log.
Geir H. Pettersen wrote: Hi, I have been using the commons httpclient successfully since rc1. Great work guys! This is the best client that I ever have used in java. Thanks for the flowers, Geir! The httpclient.wire log is fantastic, but there is something there that bothers me a bit. Before the characters are written to log, they are decoded with US-ASCII (or the default character set if that fails). The problem with this is if you try to debug http traces with special character you will actually lose information on what is actually sent. My example is: I am having some encoding problems with my client, and I want to check exactly what bytes I am sending. I am sending the three Norwegian characters (1)æ (2)ø and (3)å. (ae together, o with a slash and a with a ring over). (1) is encoded in UTF-8 as 0xc3 0xa6 (2) is encoded in UTF-8 as 0xc3 0xb8 (3) is encodes in UTF-8 as 0xc3 0xa5 The problem is when I try to POST these three characters. It is logged as: [0xfffd][0xfffd][0xfffd][0xfffd][0xfffd][0xfffd] (but actually that is not what is sent) I want the log to be: [0xc3][0xa6][0xc3][0xb8][0xc3][0xa5] I think, just using the default platform encoding is as bad as using US-ASCII because it does not reflect was is *really* sent over the wire. Actually the wirelog should ideally provide all bytes in hexadecimal representation along with their supposed interpretation as characters in some encoding (such as default platform encoding). A presentation similar to hexdumps would me nice IMHO. However this might imply a small buffering (16 bytes per line) to make a nice layout. Sample output (hex values do not match text): DE AD BE EF DE AD BE EF DE AD BE EF DE AD BE EF GET /index.htm H DE AD BE EF DE AD BE EF DE AD BE EF DE AD BE EF TTP/1.1..Host:ww - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Connection Pooling/Piplining
Vimarsh Vasavada wrote: Hello all. We have following challenge to address : 1. We have 2 JBOSS Servers, say, S1 and S2 2. There will be 1,00,000 distinct-client-threads fired to S1/TalkToS2.jsp/ 3. S1 will have hence virtually 1,00,000-threads attempting to exchange request/response with S2 only. What is your server hardware and operating system that you want to handle 100'000 threads? - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Setting maxTotalConnections and maxHostConnections
Eric Bloch wrote: Which JVM? I usualliy bench against Sun's; ( JRockit benched worse last I tried it (it was a year ago or more)) Sun and IBM are usually a little faster than Blackdown. JRockit has 'ThinThreads' which may be a good thing here. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [VOTE][PROPOSAL] Promote HttpClient to Jakarta Level
+0 Unfortunately too busy at work to be of great help :-( Ortwin Glück Adrian Sutton wrote: - Vote: Promote HttpClient to Jakarta level [ ] +1 I am in favor of the proposal, and will help support it. [X] +0 I am in favor of the proposal, but am unable to help support it. [ ] -0 I am not in favor of the proposal. [ ] -1 I am against this proposal (must include a reason). - - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [VOTE] suspend use of @author tags
+1 Michael Becke wrote: Given the current ambiguity regarding @author tags I propose that we suspend their use for contributors without a CLA on file. This is meant to be a temporary solution until something official is endorsed by the ASF board. Mike -- Vote: Suspend use of @author tags [ ] +1 I am in favor of the proposal [ ] -1 I am against this proposal (must include a reason). -- - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- _ NOSE applied intelligence ag ortwin glück [www] http://www.nose.ch software engineer [email] [EMAIL PROTECTED] hardturmstrasse 171 [pgp id] 0x81CF3416 8005 zürich [office] +41-1-277 57 35 switzerland [fax] +41-1-277 57 12 - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: OutOfMemory if using PUT
Martin, please have a look at this example: http://cvs.apache.org/viewcvs.cgi/jakarta-commons/httpclient/src/examples/ChunkEncodedPost.java?rev=1.4.2.1only_with_tag=HTTPCLIENT_2_0_BRANCHview=auto (link may be wrapped) Kind regards Ortwin Glück martin hilpert wrote: Hello, i using the HttpClient in a Java Applet but if i transfer a file larger then 32MB i get a OutOfMemory. does some others has the same bug? greetz from Germany Martin -- _ NOSE applied intelligence ag ortwin glück [www] http://www.nose.ch software engineer [email] [EMAIL PROTECTED] hardturmstrasse 171 [pgp id] 0x81CF3416 8005 zürich [office] +41-1-277 57 35 switzerland [fax] +41-1-277 57 12 - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: OutOfMemory if using PUT
martin hilpert wrote: that means there is no work around WITH PUT ? The two alternatives ARE the work around! that are both POST requests? The same applies to PUT methods as well as PUT basically works the same as POST. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: OutOfMemory if using PUT
martin hilpert wrote: Hi Ortwin, Not from within HttpClient directly. You can however simply wrap your stream and count the bytes read through the respective methods. how can i wrap it? any sampel code? Errm... Ever heard of the java.io.FilterInputStream class? It is intended to be a base class for such a thing linke you need. If you are using Swing you can just use javax.swing.ProgressMonitorInputStream. O. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: OutOfMemory if using PUT
martin hilpert wrote: i dont understand how i can monitor the stream. HttpClient client = new HttpClient(); PutMethod put = new PutMethod(zielurl); FileInputStream fin =new FileInputStream(C:\test.jpg); MonitorInputStream min = new MonitorInputStream(fin); put.setRequestBody(fin); put.setRequestContentLength(PutMethod.CONTENT_LENGTH_CHUNKED); client.executeMethod(put); System.out.print(put.getResponseBodyAsString()); put.releaseConnection(); class MonitorInputStream extends FilterInputStream { public MonitorInputStream(InputStream in) { super(in); } ... public int read(byte[] b, int off, int len) { int bytesRead = super.read(b, off, len); ... do what you like with bytesRead now ... return bytesRead; } } - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re:[OT] Looking for Http Tool
Robert, this question is off topic here; we are not Google nor ExpertExchange. So don't expect too many answers. But I guess even wget has the feature you are looking for. Ortwin Glück Robert Douglass wrote: I'm looking for a tool that intelligently makes rule-based static copies of dynamic sites. [...] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: unable to find line starting with HTTP error
Dr. K.M. Ku wrote: Roottelnet www.worldscinet.com 80 Trying 203.208.144.142... Connected to www.worldscinet.com. Escape character is '^]'. GET /ijac/14/1401/S02181967041401.html HTTP/1.0 html body bgcolor=#FF div align=center [...] I cannot find the response header. I think this is the origin of the problem. Is there any workround/patch to this issue? It is passive way to tell the webmaster to fix the problem. KMKU, Without response line and headers this is not HTTP. You don't need HttpClient. You can just open a socket, write the request line and get all the data. That's it. Ortwin Glück - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: NTLM authenticity problem
Get HttpClient from here: http://jakarta.apache.org/commons/httpclient/downloads.html Make sure you put the jar file on your classpath. Ortwin Glück Marcelo Muzilli (IG) wrote: Howdy people, I´m a newbie in Servlet programming and I need to develop a code to run in a Ms IIS Webserver (the code needs authenticate in the IIS using the NTLM authentication protocol). I found a code that will authenticate me but I have not success for this. I downloaded the .JAR and DOCs from the Jakarta homepage and if you try to compile the following example code (found in the link http://cvs.apache.org/viewcvs.cgi/jakarta-commons/httpclient/src/examples/Al ternateAuthenticationExample.java), it returns na error because there is no libs, listed above, inside the .JAR: import org.apache.commons.httpclient.UsernamePasswordCredentials; import org.apache.commons.httpclient.auth.AuthPolicy; Please, where could I find it or please if somebody could help me? Thanks in advance, Marcelo Muzilli - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- _ NOSE applied intelligence ag ortwin glück [www] http://www.nose.ch software engineer [email] [EMAIL PROTECTED] hardturmstrasse 171 [pgp id] 0x81CF3416 8005 zürich [office] +41-1-277 57 35 switzerland [fax] +41-1-277 57 12 - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: @author tags
Dan Christopherson wrote: I think that owner is intended in the sense of the primary person responsible for maintaining, not in the sense of the legel owner. Honestly, there is no such thing in this project. The responsible persons are the (few) active committers. Those change (slowly) over time. Also, the term author rather suggests origin than maintainance of the code. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: @author tags
Michael Becke wrote: The ASF has recently recommended that we discontinue use of @author tags. When first starting out I always enjoyed seeing my name in lights, though I do agree with the ASF's opinion on this matter. If we come to a consensus to remove @authors I suggest that we remove them from all existing code, as well as leave them out of new additions. Any comments? Mike I always liked the author tag. But following the news about the SCO vs. the rest of the world case makes me a little concerned these days. I welcome ASF's decision to protect their contributors from legal issues. Removal of author tags are okay with me. There still are CVS logs of course and the contributor list on our web site. Ortwin Glück - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [VOTE] Promote HttpClient to Jakarta level
+0 Ortwin Glück -- Vote: Promote HttpClient to Jakarta level [ ] +1 I am in favor of the move, and will help support it. [x] +0 I am in favor of the move, but am unable to help support it. [ ] -0 I am not in favor of the move. [ ] -1 I am against this proposal (must include a reason). -- - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: @author tags
Kalnichevski, Oleg wrote: I could also imagine some sort of 'thank you' page listing individuals with their respective contributions. The real question is what is to be done with all the contributions made up to now. Yes, let's just put together that 'thank you' page (think of it like the credits of movie). The question is if we just want to list the names or if we actually want to go into some level of detail as to how much or what the person contributed. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]