returning a custom file upon a servlet request

is it possible to return a custom file (not html) depending from a request send to the servlet?

The aim would be to send back a customized jnlp file depending on params given to the servlet. Also, the file should not be temporarily created on the server (in order to avoid conflicts when many users create files simultaneously), is this possible?
a bit code is welcome, thanks.

Isn’t all this covered in Sun’s official tutorials on servlet development? (or am I thinking of the O’Reilly book?, which I can’t remember if it’s available free on-line or not…)

Just set the content-type and stream away.

See HttpServletResponse.setContentType and HttpServletResponse.getOutputStream for more information.

…sorry, i still don’t get it :-[
i’m a noob with servlets and still don’t understand how to give back a jnlp file.

How exactly do you specify it’s a jnlp file?
(I looked at setContentType and getOutputStream but it didn’t helped)

Set the content-type to “application/x-java-jnlp-file” and then just stream the JNLP-file to the output-stream you get from response.getOutputStream.

that’s it, thanks!