« Return to Thread: DWR - obtaining a path in remote method

DWR - obtaining a path in remote method

by JBuilderDoug :: Rate this Message:

Reply to Author | View in Thread

I have a retrieve button on my form that calls a javascript that sends a request back to my application on the server.  The server method gets information from a MySQL database and sends it back as a string [] to the javascript.  The java script parses the string and populates fields on the form.  All well and good.

Now I need for the server method to retrieve the text data and also retrieve and image (BLOB) from MySQL, write it to a file, then send the filename back with the other text data for display.

My problem is that (I'm using JSF) that the DWR method in my application on the server is not privvy to FacesContext (which makes sense).  My directory is images/<filename>, but that's a relative path.  If I wrote to images/<filename>, it would try to write to an "images" directory under glassfish\bin (since I'm deployed under glassfish) and that's the literal current directory.

I need to get the real path to write the image file (something like c:\glassfish\domains\domain1\autodeploy\<my app name>\images.

Then what I can pass back to the javascript is simply images\<filename>

Surely, there's some context I can hook into once the javascript gets back to the server?

 « Return to Thread: DWR - obtaining a path in remote method