0

I have to return a JavaME .jad file from restful web service (using Jersey), which is then used to install an app on a mobile phone. Before delivering the .jad file some values in there have to be changed. I was thinking of reading the original file, change the read input and writing it back to some outputstream. Can I just return the output stream in a Jersey Rest services? Is there anything special I have to take of in terms of mime-type, etc.? Does anyone know of some kind of example code or tutorial for this purpose? Thanks in advance

heapifyman
  • 161
  • 8

1 Answers1

1

Either like here: Input and Output binary streams using JERSEY? or you could send the StreamingOutput as an entity like this:

return Response.ok(streamingOutput).type("text/vnd.sun.j2me.app-descriptor");

Point is you have to use the OutputStream handed to you via the StreamingOutput.write(OutputStream outputStream) method.

Community
  • 1
  • 1
polve
  • 2,789
  • 2
  • 18
  • 20
  • Thanks, I had found that topic already but was looking for a code example how to implement and call the StreamingOutputs write method. But I think I got it running now. Thanks again. – heapifyman Aug 19 '11 at 09:31
  • Glad I could help. How about closing the topic? :-) – polve Sep 07 '11 at 12:37
  • Just set my answer as the correct :-) not sure how, I answer more than i ask. – polve Dec 24 '11 at 11:35