RE: How to post to a URL with Checkbox ?

2003-07-07 Thread Amit Rana
HttpClient client = new HttpClient();
HttpMethod method = new PostMethod(URL); 
NameValuePair pair = new NameValuePair[2];
pair[0] = new NameValuePair(cb, on); 
pair[1] = new NameValuePair(n, Eric);
((PostMethod) method).setRequestBody(parameters);
client.executeMethod(method);
byte[] responseBody = method.getResponseBody();

HTH,

NOTE: You will have to add appropriate error/exception handling.

Regards,
Amit.

 -Original Message-
 From: Eric Chow [mailto:[EMAIL PROTECTED]
 Sent: Monday, July 07, 2003 4:55 PM
 To: [EMAIL PROTECTED]
 Subject: How to post to a URL with Checkbox ?
 
 Hello,
 
 If the HTML form is like the following :
 
 form method=post action=/servlet/Show
 input type=checkbox name=cb
 input type=text name=n
 input type=submit value=Show
 /form
 
 
 How can Post to /servlet/Show with the values as following ?
 
 n=Eric   and the CheckBox should be CHECKED
 
 Please help ???
 
 
 
 Best regards,
 Eric
 
 
 
 
 
 ==
 If you know what you are doing,
 it is not called RESEARCH!
 ==
 
 -
 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: How to post to a URL with Checkbox ?

2003-07-07 Thread Amit Rana
HttpClient client = new HttpClient();
HttpMethod method = new PostMethod(URL); 
NameValuePair pair = new NameValuePair[2];
pair[0] = new NameValuePair(cb, on); 
pair[1] = new NameValuePair(n, Eric);
((PostMethod) method).setRequestBody(parameters);
client.executeMethod(method);
byte[] responseBody = method.getResponseBody();

HTH,

NOTE: You will have to add appropriate error/exception handling.

Regards,
Amit.

 -Original Message-
 From: Eric Chow [mailto:[EMAIL PROTECTED]
 Sent: Monday, July 07, 2003 4:55 PM
 To: [EMAIL PROTECTED]
 Subject: How to post to a URL with Checkbox ?
 
 Hello,
 
 If the HTML form is like the following :
 
 form method=post action=/servlet/Show
 input type=checkbox name=cb
 input type=text name=n
 input type=submit value=Show
 /form
 
 
 How can Post to /servlet/Show with the values as following ?
 
 n=Eric   and the CheckBox should be CHECKED
 
 Please help ???
 
 
 
 Best regards,
 Eric
 
 
 
 
 
 ==
 If you know what you are doing,
 it is not called RESEARCH!
 ==
 
 -
 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

2003-06-26 Thread Amit Rana
 Is there an automatic way to handle cookies?
According to whatever less I know about HttpClient, this is the default
behavior. Cookies are handled automatically. If you put the logging on
as given on the link
http://jakarta.apache.org/commons/httpclient/logging.html you will see
some entries like
Set-Cookie: Name=...
Which means that HttpClient is handling cookies for you.

HTH.

Regards,
Amit.

 -Original Message-
 From: Zulfi Umrani [mailto:[EMAIL PROTECTED]
 Sent: Friday, June 27, 2003 7:12 AM
 To: [EMAIL PROTECTED]
 Subject: Cookie
 
 Does any one know how can I manage cookies without having to get the
 cookies from HttpState and setting it back everytime I make a request?
 Is there an automatic way to handle cookies? Alternatively, how do I
put
 a cookie header on PostMethod? I have string representation of the
 cookie, I would like to set that as a header on PostMethod. At present
 it does not allow me to do so.
 
 Thanks.
 
 -
 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]



automatic management of cookie

2003-06-24 Thread Amit Rana
Hi,

Cookies document at
http://jakarta.apache.org/commons/httpclient/cookies.html states
quote HttpClient supports automatic management of cookies,
including allowing the server to set cookies and automatically return
them to the server when required. /quote

Do we have to make any special settings to enable this or will
the following code defaults to above?

HttpClient client = new HttpClient();
client.getState().setCookiePolicy(CookiePolicy.COMPATIBILITY);
HttpMethod method = new GetMethod(url);
Int statusCode = client.executeMethod(method);

Please feel free to point me to a document/link which can give more
information about the same.

I am trying to connect to a website which needs cookie support
from the client. I am getting same response while trying to connect from
httpclient which I get when I access the site with cookies disabled in
my browser.

Regards,
Amit.


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



RE: automatic management of cookie

2003-06-24 Thread Amit Rana
Hello Michael,

 Thank you for the reply.

 What exactly is the problem you are having?  Is HttpClient throwing
 exceptions when it tries to parse the cookies from this server?
I am sorry for not writing clearly before.

I am trying to access a site which gives me a fixed response Server is
busy please try later. This seems to be a canned response which I get
from my browser only when I disable cookies. Otherwise I have never
received this response on a browser.

Please feel free to correct me if I am wrong
1. Either the server has some check and sends a canned response for
anybody trying to access using a program, I think this should not be the
case because only way they can find the client is by User-agent which
can be set or
2. My browser gives same response code when cookies are disabled so I
want to make sure it is not a cookie problem.

I am trying to perform a Japanese trademark search on this site
http://www2.ipdl.jpo.go.jp/beginner_tm/TM_AREA.cgi (NOTE: if you want to
try it, text box expects only double byte input)

PFA the log. I highly appreciate your help.

Regards,
Amit.

 -Original Message-
 From: Michael Becke [mailto:[EMAIL PROTECTED]
 Sent: Wednesday, June 25, 2003 11:46 AM
 To: Commons HttpClient Project
 Subject: Re: automatic management of cookie
 
 Hello Amit,
 
  HttpClient client = new HttpClient();
  client.getState().setCookiePolicy(CookiePolicy.COMPATIBILITY);
  HttpMethod method = new GetMethod(url);
  Int statusCode = client.executeMethod(method);
 
 This will configure HttpClient to use the compatibility cookie mode.
 This is not necessarily required but is probably best to ensure
correct
 cookie handling.
 
  Please feel free to point me to a document/link which can give more
  information about the same.
 
  I am trying to connect to a website which needs cookie support
  from the client. I am getting same response while trying to connect
  from
  httpclient which I get when I access the site with cookies disabled
in
  my browser.
 
 The cookie documentation on the HttpClient site is about all there is.
 There's not too much more to it.
 
 What exactly is the problem you are having?  Is HttpClient throwing
 exceptions when it tries to parse the cookies from this server?
 
 Please take a look at the trouble shooting guide
 http://jakarta.apache.org/commons/httpclient/troubleshooting.html
for
 some more things to look at.  If this is not helpful in resolving the
 problem please post a wire log to the mailing list that shows the
 problematic transmission, see
 http://jakarta.apache.org/commons/httpclient/logging.html for how to
 create a wire log.
 
 Mike
 
 
 -
 To unsubscribe, e-mail:
 [EMAIL PROTECTED]
 For additional commands, e-mail:
 [EMAIL PROTECTED]
2003/06/25 11:59:55:714 JST [DEBUG] HttpClient - -Java version: 1.4.1_01
2003/06/25 11:59:55:714 JST [DEBUG] HttpClient - -Java vendor: Sun Microsystems Inc.
2003/06/25 11:59:55:714 JST [DEBUG] HttpClient - -Java class path: 
E:\Solis-work\solismark\WEB-INF\classes;E:\Solis-work\solismark\WEB-INF\lib\commons-httpclient-2.0-beta1.jar;E:\Solis-work\solismark\WEB-INF\lib\commons-logging-1.0.2.jar;E:\Solis-work\solismark\WEB-INF\lib\htmlparser.jar
2003/06/25 11:59:55:714 JST [DEBUG] HttpClient - -Operating system name: Windows XP
2003/06/25 11:59:55:714 JST [DEBUG] HttpClient - -Operating system architecture: x86
2003/06/25 11:59:55:714 JST [DEBUG] HttpClient - -Operating system version: 5.1
2003/06/25 11:59:56:175 JST [DEBUG] HttpClient - -SUN 1.2: SUN (DSA key/parameter 
generation; DSA signing; SHA-1, MD5 digests; SecureRandom; X.509 certificates; JKS 
keystore; PKIX CertPathValidator; PKIX CertPathBuilder; LDAP, Collection CertStores)
2003/06/25 11:59:56:175 JST [DEBUG] HttpClient - -SunJSSE 1.41: Sun JSSE 
provider(implements RSA Signatures, PKCS12, SunX509 key/trust factories, SSLv3, TLSv1)
2003/06/25 11:59:56:175 JST [DEBUG] HttpClient - -SunRsaSign 1.0: SUN's provider for 
RSA signatures
2003/06/25 11:59:56:175 JST [DEBUG] HttpClient - -SunJCE 1.4: SunJCE Provider 
(implements DES, Triple DES, Blowfish, PBE, Diffie-Hellman, HMAC-MD5, HMAC-SHA1)
2003/06/25 11:59:56:175 JST [DEBUG] HttpClient - -SunJGSS 1.0: Sun (Kerberos v5)
2003/06/25 11:59:56:285 JST [TRACE] GetMethod - -enter GetMethod(String)
2003/06/25 11:59:56:305 JST [TRACE] HttpMethod - 
-HttpMethodBase.addRequestHeader(Header)
2003/06/25 11:59:56:305 JST [TRACE] HttpMethod - 
-HttpMethodBase.addRequestHeader(Header)
2003/06/25 11:59:56:305 JST [TRACE] HttpMethod - 
-HttpMethodBase.addRequestHeader(Header)
2003/06/25 11:59:56:305 JST [TRACE] HttpMethod - 
-HttpMethodBase.addRequestHeader(Header)
2003/06/25 11:59:56:305 JST [TRACE] HttpMethod - 
-HttpMethodBase.addRequestHeader(Header)
2003/06/25 11:59:56:305 JST [TRACE] HttpMethod - 
-HttpMethodBase.addRequestHeader(Header)
2003/06/25 11:59:56:305 JST [TRACE] HttpMethod - 
-HttpMethodBase.addRequestHeader(Header)
2003/06/25