hc-httpclient-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Sheetal D <sheetal_d_2...@yahoo.com>
Subject RE: Help on Requst Params in Post
Date Fri, 07 Apr 2006 18:31:14 GMT
Hi, 
      Thanks for the reply, I have one more doubt. As you said,
  "Servlet/JSP specifications do not
handle multipart requests" Then, I am still confused why when I use 
  URLHttpConnection. It works, using POST, In jsp,
  for (java.util.Enumeration enum= request.getHeaderNames(); enum.hasMoreElements();){
String s = (String)enum.nextElement();
  System.out.println("s"+s);
  }
   
  There I take the outputstream and write paramname=value. 
   
  Thanks,
  Sheetal
       
   
  

"Kadlabalu, Hareesh" <Hareesh.Kadlabalu@fatwire.com> wrote:
  The reason this happens is because Servlet/JSP specifications do not
handle multipart requests, by design (I do not know why). Java
developers therefore have to either parse the stream in their programs
or use one of many libraries out there for this purpose.

Apache Commons FileUpload
(http://jakarta.apache.org/commons/fileupload/)
Cos (http://www.servlets.com/cos/)

-Hareesh



-----Original Message-----
From: Sheetal D [mailto:sheetal_d_2006@yahoo.com] 
Sent: Friday, April 07, 2006 12:29 PM
To: httpclient-user@jakarta.apache.org
Subject: Help on Requst Params in Post

Hi all, 
I have seen some of the queries on this. I still could not
find the reason why I am not able to get request parameters in Post.
Because, I need to write both StringPart and Objects using
RequestEntities. 
I have used the example given in the API,
PostMethod filePost = new PostMethod(url);
try{
Part[] parts = { new StringPart("sheetal",
"sheetalPassword") };
filePost.setRequestEntity(
new MultipartRequestEntity( parts,
filePost.getParams()) );
HttpClient client = new HttpClient();
int status = client.executeMethod(filePost);
System.out.println("The status code is
"+client.executeMethod(filePost));

StatusCode returns properly, But When I get the parameter in JSP.

It will print null, Could anybody tell me what mistake I am making.

Thanks,
Sheetal








---------------------------------
New Yahoo! Messenger with Voice. Call regular phones from your PC and
save big.

---------------------------------------------------------------------
To unsubscribe, e-mail: httpclient-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: httpclient-user-help@jakarta.apache.org



		
---------------------------------
New Yahoo! Messenger with Voice. Call regular phones from your PC and save big.
Mime
  • Unnamed multipart/alternative (inline, 8-Bit, 0 bytes)
View raw message