Hi,
 
Thanks for your help.
 
I found the samples specified by you very much useful.
 
I got it working with my JSP by sending user credential parameters which were required 
at my server.
 
Now the problem is making the same with an applet as it is not working from remote 
client accessing the JSP.
 
The flow is like this.
 
I have a screen where I enter drive name, and directory to be uploaded and in the next 
JSP I get the files of specified folder and create multipart request and send to the 
server along with User credentials.
 
Everything is working fine on the system which both client and server are running. But 
If I try the same from remote client then It is looking for files in the folder 
specified by client in server which is generating null pointer exception.
 
Now I need to make the functionality of creating the multipart request at client side, 
I am planning to do it in the applet.
 
Is it the right way to go for an applet, or can you suggest me some other solution..
 
thanks,
Srinivas.

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

you are using HttpClient from within a JSP to connect to
the server that is running the JSP? Or to a different server?

If you want to set request parameters, you don't do that
before creating the multipart request. You create the
multipart request, then add the parameters using
MP.addParameter(..) or MP.addPart(...).
Just make sure to add all required parameters before
you *execute* the method. See also the web site at

http://jakarta.apache.org/commons/httpclient/methods/multipartpost.html

The sample code for multipart file upload is for the
2.0 API, but it should be helpful anyway. Go straight
to the "actionPerformed" method:

http://cvs.apache.org/viewcvs.cgi/jakarta-commons/httpclient/src/examples/?only_with_tag=HTTPCLIENT_2_0_BRANCH

cheers,
Roland





Srinivas Velidanda 
05.10.2004 14:00
Please respond to
"Commons HttpClient Project"


To
Commons HttpClient Project 
cc

Subject
Re: HttpClient query...






Hi Roland, 
thanks for the reply.

I am new to this API and pl let me know how can I do the following.

1. can I set the same parameters coming from the session before creating 
Multipart request to the Multipart request, if yes, how can I set and how 
can these parameters can be referred at the server side.

2.I am getting the session parameters in the JSP where I am creating 
Multipart request, but once I post the Multipart request to the server the 
session is getting killed.

We are not working with cookies.

Is there a solution without using cookies or I must go for cookies..

thanks,

Srinivas

Roland Weber wrote:
Hello Srinivas,

if the session is handled by a session cookie, just make sure
you use the same HttpState object for all requests. That should
happen automagically if you do nothing special and re-use one
HttpClient for all requests.

If the server uses URL rewriting because it believes that the
client can't handle cookies, you have a problem. You will have
to parse server responses in order to extract URLs with the
session information encoded in them. Or convince the server
to send cookies.

hope that helps,
Roland





Srinivas Velidanda 
05.10.2004 13:32
Please respond to
"Commons HttpClient Project"


To
[EMAIL PROTECTED]
cc

Subject
HttpClient query...






Hi,

I am using HttpClient (commons-httpclient-3.0-alpha2) api for file upload.

How to handle a session if I am creating a MultipartPost request in a JSP 
and posting the request using client.executeMethod(mPost) to a servlet 
URL. 

Once I send the request the session is getting killed and could not pass 
on the request to a specific handler in sequence..

Pl. let me know how to handle the session, if possible send me some sample 

code for that.

thanks in advance..

Srinivas.



---------------------------------
Do you Yahoo!?
New and Improved Yahoo! Mail - Send 10MB messages!


---------------------------------
Do you Yahoo!?
Yahoo! Mail Address AutoComplete - You start. We finish.


                
---------------------------------
Do you Yahoo!?
vote.yahoo.com - Register online to vote today!

Reply via email to