RE: GetMethod Performance

2004-02-16 Thread Roland Weber
Hello Ben,

without digging into details, I'd say the profile indicates
some problems with the crypto algorithms. They seem
to get interpreted, instead of being compiled by a JIT or
branching into native code.
Since your test only fetches on page in a single request,
it won't make much of a difference whether the connection
is kept alive or not.

I think you should try to profile the "native socket" version,
and try to find out which crypto service provider is used
for the SSL connection there. If it's a different one than used
by the HttpClient, modify the SecureProtocolSocketFactory
to use the faster crypto service provider.

cheers,
  Roland






"Ben Wong" <[EMAIL PROTECTED]>
16.02.2004 23:39
Please respond to "Commons HttpClient Project"
 
To: "'Commons HttpClient Project'" 
<[EMAIL PROTECTED]>
cc: 
Subject:RE: GetMethod Performance


Oleg,
 
Both didn't make a difference. 
 
I have attached the CPU profile that is generated using -Xprof. The
profile for Sun will be attached to this email, another mail will be
sent for the Windows profile.
 
Any help would be appreciated.
 
Thanks,
Ben
 
Sun Solaris 8 on Sparc
--
Flat profile of 17.72 secs (450 total ticks): main
 
  Interpreted + native   Method
  5.6%18  + 6java.math.BigInteger.mulAdd
  3.3%14  + 0sun.security.provider.SHA.computeBlock
  3.0%13  + 0java.math.BigInteger.addOne
  2.8%11  + 1sun.nio.cs.StreamDecoder.read
  1.9% 0  + 8java.lang.Throwable.fillInStackTrace
  1.6% 0  + 7java.net.Inet4AddressImpl.lookupAllHostAddr
  1.4% 6  + 0java.math.BigInteger.montReduce
  1.4% 0  + 6sun.nio.cs.UTF_8$Decoder.decodeArrayLoop
  1.2% 0  + 5
com.telstra.deon.test.HttpClientPerformance.main
  1.2% 3  + 2sun.nio.cs.StreamDecoder.read0
  1.2% 0  + 5
org.apache.commons.httpclient.HttpMethodBase.
  0.9% 0  + 4java.lang.String.charAt
  0.9% 2  + 2sun.text.ComposedCharIter.findNextChar
  0.7% 0  + 3sun.nio.cs.ISO_8859_1$Decoder.decodeArrayLoop
  0.7% 0  + 3java.lang.ClassLoader.defineClass0
  0.7% 1  + 2java.lang.System.arraycopy
  0.7% 0  + 3java.lang.String.length
  0.7% 0  + 3java.lang.StringBuffer.expandCapacity
  0.5% 2  + 0java.util.HashMap.hash
  0.5% 0  + 2java.nio.Buffer.position
  0.5% 0  + 2java.util.zip.Inflater.inflateBytes
  0.5% 0  + 2java.lang.ref.Reference.get
  0.5% 2  + 0org.apache.log4j.spi.LoggingEvent.
  0.5% 0  + 2java.lang.StringBuffer.setLength
  0.5% 1  + 1java.lang.String.getChars
 44.9%96  +96Total interpreted (including elided)
 
 Compiled + native   Method
 10.0%40  + 3java.lang.StringBuffer.append
  7.0%30  + 0sun.nio.cs.StreamDecoder.read0
  6.5% 8  +20org.apache.commons.httpclient.Wire.wire
  6.5%28  + 0java.lang.Integer.toUnsignedString
  6.3%27  + 0java.nio.charset.CoderResult$Cache.get
  3.0%13  + 0sun.nio.cs.StreamDecoder$CharsetSD.implRead
  2.8%12  + 0sun.nio.cs.StreamDecoder.read
  2.3%10  + 0java.lang.Integer.hashCode
  2.1% 9  + 0sun.nio.cs.US_ASCII$Decoder.decodeArrayLoop
  1.4% 6  + 0java.nio.charset.CharsetDecoder.decode
  1.2% 5  + 0sun.nio.cs.US_ASCII$Decoder.decodeLoop
  1.2% 5  + 0java.nio.CharBuffer.put
  0.9% 3  + 1java.lang.StringBuffer.expandCapacity
  0.5% 2  + 0java.math.BigInteger.mulAdd
  0.5% 2  + 0java.nio.Buffer.
  0.2% 1  + 0java.nio.Buffer.position
 52.6%   201  +24Total compiled
 
  Thread-local ticks:
  4.9%22 Blocked (of total)
  2.3%10 Class loader
  0.2% 1 Unknown: no last frame
 
 
Flat profile of 0.02 secs (1 total ticks): DestroyJavaVM
 
  Thread-local ticks:
100.0% 1 Blocked (of total)
 
 
Global summary of 17.82 seconds:
100.0%   463 Received ticks
  1.7% 8 Received GC ticks
 57.9%   268 Compilation
  2.2%10 Class loader
  0.2% 1 Unknown code
 
-Original Message-
From: Kalnichevski, Oleg [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, 17 February 2004 12:27 AM
To: Commons HttpClient Project
Subject: RE: GetMethod Performance
 
Ben,
Try the following:
 
(1) disable stale connections check
 
SimpleHttpConnectionManager connman = new SimpleHttpConnectionManager();

connman.setConnectionStaleCheckingEnabled(false);
HttpClient client = new HttpClient(connman);
 
http://jakarta.apache.org/commons/httpclient/apidocs/org/apache/commons/
httpclient/SimpleHttpConnectionManager.html#setConnectionStaleCheckingEn
abled(boolean)
 
(2) configure HttpClient to use HTTP/1.0 instead of HTTP/1.1
 
GetMethod get = new
GetMe

Re: Forms Login with Iframe

2004-02-16 Thread Roland Weber
Hello Jeannie,

if it's on WebSphere, then it's running on a server and not
in the browser. Yes, you can perform login and fetch a page.
Bringing it into an IFrame is just a question of how to
invoke your JSP or servlet - it won't know the difference
between showing pages in an IFrame, in a regular frame
or in a browser window.
But keep in mind that the page you fetch from a different
server most likely has hyperlinks to that server. So you'll
have to find all links in the page and rewrite them to point
to your own application if you want it to work properly.
HttpClient won't help you with that task.
Performing login "on behalf" of the browser user and
pointing the browser directly to the original page is
tricky, since in most cases a server will not be able to
set a cookie for another server.

cheers,
  Roland






jeanniepb97 <[EMAIL PROTECTED]>
16.02.2004 17:04
Please respond to "Commons HttpClient Project"
 
To: [EMAIL PROTECTED]
cc: 
Subject:Re: Forms Login with Iframe


Hi Roland,
 
Yes, my application would be in a browser.  It will be a JSP/servlet 
application running in WebSphere.
 
Thanks!
Jeannie

Roland Weber <[EMAIL PROTECTED]> wrote:
Hello Jeannie,

where exactly do you want to use the HttpClient?
Are you writing a Java browser, like HotJava?
Do you want to connect from an applet?
A standalone Java application?
A servlet?

Logging in and fetching the page can of course be
done. I just wonder how to show the content in an
iframe, unless your application is (in) a browser.

cheers,
Roland






jeanniepb97 
16.02.2004 16:01
Please respond to "Commons HttpClient Project"

To: [EMAIL PROTECTED]
cc: 
Subject: Forms Login with Iframe


Hi,

I would like to use the HttpClient to do the following:

1. Using HttpClient, log into http://www.blah.com/secure/login.jsp.
2. Display http://www.blah.com/secure/test.jsp in an iframe.

Has anyone tried this? Any help or insights would be greatly appreciated.

Thanks!
Jeannie


-
Do you Yahoo!?
Yahoo! Finance: Get your refund fast by filing online


-
Do you Yahoo!?
Yahoo! Finance: Get your refund fast by filing online


Re: problem in working with IIS

2004-02-16 Thread Cheng Hao
thanks for your prompt response, following is my code --

I debug it and found the headers are all correct. however, the last 
statement readData() just never returnes ... I tried many URLs using the 
same code, all works but this one on IIS :(

please help ...


   HttpMethod method = null;
   method = new GetMethod(myURI);
   method.setFollowRedirects(false);
   method.setRequestHeader("Range", "bytes=" + start + "-" + (start + 
length -1));
   method.setRequestHeader("Pragma", "no-cache");
   method.setRequestHeader("Cache-Control", "no-cache");
   method.setRequestHeader("Connection", "close");
   method.setRequestHeader("Referer", u.getRefUrl());

   method.setRequestHeader("Accept", "*/*");

   int statusCode = -1;

   statusCode = client.executeMethod(method);

   InputStream in = method.getResponseBodyAsStream();
   size = readData(in, length);


From: Michael Becke <[EMAIL PROTECTED]>
Reply-To: "Commons HttpClient Project" 
<[EMAIL PROTECTED]>
To: "Commons HttpClient Project" 
<[EMAIL PROTECTED]>
Subject: Re: problem in working with IIS
Date: Mon, 16 Feb 2004 23:11:16 -0500
It seems to be working just fine for me.  Granted the server is a 
little slow, but it is working.  What exactly are you trying, and 
what is the error you are seeing?

Mike

On Feb 16, 2004, at 10:31 PM, Cheng Hao wrote:

hi, I've used apache http client for a while, everything looks 
cool. until recently, I found a problem in working with IIS 5.0.

I'm trying to get part of a file who is located in a IIS server. i 
can correctly get its header, but when I try to retrieve the 
content, the connection never returns ...

following is the header I got, which seems all right ... could 
someone give it a shot or throw me some light? the URL is 
http://ehomenet.onlinedown.net/down/webcatcher_en.exe.

Thanks so much !!

--- Header ---
Server:Microsoft-IIS/5.0
Connection:close
Date:Tue, 17 Feb 2004 11:27:47 GMT
Content-Type:application/octet-stream
Last-Modified:Tue, 28 Oct 2003 13:26:12 GMT
ETag:"549c38e579dc31:936"
Content-Length:262144
Content-Range:bytes 0-262143/4439461
_
涓???虹杩??浜ゆ?锛??浣跨? MSN Messenger:  
http://messenger.msn.com/cn

-
To unsubscribe, e-mail: 
[EMAIL PROTECTED]
For additional commands, e-mail: 
[EMAIL PROTECTED]



-
To unsubscribe, e-mail: 
[EMAIL PROTECTED]
For additional commands, e-mail: 
[EMAIL PROTECTED]

_
与联机的朋友进行交流,请使用 MSN Messenger:  http://messenger.msn.com/cn  

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


Re: problem in working with IIS

2004-02-16 Thread Michael Becke
It seems to be working just fine for me.  Granted the server is a 
little slow, but it is working.  What exactly are you trying, and what 
is the error you are seeing?

Mike

On Feb 16, 2004, at 10:31 PM, Cheng Hao wrote:

hi, I've used apache http client for a while, everything looks cool. 
until recently, I found a problem in working with IIS 5.0.

I'm trying to get part of a file who is located in a IIS server. i can 
correctly get its header, but when I try to retrieve the content, the 
connection never returns ...

following is the header I got, which seems all right ... could someone 
give it a shot or throw me some light? the URL is 
http://ehomenet.onlinedown.net/down/webcatcher_en.exe.

Thanks so much !!

--- Header ---
Server:Microsoft-IIS/5.0
Connection:close
Date:Tue, 17 Feb 2004 11:27:47 GMT
Content-Type:application/octet-stream
Last-Modified:Tue, 28 Oct 2003 13:26:12 GMT
ETag:"549c38e579dc31:936"
Content-Length:262144
Content-Range:bytes 0-262143/4439461
_
äèæçæåèèäæïèäç MSN Messenger:  http://messenger.msn.com/cn
-
To unsubscribe, e-mail: 
[EMAIL PROTECTED]
For additional commands, e-mail: 
[EMAIL PROTECTED]



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


Re: [ANNOUNCE] Release of Commons HttpClient 2.0 Final

2004-02-16 Thread Adrian Sutton
On 17/2/04 1:14 PM, "Michael Becke" <[EMAIL PROTECTED]> wrote:

> Hi Vincent,
> 
> Thanks for adding the jar to ibiblio.  I added the jar to
> '/www/www.apache.org/dist/java-repository/commons-httpclient/' and
> thought this was supposed to replicate with ibiblio.  Perhaps this is
> not working correctly.
> 
> There's no real reason it's called 2.0 final I guess.  This was just
> the value I chose.  We can certainly rename it to just 2.0.  What does
> everyone think?
> 
> Mike

2.0 is a lot more predictable so I'd change to that instead.  We postfix all
our development versions anyway so it's clear that it's the final version by
the lack of a postfix.

BTW, great work to all involved in the release!  It's nice to finally have
it out the door.

Regards,

Adrian Sutton.

--
Intencha "tomorrow's technology today"
Ph: 38478913 0422236329
Suite 8/29 Oatland Crescent
Holland Park West 4121
Australia QLD
www.intencha.com


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



problem in working with IIS

2004-02-16 Thread Cheng Hao
hi, I've used apache http client for a while, everything looks cool. until 
recently, I found a problem in working with IIS 5.0.

I'm trying to get part of a file who is located in a IIS server. i can 
correctly get its header, but when I try to retrieve the content, the 
connection never returns ...

following is the header I got, which seems all right ... could someone give 
it a shot or throw me some light? the URL is 
http://ehomenet.onlinedown.net/down/webcatcher_en.exe.

Thanks so much !!

--- Header ---
Server:Microsoft-IIS/5.0
Connection:close
Date:Tue, 17 Feb 2004 11:27:47 GMT
Content-Type:application/octet-stream
Last-Modified:Tue, 28 Oct 2003 13:26:12 GMT
ETag:"549c38e579dc31:936"
Content-Length:262144
Content-Range:bytes 0-262143/4439461
_
与联机的朋友进行交流,请使用 MSN Messenger:  http://messenger.msn.com/cn  

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


Re: [ANNOUNCE] Release of Commons HttpClient 2.0 Final

2004-02-16 Thread Michael Becke
Hi Vincent,

Thanks for adding the jar to ibiblio.  I added the jar to  
'/www/www.apache.org/dist/java-repository/commons-httpclient/' and  
thought this was supposed to replicate with ibiblio.  Perhaps this is  
not working correctly.

There's no real reason it's called 2.0 final I guess.  This was just  
the value I chose.  We can certainly rename it to just 2.0.  What does  
everyone think?

Mike

On Feb 16, 2004, at 3:12 PM, Vincent Massol wrote:

FYI, I have uploaded the 2.0-final version to Ibiblio:

http://www.ibiblio.org/maven/commons-httpclient/jars/commons- 
httpclient-
2.0-final.jar

BTW, I'm curious to know why it is called 2.0-final and not simply 2.0.
I have not seen this versioning in use in other places. This is also  
not
the versioning that you have used for previous versions of HttpClient.

I have kept your name when I uploaded the jar to ibiblio. Let me know  
if
it needs to be changed to *-2.0.jar

Thanks
-Vincent
-Original Message-
From: Michael Becke [mailto:[EMAIL PROTECTED]
Sent: 16 February 2004 05:54
To: Jakarta Commons Developers List; Jakarta Commons Users List;
Commons
HttpClient Project; [EMAIL PROTECTED]
Subject: [ANNOUNCE] Release of Commons HttpClient 2.0 Final
The Jakarta Commons HttpClient development team is pleased to announce
the release of HttpClient 2.0 final.  This release represents a great
deal of work by quite a number of people. We would like to thank all
of
those who contributed to this release.

This version contains only a few minor bug fixes. Please visit the
HttpClient website  and
download this latest release.
The following changes have been made since Release Candidate 3:

  * 26500 - Socket timeout is now correctly set on open connections

  * 26328 - Fixed getScheme() and getPort() returning wrong defaults
for
HttpsURL

  * 26139 - Fixed possible connection leak caused by lack of equals()
and hashCode() on protocol
socket factories
  * 26688 - Fixed the problem with HttpURL creating wrong authority
String when user info is changed
Thank you,

Commons HttpClient Development Team

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


-
To unsubscribe, e-mail:  
[EMAIL PROTECTED]
For additional commands, e-mail:  
[EMAIL PROTECTED]



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


RE: GetMethod Performance

2004-02-16 Thread Ben Wong
Windows Profile attached. Any help would be appreciated

Windows XP on P-M 1.4
-
Flat profile of 3.44 secs (322 total ticks): main

  Interpreted + native   Method
  7.5% 0  +24java.net.SocketInputStream.socketRead0
  7.2% 0  +23java.net.PlainSocketImpl.socketConnect
  1.3% 0  + 4java.net.Inet4AddressImpl.lookupAllHostAddr
  0.6% 0  + 2java.io.WinNTFileSystem.getBooleanAttributes
  0.6% 0  + 2java.lang.System.arraycopy
  0.6% 1  + 1java.net.URL.
  0.3% 0  + 1java.lang.reflect.Field.copy
  0.3% 0  + 1java.util.HashMap.hash
  0.3% 0  + 1
org.apache.commons.logging.impl.LogFactoryImpl.newInstance
  0.3% 0  + 1sun.misc.URLClassPath$5.
  0.3% 1  + 0org.apache.log4j.Priority.isGreaterOrEqual
  0.3% 0  + 1java.lang.String.
  0.3% 1  + 0java.nio.charset.CharsetDecoder.
  0.3% 0  + 1sun.nio.cs.UTF_8.newDecoder
  0.3% 0  + 1java.lang.String.substring
  0.3% 1  + 0java.nio.charset.CharsetDecoder.
  0.3% 1  + 0java.util.HashMap.transfer
  0.3% 0  + 1sun.text.ComposedCharIter.decomposition
  0.3% 0  + 1sun.security.x509.AlgorithmId.derEncode
  0.3% 0  + 1java.security.SecureClassLoader.getPermissions
  0.3% 0  + 1java.lang.ClassLoader.defineClass0
  0.3% 1  + 0java.lang.String.
  0.3% 0  + 1java.net.PlainSocketImpl.socketBind
  0.3% 0  + 1java.lang.StringCoding$CharsetSE.encode
  0.3% 1  + 0java.lang.String.regionMatches
 28.8%10  +82Total interpreted (including elided)

 Compiled + native   Method
 15.6% 9  +41java.lang.String.getChars
  7.5%24  + 0sun.nio.cs.US_ASCII$Decoder.decodeArrayLoop
  6.6%12  + 9java.lang.String.
  3.8%12  + 0java.nio.charset.CharsetDecoder.decode
  3.4%11  + 0java.lang.Integer.toUnsignedString
  2.8% 9  + 0sun.nio.cs.StreamDecoder.read0
  2.8% 9  + 0java.nio.Buffer.position
  2.8% 7  + 2java.lang.StringBuffer.append
  2.8% 9  + 0java.util.HashMap.get
  2.5% 8  + 0java.nio.CharBuffer.wrap
  1.9% 6  + 0java.nio.Buffer.
  1.6% 0  + 5java.lang.StringBuffer.insert
  1.6% 5  + 0sun.nio.cs.StreamDecoder$CharsetSD.implRead
  1.3% 4  + 0org.apache.commons.httpclient.Wire.wire
  1.3% 1  + 3java.lang.StringBuffer.expandCapacity
  0.9% 3  + 0sun.nio.cs.US_ASCII$Decoder.decodeLoop
  0.9% 3  + 0java.nio.charset.CoderResult$Cache.get
  0.9% 3  + 0java.nio.CharBuffer.put
  0.9% 3  + 0java.nio.Buffer.limit
  0.9% 3  + 0java.lang.StringBuffer.append
  0.6% 2  + 0java.util.HashMap.hash
  0.6% 2  + 0java.io.InputStreamReader.read
  0.6% 2  + 0java.lang.Integer.equals
  0.3% 0  + 1org.apache.log4j.Category.log
  0.3% 1  + 0java.nio.CharBuffer.arrayOffset
 66.6%   152  +61Total compiled (including elided)

  Thread-local ticks:
  0.6% 2 Blocked (of total)
  0.6% 2 Class loader
  1.3% 4 Interpreter
  2.8% 9 Compilation


Flat profile of 0.01 secs (1 total ticks): DestroyJavaVM

  Thread-local ticks:
100.0% 1 Blocked (of total)


Global summary of 3.45 seconds:
100.0%   345 Received ticks
  5.8%20 Received GC ticks
  4.1%14 Compilation
  0.3% 1 Other VM operations
  0.6% 2 Class loader
  1.2% 4 Interpreter






-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



RE: GetMethod Performance

2004-02-16 Thread Ben Wong
Oleg,
 
Both didn't make a difference. 
 
I have attached the CPU profile that is generated using -Xprof. The
profile for Sun will be attached to this email, another mail will be
sent for the Windows profile.
 
Any help would be appreciated.
 
Thanks,
Ben
 
Sun Solaris 8 on Sparc
--
Flat profile of 17.72 secs (450 total ticks): main
 
  Interpreted + native   Method
  5.6%18  + 6java.math.BigInteger.mulAdd
  3.3%14  + 0sun.security.provider.SHA.computeBlock
  3.0%13  + 0java.math.BigInteger.addOne
  2.8%11  + 1sun.nio.cs.StreamDecoder.read
  1.9% 0  + 8java.lang.Throwable.fillInStackTrace
  1.6% 0  + 7java.net.Inet4AddressImpl.lookupAllHostAddr
  1.4% 6  + 0java.math.BigInteger.montReduce
  1.4% 0  + 6sun.nio.cs.UTF_8$Decoder.decodeArrayLoop
  1.2% 0  + 5
com.telstra.deon.test.HttpClientPerformance.main
  1.2% 3  + 2sun.nio.cs.StreamDecoder.read0
  1.2% 0  + 5
org.apache.commons.httpclient.HttpMethodBase.
  0.9% 0  + 4java.lang.String.charAt
  0.9% 2  + 2sun.text.ComposedCharIter.findNextChar
  0.7% 0  + 3sun.nio.cs.ISO_8859_1$Decoder.decodeArrayLoop
  0.7% 0  + 3java.lang.ClassLoader.defineClass0
  0.7% 1  + 2java.lang.System.arraycopy
  0.7% 0  + 3java.lang.String.length
  0.7% 0  + 3java.lang.StringBuffer.expandCapacity
  0.5% 2  + 0java.util.HashMap.hash
  0.5% 0  + 2java.nio.Buffer.position
  0.5% 0  + 2java.util.zip.Inflater.inflateBytes
  0.5% 0  + 2java.lang.ref.Reference.get
  0.5% 2  + 0org.apache.log4j.spi.LoggingEvent.
  0.5% 0  + 2java.lang.StringBuffer.setLength
  0.5% 1  + 1java.lang.String.getChars
 44.9%96  +96Total interpreted (including elided)
 
 Compiled + native   Method
 10.0%40  + 3java.lang.StringBuffer.append
  7.0%30  + 0sun.nio.cs.StreamDecoder.read0
  6.5% 8  +20org.apache.commons.httpclient.Wire.wire
  6.5%28  + 0java.lang.Integer.toUnsignedString
  6.3%27  + 0java.nio.charset.CoderResult$Cache.get
  3.0%13  + 0sun.nio.cs.StreamDecoder$CharsetSD.implRead
  2.8%12  + 0sun.nio.cs.StreamDecoder.read
  2.3%10  + 0java.lang.Integer.hashCode
  2.1% 9  + 0sun.nio.cs.US_ASCII$Decoder.decodeArrayLoop
  1.4% 6  + 0java.nio.charset.CharsetDecoder.decode
  1.2% 5  + 0sun.nio.cs.US_ASCII$Decoder.decodeLoop
  1.2% 5  + 0java.nio.CharBuffer.put
  0.9% 3  + 1java.lang.StringBuffer.expandCapacity
  0.5% 2  + 0java.math.BigInteger.mulAdd
  0.5% 2  + 0java.nio.Buffer.
  0.2% 1  + 0java.nio.Buffer.position
 52.6%   201  +24Total compiled
 
  Thread-local ticks:
  4.9%22 Blocked (of total)
  2.3%10 Class loader
  0.2% 1 Unknown: no last frame
 
 
Flat profile of 0.02 secs (1 total ticks): DestroyJavaVM
 
  Thread-local ticks:
100.0% 1 Blocked (of total)
 
 
Global summary of 17.82 seconds:
100.0%   463 Received ticks
  1.7% 8 Received GC ticks
 57.9%   268 Compilation
  2.2%10 Class loader
  0.2% 1 Unknown code
 
-Original Message-
From: Kalnichevski, Oleg [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, 17 February 2004 12:27 AM
To: Commons HttpClient Project
Subject: RE: GetMethod Performance
 
Ben,
Try the following:
 
(1) disable stale connections check
 
SimpleHttpConnectionManager connman = new SimpleHttpConnectionManager();

connman.setConnectionStaleCheckingEnabled(false);
HttpClient client = new HttpClient(connman);
 
http://jakarta.apache.org/commons/httpclient/apidocs/org/apache/commons/
httpclient/SimpleHttpConnectionManager.html#setConnectionStaleCheckingEn
abled(boolean)
 
(2) configure HttpClient to use HTTP/1.0 instead of HTTP/1.1
 
GetMethod get = new
GetMethod("http://192.168.0.1/commons-httpclient-2.0-final.zip";);
get.setHttp11(false);
 
http://jakarta.apache.org/commons/httpclient/apidocs/org/apache/commons/
httpclient/HttpMethodBase.html#setHttp11(boolean)
 
See if any these options makes any difference
 
Oleg
 
-Original Message-
From: Ben Wong [mailto:[EMAIL PROTECTED]
Sent: Monday, February 16, 2004 06:41
To: [EMAIL PROTECTED]
Subject: GetMethod Performance
 
 
Hi,
 
I have noticed significant performance difference between using
HttpClient and Socket.
 
I tried to use GetMethod to download a 2MB file from a Webserver sitting
in the LAN. When I do it with HttpClient, it takes around 13-15 seconds
while it will only take less than half a second with Socket.
 
I was running the code below on a Sun Blade 100 with Solaris 8
installed. J2SDK1.4.2_03 and HttpClient 2.0 final were used.
 
Any help would be appreciated.

RE: [ANNOUNCE] Release of Commons HttpClient 2.0 Final

2004-02-16 Thread Vincent Massol
FYI, I have uploaded the 2.0-final version to Ibiblio:

http://www.ibiblio.org/maven/commons-httpclient/jars/commons-httpclient-
2.0-final.jar

BTW, I'm curious to know why it is called 2.0-final and not simply 2.0.
I have not seen this versioning in use in other places. This is also not
the versioning that you have used for previous versions of HttpClient.

I have kept your name when I uploaded the jar to ibiblio. Let me know if
it needs to be changed to *-2.0.jar

Thanks
-Vincent
 
> -Original Message-
> From: Michael Becke [mailto:[EMAIL PROTECTED]
> Sent: 16 February 2004 05:54
> To: Jakarta Commons Developers List; Jakarta Commons Users List;
Commons
> HttpClient Project; [EMAIL PROTECTED]
> Subject: [ANNOUNCE] Release of Commons HttpClient 2.0 Final
> 
> The Jakarta Commons HttpClient development team is pleased to announce
> the release of HttpClient 2.0 final.  This release represents a great
> deal of work by quite a number of people. We would like to thank all
of
> those who contributed to this release.
> 
> This version contains only a few minor bug fixes. Please visit the
> HttpClient website  and
> download this latest release.
> 
> The following changes have been made since Release Candidate 3:
> 
>   * 26500 - Socket timeout is now correctly set on open connections
> 
>   * 26328 - Fixed getScheme() and getPort() returning wrong defaults
for
> HttpsURL
> 
>   * 26139 - Fixed possible connection leak caused by lack of equals()
> and hashCode() on protocol
> socket factories
> 
>   * 26688 - Fixed the problem with HttpURL creating wrong authority
> String when user info is changed
> 
> 
> Thank you,
> 
> Commons HttpClient Development Team
> 
> 
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



RE: Cookie Problem

2004-02-16 Thread hareesh babu
Kalnichevski, Oleg

 I modified the HttpClient 2.0-RC3 code of
HeaderElement code to stop prasing by token by ",". 
then i am able to get the cookie as of requirement. 

Thanks
Hareesh.

 --- "Kalnichevski, Oleg"
<[EMAIL PROTECTED]> wrote: > By
definition entity enclosing methods MAY NOT
> automatically handle redirects. Make sure you do not
> attempt to set setFollowRedirects to true on POST or
> PUT methods.
> 
> Oleg
> 
> -Original Message-
> From: hareesh babu [mailto:[EMAIL PROTECTED]
> Sent: Monday, February 16, 2004 17:19
> To: Commons HttpClient Project
> Subject: RE: Cookie Problem
> 
> 
> Kalnichevski, Oleg,
> 
> For this reason, i download the lastest build from
> cvs
> of 20040215.zip.
> Then i am getting this expection. But this code some
> sort with httpclinet 2.0 rc3 version.
> 
> java.lang.IllegalArgumentException: Entity enclosing
> requests cannot be redirected without user
> intervention
>  [java]   at
>
org.apache.commons.httpclient.methods.EntityEnclosingMethod.setFollowRedirects(EntityEnclosingMethod.java:239)
>  [java]   at Test1.main(Test1.java:127)
>  [java] Exception in thread "main" 
> 
> Hareesh.
> 
>  --- "Kalnichevski, Oleg"
> <[EMAIL PROTECTED]> wrote: > Hi
> Hareesh,
> > 
> > None of the cookie specs in the stable (HttpClient
> > 2.0) branch can handle malformed cookies with
> > unescaped commas. The development branch
> (HttpClient
> > 3.0-pre-alpha) contains an improved Netscape
> cookie
> > spec capable of handling commas in cookie values.
> > For more details on the problem refer to the bug
> > report below:
> > 
> >
>
http://nagoya.apache.org/bugzilla/show_bug.cgi?id=11240
> > 
> > Oleg
> > 
> > -Original Message-
> > From: hareesh babu [mailto:[EMAIL PROTECTED]
> > Sent: Monday, February 16, 2004 13:37
> > To: Commons HttpClient Project
> > Cc: [EMAIL PROTECTED]
> > Subject: Re: Cookie Problem
> > 
> > 
> > Hi  Roland Weber,
> > 
> >   Thanks for you immediate reponse. Even if set
> the
> > cookie policy by different i am getting the
> problem.
> > 
> > Let me explain the problem i am facing, I am
> sending
> > a
> > get request the home page of the xxx website, it
> is
> > comming fine, after that i am sending a post with
> > user
> > and password, and that is also comming after that
> if
> > send a another get request in the internal site
> > which
> > requies authorized user, website is checking the
> > cookie, but the cookie problem, the website is
> > redirecting the request into home page one agian. 
> > I try do by removing the SEPARATORS.set(',');  in
> > the
> > HeaderElement, no use. 
> >   
> > Here i placing my sample request program
> > 
> > *
> > 
> > import java.io.IOException;
> > import java.net.MalformedURLException;
> > import org.apache.commons.httpclient.Credentials;
> > import
> >
>
org.apache.commons.httpclient.UsernamePasswordCredentials;
> > import org.apache.commons.httpclient.Header;
> > import org.apache.commons.httpclient.HttpClient;
> > import
> org.apache.commons.httpclient.HttpException;
> > import org.apache.commons.httpclient.HttpMethod;
> > import org.apache.commons.httpclient.Cookie;
> > import
> > org.apache.commons.httpclient.cookie.CookiePolicy;
> > import
> > org.apache.commons.httpclient.methods.GetMethod;
> > import
> > org.apache.commons.httpclient.methods.PostMethod;
> > import
> org.apache.commons.httpclient.NameValuePair;
> > import org.apache.commons.httpclient.Header;
> > 
> > 
> > public class Test1
> > {
> > 
> >  public static void main(String[] args) throws
> > Exception
> > {
> >
> >
> 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.httpclient.wire",
> > "debug");
> >
> >
>
System.setProperty("org.apache.commons.logging.simplelog.log.org.apache.commons.httpclient",
> > "debug");
> >   
> > 
> > //create a singular HttpClient object
> > String HOST =".xxx.com";
> > int PORT = 80;
> > 
> > HttpClient client = new HttpClient();
> >
> client.getHostConfiguration().setHost(HOST,
> > PORT, "http");
> > client.getState().setCookiePolicy(
> > CookiePolicy.COMPATIBILITY );
> > 
> > 
> > String url = "/online/on_login1.jsp";
> > GetMethod getMethod = null;
> > Header header1 = new Header ("Accept",
> > "image/gif, image/x-xbitmap, image/jpeg,
> > image/pjpeg,
> > application/msword, */*");
> > Header header2 = new Header ("Referer",
> > "http://"; + HOST);
> > Header header3 = new Header
> > ("Accept-Language", "en-us");
> > Header header4 = new Header 
> > ("Content-Type",
> > "application/x-www-form-urlencoded");
> > Header header5 = new Header
> > ("Accept-Encoding", "gzip, deflate");
> > Header

RE: Cookie Problem

2004-02-16 Thread Kalnichevski, Oleg
By definition entity enclosing methods MAY NOT automatically handle redirects. Make 
sure you do not attempt to set setFollowRedirects to true on POST or PUT methods.

Oleg

-Original Message-
From: hareesh babu [mailto:[EMAIL PROTECTED]
Sent: Monday, February 16, 2004 17:19
To: Commons HttpClient Project
Subject: RE: Cookie Problem


Kalnichevski, Oleg,

For this reason, i download the lastest build from cvs
of 20040215.zip.
Then i am getting this expection. But this code some
sort with httpclinet 2.0 rc3 version.

java.lang.IllegalArgumentException: Entity enclosing
requests cannot be redirected without user
intervention
 [java] at
org.apache.commons.httpclient.methods.EntityEnclosingMethod.setFollowRedirects(EntityEnclosingMethod.java:239)
 [java] at Test1.main(Test1.java:127)
 [java] Exception in thread "main" 

Hareesh.

 --- "Kalnichevski, Oleg"
<[EMAIL PROTECTED]> wrote: > Hi
Hareesh,
> 
> None of the cookie specs in the stable (HttpClient
> 2.0) branch can handle malformed cookies with
> unescaped commas. The development branch (HttpClient
> 3.0-pre-alpha) contains an improved Netscape cookie
> spec capable of handling commas in cookie values.
> For more details on the problem refer to the bug
> report below:
> 
>
http://nagoya.apache.org/bugzilla/show_bug.cgi?id=11240
> 
> Oleg
> 
> -Original Message-
> From: hareesh babu [mailto:[EMAIL PROTECTED]
> Sent: Monday, February 16, 2004 13:37
> To: Commons HttpClient Project
> Cc: [EMAIL PROTECTED]
> Subject: Re: Cookie Problem
> 
> 
> Hi  Roland Weber,
> 
>   Thanks for you immediate reponse. Even if set the
> cookie policy by different i am getting the problem.
> 
> Let me explain the problem i am facing, I am sending
> a
> get request the home page of the xxx website, it is
> comming fine, after that i am sending a post with
> user
> and password, and that is also comming after that if
> send a another get request in the internal site
> which
> requies authorized user, website is checking the
> cookie, but the cookie problem, the website is
> redirecting the request into home page one agian. 
> I try do by removing the SEPARATORS.set(',');  in
> the
> HeaderElement, no use. 
>   
> Here i placing my sample request program
> 
> *
> 
> import java.io.IOException;
> import java.net.MalformedURLException;
> import org.apache.commons.httpclient.Credentials;
> import
>
org.apache.commons.httpclient.UsernamePasswordCredentials;
> import org.apache.commons.httpclient.Header;
> import org.apache.commons.httpclient.HttpClient;
> import org.apache.commons.httpclient.HttpException;
> import org.apache.commons.httpclient.HttpMethod;
> import org.apache.commons.httpclient.Cookie;
> import
> org.apache.commons.httpclient.cookie.CookiePolicy;
> import
> org.apache.commons.httpclient.methods.GetMethod;
> import
> org.apache.commons.httpclient.methods.PostMethod;
> import org.apache.commons.httpclient.NameValuePair;
> import org.apache.commons.httpclient.Header;
> 
> 
> public class Test1
> {
> 
>  public static void main(String[] args) throws
> Exception
> {
>
> 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.httpclient.wire",
> "debug");
>
>
System.setProperty("org.apache.commons.logging.simplelog.log.org.apache.commons.httpclient",
> "debug");
>   
> 
> //create a singular HttpClient object
> String HOST =".xxx.com";
> int PORT = 80;
> 
> HttpClient client = new HttpClient();
> client.getHostConfiguration().setHost(HOST,
> PORT, "http");
> client.getState().setCookiePolicy(
> CookiePolicy.COMPATIBILITY );
> 
> 
> String url = "/online/on_login1.jsp";
> GetMethod getMethod = null;
> Header header1 = new Header ("Accept",
> "image/gif, image/x-xbitmap, image/jpeg,
> image/pjpeg,
> application/msword, */*");
> Header header2 = new Header ("Referer",
> "http://"; + HOST);
> Header header3 = new Header
> ("Accept-Language", "en-us");
> Header header4 = new Header 
> ("Content-Type",
> "application/x-www-form-urlencoded");
> Header header5 = new Header
> ("Accept-Encoding", "gzip, deflate");
> Header header6 = new Header
> ("Proxy-Connection", "Keep-Alive");
> Header header7 = new Header ("Pragma",
> "no-cache");
> Header header8 = new Header ("Cookie",
> "name=Online");
> 
> getMethod = new GetMethod(url);
> getMethod.setFollowRedirects(true);
> getMethod.setStrictMode(false);
> getMethod.setRequestHeader(header1);
> getMethod.setRequestHeader(header2);
> getMethod.setRequestHeader(header3);
> getMethod.setRequestHeader(header4);
> getMethod.setRequestHeader(header5);
> 

RE: Cookie Problem

2004-02-16 Thread hareesh babu
Kalnichevski, Oleg,

For this reason, i download the lastest build from cvs
of 20040215.zip.
Then i am getting this expection. But this code some
sort with httpclinet 2.0 rc3 version.

java.lang.IllegalArgumentException: Entity enclosing
requests cannot be redirected without user
intervention
 [java] at
org.apache.commons.httpclient.methods.EntityEnclosingMethod.setFollowRedirects(EntityEnclosingMethod.java:239)
 [java] at Test1.main(Test1.java:127)
 [java] Exception in thread "main" 

Hareesh.

 --- "Kalnichevski, Oleg"
<[EMAIL PROTECTED]> wrote: > Hi
Hareesh,
> 
> None of the cookie specs in the stable (HttpClient
> 2.0) branch can handle malformed cookies with
> unescaped commas. The development branch (HttpClient
> 3.0-pre-alpha) contains an improved Netscape cookie
> spec capable of handling commas in cookie values.
> For more details on the problem refer to the bug
> report below:
> 
>
http://nagoya.apache.org/bugzilla/show_bug.cgi?id=11240
> 
> Oleg
> 
> -Original Message-
> From: hareesh babu [mailto:[EMAIL PROTECTED]
> Sent: Monday, February 16, 2004 13:37
> To: Commons HttpClient Project
> Cc: [EMAIL PROTECTED]
> Subject: Re: Cookie Problem
> 
> 
> Hi  Roland Weber,
> 
>   Thanks for you immediate reponse. Even if set the
> cookie policy by different i am getting the problem.
> 
> Let me explain the problem i am facing, I am sending
> a
> get request the home page of the xxx website, it is
> comming fine, after that i am sending a post with
> user
> and password, and that is also comming after that if
> send a another get request in the internal site
> which
> requies authorized user, website is checking the
> cookie, but the cookie problem, the website is
> redirecting the request into home page one agian. 
> I try do by removing the SEPARATORS.set(',');  in
> the
> HeaderElement, no use. 
>   
> Here i placing my sample request program
> 
> *
> 
> import java.io.IOException;
> import java.net.MalformedURLException;
> import org.apache.commons.httpclient.Credentials;
> import
>
org.apache.commons.httpclient.UsernamePasswordCredentials;
> import org.apache.commons.httpclient.Header;
> import org.apache.commons.httpclient.HttpClient;
> import org.apache.commons.httpclient.HttpException;
> import org.apache.commons.httpclient.HttpMethod;
> import org.apache.commons.httpclient.Cookie;
> import
> org.apache.commons.httpclient.cookie.CookiePolicy;
> import
> org.apache.commons.httpclient.methods.GetMethod;
> import
> org.apache.commons.httpclient.methods.PostMethod;
> import org.apache.commons.httpclient.NameValuePair;
> import org.apache.commons.httpclient.Header;
> 
> 
> public class Test1
> {
> 
>  public static void main(String[] args) throws
> Exception
> {
>
> 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.httpclient.wire",
> "debug");
>
>
System.setProperty("org.apache.commons.logging.simplelog.log.org.apache.commons.httpclient",
> "debug");
>   
> 
> //create a singular HttpClient object
> String HOST =".xxx.com";
> int PORT = 80;
> 
> HttpClient client = new HttpClient();
> client.getHostConfiguration().setHost(HOST,
> PORT, "http");
> client.getState().setCookiePolicy(
> CookiePolicy.COMPATIBILITY );
> 
> 
> String url = "/online/on_login1.jsp";
> GetMethod getMethod = null;
> Header header1 = new Header ("Accept",
> "image/gif, image/x-xbitmap, image/jpeg,
> image/pjpeg,
> application/msword, */*");
> Header header2 = new Header ("Referer",
> "http://"; + HOST);
> Header header3 = new Header
> ("Accept-Language", "en-us");
> Header header4 = new Header 
> ("Content-Type",
> "application/x-www-form-urlencoded");
> Header header5 = new Header
> ("Accept-Encoding", "gzip, deflate");
> Header header6 = new Header
> ("Proxy-Connection", "Keep-Alive");
> Header header7 = new Header ("Pragma",
> "no-cache");
> Header header8 = new Header ("Cookie",
> "name=Online");
> 
> getMethod = new GetMethod(url);
> getMethod.setFollowRedirects(true);
> getMethod.setStrictMode(false);
> getMethod.setRequestHeader(header1);
> getMethod.setRequestHeader(header2);
> getMethod.setRequestHeader(header3);
> getMethod.setRequestHeader(header4);
> getMethod.setRequestHeader(header5);
> getMethod.setRequestHeader(header6);
> getMethod.setRequestHeader(header7);
> getMethod.setRequestHeader(header8);
> 
> //execute the method
> String responseBody = null;
> try{
> client.executeMethod(getMethod);
> responseBody =
> getMethod.getResponseBodyAsString();
>   

Re: Forms Login with Iframe

2004-02-16 Thread jeanniepb97
Hi Roland,
 
Yes, my application would be in a browser.  It will be a JSP/servlet application 
running in WebSphere.
 
Thanks!
Jeannie

Roland Weber <[EMAIL PROTECTED]> wrote:
Hello Jeannie,

where exactly do you want to use the HttpClient?
Are you writing a Java browser, like HotJava?
Do you want to connect from an applet?
A standalone Java application?
A servlet?

Logging in and fetching the page can of course be
done. I just wonder how to show the content in an
iframe, unless your application is (in) a browser.

cheers,
Roland






jeanniepb97 
16.02.2004 16:01
Please respond to "Commons HttpClient Project"

To: [EMAIL PROTECTED]
cc: 
Subject: Forms Login with Iframe


Hi,

I would like to use the HttpClient to do the following:

1. Using HttpClient, log into http://www.blah.com/secure/login.jsp.
2. Display http://www.blah.com/secure/test.jsp in an iframe.

Has anyone tried this? Any help or insights would be greatly appreciated.

Thanks!
Jeannie


-
Do you Yahoo!?
Yahoo! Finance: Get your refund fast by filing online


-
Do you Yahoo!?
Yahoo! Finance: Get your refund fast by filing online

Re: Forms Login with Iframe

2004-02-16 Thread Roland Weber
Hello Jeannie,

where exactly do you want to use the HttpClient?
Are you writing a Java browser, like HotJava?
Do you want to connect from an applet?
A standalone Java application?
A servlet?

Logging in and fetching the page can of course be
done. I just wonder how to show the content in an
iframe, unless your application is (in) a browser.

cheers,
  Roland






jeanniepb97 <[EMAIL PROTECTED]>
16.02.2004 16:01
Please respond to "Commons HttpClient Project"
 
To: [EMAIL PROTECTED]
cc: 
Subject:Forms Login with Iframe


Hi,
 
I would like to use the HttpClient to do the following:
 
1.  Using HttpClient, log into http://www.blah.com/secure/login.jsp.
2.  Display http://www.blah.com/secure/test.jsp in an iframe.
 
Has anyone tried this?  Any help or insights would be greatly appreciated.
 
Thanks!
Jeannie


-
Do you Yahoo!?
Yahoo! Finance: Get your refund fast by filing online


Forms Login with Iframe

2004-02-16 Thread jeanniepb97
Hi,
 
I would like to use the HttpClient to do the following:
 
1.  Using HttpClient, log into http://www.blah.com/secure/login.jsp.
2.  Display http://www.blah.com/secure/test.jsp in an iframe.
 
Has anyone tried this?  Any help or insights would be greatly appreciated.
 
Thanks!
Jeannie


-
Do you Yahoo!?
Yahoo! Finance: Get your refund fast by filing online

RE: Cookie Problem

2004-02-16 Thread Kalnichevski, Oleg
Hi Hareesh,

None of the cookie specs in the stable (HttpClient 2.0) branch can handle malformed 
cookies with unescaped commas. The development branch (HttpClient 3.0-pre-alpha) 
contains an improved Netscape cookie spec capable of handling commas in cookie values. 
For more details on the problem refer to the bug report below:

http://nagoya.apache.org/bugzilla/show_bug.cgi?id=11240

Oleg

-Original Message-
From: hareesh babu [mailto:[EMAIL PROTECTED]
Sent: Monday, February 16, 2004 13:37
To: Commons HttpClient Project
Cc: [EMAIL PROTECTED]
Subject: Re: Cookie Problem


Hi  Roland Weber,

  Thanks for you immediate reponse. Even if set the
cookie policy by different i am getting the problem. 
Let me explain the problem i am facing, I am sending a
get request the home page of the xxx website, it is
comming fine, after that i am sending a post with user
and password, and that is also comming after that if
send a another get request in the internal site which
requies authorized user, website is checking the
cookie, but the cookie problem, the website is
redirecting the request into home page one agian. 
I try do by removing the SEPARATORS.set(',');  in the
HeaderElement, no use. 
  
Here i placing my sample request program

*

import java.io.IOException;
import java.net.MalformedURLException;
import org.apache.commons.httpclient.Credentials;
import
org.apache.commons.httpclient.UsernamePasswordCredentials;
import org.apache.commons.httpclient.Header;
import org.apache.commons.httpclient.HttpClient;
import org.apache.commons.httpclient.HttpException;
import org.apache.commons.httpclient.HttpMethod;
import org.apache.commons.httpclient.Cookie;
import
org.apache.commons.httpclient.cookie.CookiePolicy;
import
org.apache.commons.httpclient.methods.GetMethod;
import
org.apache.commons.httpclient.methods.PostMethod;
import org.apache.commons.httpclient.NameValuePair;
import org.apache.commons.httpclient.Header;


public class Test1
{

 public static void main(String[] args) throws
Exception
{
   
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.httpclient.wire",
"debug");
   
System.setProperty("org.apache.commons.logging.simplelog.log.org.apache.commons.httpclient",
"debug");
  

//create a singular HttpClient object
String HOST =".xxx.com";
int PORT = 80;

HttpClient client = new HttpClient();
client.getHostConfiguration().setHost(HOST,
PORT, "http");
client.getState().setCookiePolicy(
CookiePolicy.COMPATIBILITY );


String url = "/online/on_login1.jsp";
GetMethod getMethod = null;
Header header1 = new Header ("Accept",
"image/gif, image/x-xbitmap, image/jpeg, image/pjpeg,
application/msword, */*");
Header header2 = new Header ("Referer",
"http://"; + HOST);
Header header3 = new Header
("Accept-Language", "en-us");
Header header4 = new Header  ("Content-Type",
"application/x-www-form-urlencoded");
Header header5 = new Header
("Accept-Encoding", "gzip, deflate");
Header header6 = new Header
("Proxy-Connection", "Keep-Alive");
Header header7 = new Header ("Pragma",
"no-cache");
Header header8 = new Header ("Cookie",
"name=Online");

getMethod = new GetMethod(url);
getMethod.setFollowRedirects(true);
getMethod.setStrictMode(false);
getMethod.setRequestHeader(header1);
getMethod.setRequestHeader(header2);
getMethod.setRequestHeader(header3);
getMethod.setRequestHeader(header4);
getMethod.setRequestHeader(header5);
getMethod.setRequestHeader(header6);
getMethod.setRequestHeader(header7);
getMethod.setRequestHeader(header8);

//execute the method
String responseBody = null;
try{
client.executeMethod(getMethod);
responseBody =
getMethod.getResponseBodyAsString();
} catch (HttpException he) {
System.err.println("Http error connecting
to '" + url + "'");
System.err.println(he.getMessage());
System.exit(-4);
} catch (IOException ioe){
System.err.println("Unable to connect to
'" + url + "'");
System.exit(-3);
}

Cookie[] logoncookies =
client.getState().getCookies(HOST, PORT, "/", false);
System.out.println("First Request Cookies");
if (logoncookies.length == 0) {
System.out.println("None");
} else {
for (int i = 0; i < logoncookies.length;
i++) {
System.out.println("- " +
logoncookies[i].toString());
}
}

//write out the request headers
System.out.println("*** Request ***");
System.out.println("Request 

RE: SSL - poor performance

2004-02-16 Thread Kalnichevski, Oleg
> What do you think of this solution? Could it bring up other problems?

I see no problems with this approach. Alternatively you may consider making a 
singleton out of the SSLContext instance.

Cheers,

Oleg


-Original Message-
From: Tentrup Stephan (P/BA (INFBA))
[mailto:[EMAIL PROTECTED]
Sent: Monday, February 16, 2004 13:08
To: Commons HttpClient Project
Subject: RE: SSL - poor performance


Hi!

OK, thanks for your help, I found a solution!
With the system property javax.net.debug=ssl I saw that the SSL sessions were not 
cached. This is because the createSocket method in EasySSLProtocolSocketFactory always 
creates a new SSLContext so that the SSL sessions cannot be reused and the handshake 
must be performed with every request. In order to solve this I moved the call of 
getInstance() and init() (both of SSLContext) to the constructor of 
EasySSLProtocolSocketFactory.
What do you think of this solution? Could it bring up other problems?

Stephan



-Original Message-
From: Kalnichevski, Oleg [mailto:[EMAIL PROTECTED] 
Sent: Thursday, February 12, 2004 3:36 PM
To: Commons HttpClient Project
Subject: RE: SSL - poor performance


Stephan,
Most likely the problem has nothing to do with HttpClient as such. Please refer to the 
'known problems' / 'troubleshooting' section of the HttpClient SSL guide to find out 
whether the problem is related to some peculiarities of your JSSE / JDK / target 
server configuration.

http://jakarta.apache.org/commons/httpclient/sslguide.html

HTH,

Oleg

-Original Message-
From: Tentrup Stephan (P/BA (INFBA)) [mailto:[EMAIL PROTECTED]
Sent: Thursday, February 12, 2004 15:18
To: [EMAIL PROTECTED]
Subject: SSL - poor performance


Hi,

I am using HttpClient (2.0RC3) to make HTTP requests over SSL. At first I specified 
the keystore with the trusted certificates by the system properties 
javax.net.ssl.trustStore=/path/to/keystorefile and 
javax.net.ssl.trustStorePassword=password
The performance was good in this case but I wanted to manage the keystore(s) in the 
java code. So I used the EasySSLProtocolSocketFactory and EasyX509TrustManager classes 
from the contrib directory and adjusted them to my needs. The functionality is alright 
but the time cost is very much higher than with the system property method. I added 
debug messages at various positions to see where the time is lost and I found that 
between the end of the checkServerTrusted method in EasyX509TrustManager and the end 
of the method executeMethod in HttpClient the highest amount of time gets lost. I 
don´t know what is happening between these two points. Any hints?

Stephan


// EasyX509TrustManager.java
/*
 * 
 *
 * The Apache Software License, Version 1.1
 *
 * Copyright (c) 2002-2003 The Apache Software Foundation.  All rights
 * reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions
 * are met:
 *
 * 1. Redistributions of source code must retain the above copyright
 *notice, this list of conditions and the following disclaimer.
 *
 * 2. Redistributions in binary form must reproduce the above copyright
 *notice, this list of conditions and the following disclaimer in
 *the documentation and/or other materials provided with the
 *distribution.
 *
 * 3. The end-user documentation included with the redistribution, if
 *any, must include the following acknowlegement:
 *   "This product includes software developed by the
 *Apache Software Foundation (http://www.apache.org/)."
 *Alternately, this acknowlegement may appear in the software itself,
 *if and wherever such third-party acknowlegements normally appear.
 *
 * 4. The names "The Jakarta Project", "Commons", and "Apache Software
 *Foundation" must not be used to endorse or promote products derived
 *from this software without prior written permission. For written
 *permission, please contact [EMAIL PROTECTED]
 *
 * 5. Products derived from this software may not be called "Apache"
 *nor may "Apache" appear in their names without prior written
 *permission of the Apache Group.
 *
 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
 * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
 * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
 * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
 * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILI

RE: GetMethod Performance

2004-02-16 Thread Kalnichevski, Oleg
Ben,
Try the following:

(1) disable stale connections check

SimpleHttpConnectionManager connman = new SimpleHttpConnectionManager(); 
connman.setConnectionStaleCheckingEnabled(false);
HttpClient client = new HttpClient(connman);

http://jakarta.apache.org/commons/httpclient/apidocs/org/apache/commons/httpclient/SimpleHttpConnectionManager.html#setConnectionStaleCheckingEnabled(boolean)

(2) configure HttpClient to use HTTP/1.0 instead of HTTP/1.1

GetMethod get = new GetMethod("http://192.168.0.1/commons-httpclient-2.0-final.zip";);
get.setHttp11(false);

http://jakarta.apache.org/commons/httpclient/apidocs/org/apache/commons/httpclient/HttpMethodBase.html#setHttp11(boolean)

See if any these options makes any difference

Oleg

-Original Message-
From: Ben Wong [mailto:[EMAIL PROTECTED]
Sent: Monday, February 16, 2004 06:41
To: [EMAIL PROTECTED]
Subject: GetMethod Performance


Hi,

I have noticed significant performance difference between using
HttpClient and Socket.

I tried to use GetMethod to download a 2MB file from a Webserver sitting
in the LAN. When I do it with HttpClient, it takes around 13-15 seconds
while it will only take less than half a second with Socket.

I was running the code below on a Sun Blade 100 with Solaris 8
installed. J2SDK1.4.2_03 and HttpClient 2.0 final were used.

Any help would be appreciated.

Thanks,
Ben

HttpClient code:

HttpClient client = new HttpClient();
GetMethod get = new
GetMethod("http://192.168.0.1/commons-httpclient-2.0-final.zip";);

int statusCode = client.executeMethod(get);
System.out.println("Status Code: " + statusCode);
int size = 0;

InputStream in = get.getResponseBodyAsStream();
byte [] data = new byte[1];
int read = 0;

while ((read = in.read(data)) > 0) {
size += read;
}

in.close();
get.releaseConnection();

Socket Code:

Socket soc = new Socket("192.168.0.11", 80);
InputStream in = soc.getInputStream();
OutputStream out = soc.getOutputStream();

String command = "GET
http://192.168.0.1/commons-httpclient-2.0-final.zip
HTTP/1.0\nUser-Agent: Jakarta Commons-HttpClient/2.0final\nHost:
10.0.3.11\n\n";
byte [] send = command.getBytes();

out.write(send);
byte b[] = new byte[4096];
int size = 0;
int count = 0;
while( (size = in.read(b)) >= 0) {
count += size;
}
in.close();
out.close();

soc.close();





-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Cookie Problem

2004-02-16 Thread hareesh babu
Hi  Roland Weber,

  Thanks for you immediate reponse. Even if set the
cookie policy by different i am getting the problem. 
Let me explain the problem i am facing, I am sending a
get request the home page of the xxx website, it is
comming fine, after that i am sending a post with user
and password, and that is also comming after that if
send a another get request in the internal site which
requies authorized user, website is checking the
cookie, but the cookie problem, the website is
redirecting the request into home page one agian. 
I try do by removing the SEPARATORS.set(',');  in the
HeaderElement, no use. 
  
Here i placing my sample request program

*

import java.io.IOException;
import java.net.MalformedURLException;
import org.apache.commons.httpclient.Credentials;
import
org.apache.commons.httpclient.UsernamePasswordCredentials;
import org.apache.commons.httpclient.Header;
import org.apache.commons.httpclient.HttpClient;
import org.apache.commons.httpclient.HttpException;
import org.apache.commons.httpclient.HttpMethod;
import org.apache.commons.httpclient.Cookie;
import
org.apache.commons.httpclient.cookie.CookiePolicy;
import
org.apache.commons.httpclient.methods.GetMethod;
import
org.apache.commons.httpclient.methods.PostMethod;
import org.apache.commons.httpclient.NameValuePair;
import org.apache.commons.httpclient.Header;


public class Test1
{

 public static void main(String[] args) throws
Exception
{
   
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.httpclient.wire",
"debug");
   
System.setProperty("org.apache.commons.logging.simplelog.log.org.apache.commons.httpclient",
"debug");
  

//create a singular HttpClient object
String HOST =".xxx.com";
int PORT = 80;

HttpClient client = new HttpClient();
client.getHostConfiguration().setHost(HOST,
PORT, "http");
client.getState().setCookiePolicy(
CookiePolicy.COMPATIBILITY );


String url = "/online/on_login1.jsp";
GetMethod getMethod = null;
Header header1 = new Header ("Accept",
"image/gif, image/x-xbitmap, image/jpeg, image/pjpeg,
application/msword, */*");
Header header2 = new Header ("Referer",
"http://"; + HOST);
Header header3 = new Header
("Accept-Language", "en-us");
Header header4 = new Header  ("Content-Type",
"application/x-www-form-urlencoded");
Header header5 = new Header
("Accept-Encoding", "gzip, deflate");
Header header6 = new Header
("Proxy-Connection", "Keep-Alive");
Header header7 = new Header ("Pragma",
"no-cache");
Header header8 = new Header ("Cookie",
"name=Online");

getMethod = new GetMethod(url);
getMethod.setFollowRedirects(true);
getMethod.setStrictMode(false);
getMethod.setRequestHeader(header1);
getMethod.setRequestHeader(header2);
getMethod.setRequestHeader(header3);
getMethod.setRequestHeader(header4);
getMethod.setRequestHeader(header5);
getMethod.setRequestHeader(header6);
getMethod.setRequestHeader(header7);
getMethod.setRequestHeader(header8);

//execute the method
String responseBody = null;
try{
client.executeMethod(getMethod);
responseBody =
getMethod.getResponseBodyAsString();
} catch (HttpException he) {
System.err.println("Http error connecting
to '" + url + "'");
System.err.println(he.getMessage());
System.exit(-4);
} catch (IOException ioe){
System.err.println("Unable to connect to
'" + url + "'");
System.exit(-3);
}

Cookie[] logoncookies =
client.getState().getCookies(HOST, PORT, "/", false);
System.out.println("First Request Cookies");
if (logoncookies.length == 0) {
System.out.println("None");
} else {
for (int i = 0; i < logoncookies.length;
i++) {
System.out.println("- " +
logoncookies[i].toString());
}
}

//write out the request headers
System.out.println("*** Request ***");
System.out.println("Request Path: " +
getMethod.getPath());
System.out.println("Request Query: " +
getMethod.getQueryString());
Header[] requestHeaders =
getMethod.getRequestHeaders();
for (int i=0; i wrote: > Hello
Hareesh,
> 
> the cookie shouldn't include commas in the first
> place,
> that's a violation of the respective specification.
> But
> since you have to access that page, try setting a
> different cookie policy. Check out the options in
> org.apache.commons.httpclient.cookie.CookiePolicy
> 
> Try NETSCAPE and BROWSER_COMPATIBILITY.
> 
> cheers,
>   Roland
> 
> 
> 
> 
> 
> 
>

RE: SSL - poor performance

2004-02-16 Thread Tentrup Stephan (P/BA (INFBA))
Hi!

OK, thanks for your help, I found a solution!
With the system property javax.net.debug=ssl I saw that the SSL sessions were not 
cached. This is because the createSocket method in EasySSLProtocolSocketFactory always 
creates a new SSLContext so that the SSL sessions cannot be reused and the handshake 
must be performed with every request. In order to solve this I moved the call of 
getInstance() and init() (both of SSLContext) to the constructor of 
EasySSLProtocolSocketFactory.
What do you think of this solution? Could it bring up other problems?

Stephan



-Original Message-
From: Kalnichevski, Oleg [mailto:[EMAIL PROTECTED] 
Sent: Thursday, February 12, 2004 3:36 PM
To: Commons HttpClient Project
Subject: RE: SSL - poor performance


Stephan,
Most likely the problem has nothing to do with HttpClient as such. Please refer to the 
'known problems' / 'troubleshooting' section of the HttpClient SSL guide to find out 
whether the problem is related to some peculiarities of your JSSE / JDK / target 
server configuration.

http://jakarta.apache.org/commons/httpclient/sslguide.html

HTH,

Oleg

-Original Message-
From: Tentrup Stephan (P/BA (INFBA)) [mailto:[EMAIL PROTECTED]
Sent: Thursday, February 12, 2004 15:18
To: [EMAIL PROTECTED]
Subject: SSL - poor performance


Hi,

I am using HttpClient (2.0RC3) to make HTTP requests over SSL. At first I specified 
the keystore with the trusted certificates by the system properties 
javax.net.ssl.trustStore=/path/to/keystorefile and 
javax.net.ssl.trustStorePassword=password
The performance was good in this case but I wanted to manage the keystore(s) in the 
java code. So I used the EasySSLProtocolSocketFactory and EasyX509TrustManager classes 
from the contrib directory and adjusted them to my needs. The functionality is alright 
but the time cost is very much higher than with the system property method. I added 
debug messages at various positions to see where the time is lost and I found that 
between the end of the checkServerTrusted method in EasyX509TrustManager and the end 
of the method executeMethod in HttpClient the highest amount of time gets lost. I 
don´t know what is happening between these two points. Any hints?

Stephan


// EasyX509TrustManager.java
/*
 * 
 *
 * The Apache Software License, Version 1.1
 *
 * Copyright (c) 2002-2003 The Apache Software Foundation.  All rights
 * reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions
 * are met:
 *
 * 1. Redistributions of source code must retain the above copyright
 *notice, this list of conditions and the following disclaimer.
 *
 * 2. Redistributions in binary form must reproduce the above copyright
 *notice, this list of conditions and the following disclaimer in
 *the documentation and/or other materials provided with the
 *distribution.
 *
 * 3. The end-user documentation included with the redistribution, if
 *any, must include the following acknowlegement:
 *   "This product includes software developed by the
 *Apache Software Foundation (http://www.apache.org/)."
 *Alternately, this acknowlegement may appear in the software itself,
 *if and wherever such third-party acknowlegements normally appear.
 *
 * 4. The names "The Jakarta Project", "Commons", and "Apache Software
 *Foundation" must not be used to endorse or promote products derived
 *from this software without prior written permission. For written
 *permission, please contact [EMAIL PROTECTED]
 *
 * 5. Products derived from this software may not be called "Apache"
 *nor may "Apache" appear in their names without prior written
 *permission of the Apache Group.
 *
 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
 * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
 * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
 * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
 * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 * SUCH DAMAGE.
 * 
 *
 * This software consists of voluntary contributions made by many
 * individuals on behalf of the Apache Software Foundation.  For more
 * information on the Apache Software Foundation, please see
 * .
 *
 * [Additional notices, if required by prior licensing conditions]
 *
 */

package

Re: Cookie Problem

2004-02-16 Thread Roland Weber
Hello Hareesh,

the cookie shouldn't include commas in the first place,
that's a violation of the respective specification. But
since you have to access that page, try setting a
different cookie policy. Check out the options in
org.apache.commons.httpclient.cookie.CookiePolicy

Try NETSCAPE and BROWSER_COMPATIBILITY.

cheers,
  Roland







hareesh babu <[EMAIL PROTECTED]>
16.02.2004 12:21
Please respond to "Commons HttpClient Project"
 
To: [EMAIL PROTECTED]
cc: 
Subject:Cookie Problem


Hi, 

I am working on  website using apache commons
library of http client.

I was able to login into the  website using my
code and not able navigate into  website.

I was facing one problem with apache http client at
cookie assumption.

 website is sending cookie like this way,
Set-Cookie:
usr2__com=jzu,aa,czj,dm;path=/;domain=..com;

But apache http client is dividing the cookie into 4.
"Cookie: usr2_xxx_com=jzu[\r][\n]"
"Cookie: aa=[\r][\n]"
"Cookie: czj=[\r][\n]"
"Cookie:
ON_VAT2=103556810351170501155924063287[\r][\n]"
"Cookie: dm=[\r][\n]"

So next when I send a new get method it sending the
 website 4 cookies instead of one.

I am thinking due this problem I was not able to
navigate into  website.

Http client lib i am working on
http://mirrors.xtria.com/apache/jakarta/commons/httpclient/source/commons-httpclient-2.0-rc3-src.zip


Suggest me if am thinking right.

Hareesh.


Yahoo! India Insurance Special: Be informed on the best policies, 
services, tools and more. 
Go to: http://in.insurance.yahoo.com/licspecial/index.html

-
To unsubscribe, e-mail: 
[EMAIL PROTECTED]
For additional commands, e-mail: 
[EMAIL PROTECTED]




Cookie Problem

2004-02-16 Thread hareesh babu
Hi, 

I am working on  website using apache commons
library of http client.

I was able to login into the  website using my
code and not able navigate into  website.

I was facing one problem with apache http client at
cookie assumption.

 website is sending cookie like this way,
Set-Cookie:
usr2__com=jzu,aa,czj,dm;path=/;domain=..com;

But apache http client is dividing the cookie into 4.
"Cookie: usr2_xxx_com=jzu[\r][\n]"
"Cookie: aa=[\r][\n]"
"Cookie: czj=[\r][\n]"
"Cookie:
ON_VAT2=103556810351170501155924063287[\r][\n]"
"Cookie: dm=[\r][\n]"

So next when I send a new get method it sending the
 website 4 cookies instead of one.

I am thinking due this problem I was not able to
navigate into  website.

Http client lib i am working on
http://mirrors.xtria.com/apache/jakarta/commons/httpclient/source/commons-httpclient-2.0-rc3-src.zip

Suggest me if am thinking right.

Hareesh.


Yahoo! India Insurance Special: Be informed on the best policies, services, tools and 
more. 
Go to: http://in.insurance.yahoo.com/licspecial/index.html

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: No cookie.. Proxy realm.. limit setFollowRedirects

2004-02-16 Thread Ortwin Glück


Emre Sokullu wrote:

Hi all, 

I have 3 questions :

1) How can I reject all cookies ? (code please)
public class NoCookieState extends HttpState {
  public void addCookie(Cookie cookie) {
  }
  public void addCookies(Cookie[] cookies) {
  }
}
HttpClient client = new HttpClient();
client.setState(new NoCookieState());


--
 _
 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: [VOTE] 2.0 final release

2004-02-16 Thread Ortwin Glück
+1

so we have a 100% quorum :-) even if it's too late to vote against 
anyway. Are you guys working weekends?

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]