This week's book giveaway is in the OCMJEA forum. We're giving away four copies of OCM Java EE 6 Enterprise Architect Exam Guide and have Paul Allen & Joseph Bambara on-line! See this thread for details.
I have a servlet that a client calls from a java application and send a file. I read a file sent and process it. How do I check inside a servlet if some data is really sent e.g. in this case if a client really send a file or not.
Also how do make the servlet URL available to a client as https. I want to use https protocol but don't know how to configure this. Any help is appreciated.
MB<br />Sun Certified Programmer for Java2 Platform
Cant you just open an output stream and write the file to the servlet ? Its possible to do that. After you write to the output stream, read the response from the servlet.
How do I check inside a servlet if some data is really sent e.g. in this case if a client really send a file or not.
Well you could open the input stream and read some data. If the number of bytes read is 0 then no data was sent by your client.
I want to use https protocol but don't know how to configure this. Any help is appreciated.
Which web container / web server are you using ? That tomcat link should be of help if you are using tomcat to set these things up. How about asking the client application to login before any upload requests are sent ? Or is the data sensitive enough to warrant a HTTPS transaction ?
I don't know how the client will be uploading the files and writing a servlet using Apache commons libraries then when a client tries to upload any files they too have to use Apache commons. I am trying to have a generic servlet and no matter how the files are uploaded I should be able to handle that. Right now I have a version where I am using outputstream to write to a servlet and a version that uses Apache commons. Using Apache commons I can upload any file regardless of the type but using outputstrean I can't upload .doc, .pdf or any images etc. Any help on how I can make a ervlet generic to handle any files.
Joined: Jul 18, 2002
I am able to test a file upload using Apache HttpClient and as using outputstream only. Now on my end it's an https. Basically client makes a call using the following url
Can someone please tell me how to resolve this. As the client only needs the https url that ends at the proxy server on our end and that then based on the ip address the request is coming redirects it to the exact location where the servlet is deployed.