I am facing a small issue. I have a Servlet that receives a request with data in the Query String. The servlet creates a file, and writes some data to it. Now the Servlet should return the URL to the file. How can i do this? I have tested the writing a file, in eclipse and it give a temp directory like
D:\Eclipse Workplaces\ImageService\.metadata\.plugins\org.eclipse.wst.server.core\tmp0\wtpwebapps\MyService\MyService. This is not what i want. I want to write to a directory of my choice and then return the Web url of this file like http://localhost:8080/MyService/122-1234-123.txt. How can i accomplish this. Really stuck. Any help would be nice.
So you are saying what i am trying to do is not possible. Well what if i write the file lets say an image to some absolute path like c:\images\. No i get a request for a file name called 1234-4452-22. My servlet realises that the user is requesting for a MyPic.jpg. I read the JPG into a file object. Now what . How can i serve this image to the user. Setting the content type or something. The URL i provide, will be used in a html image tag like
<img src="http://localhost:8080/MyService/FileName=1234-4452-22 /> . How can i accomplish this, using a Servlet, a HTML page to display the image etc.