1

I am creating a JAX-RS Web Service which can receive emails and forward the data to client. Currently I can work with simple emails. But I have no idea about how to implement this for emails with attachments. I know it should be done in 2 steps.

  1. My JAX-RS downloads the attachments from the mail server to my server.
  2. Send these files to the client.

Any suggestions implementing this.

yashdosi
  • 1,186
  • 1
  • 18
  • 40
  • 1
    For point 1. You can have a look at here http://java.sun.com/developer/onlineTraining/JavaMail/contents.html#GettingAttachments – Maxx Jun 29 '12 at 07:59
  • @Maxx - yeah i figured that much! now any suggestions about making the second step work?? I meean send the file to the client of my web service... (p.s. - I have to assume that my client does not know the complexities working in the background he should have a simple web service interface to work with...) – yashdosi Jun 29 '12 at 08:17
  • @Maxx - I would be fine if I can just give a download link of the attachments to the client.. – yashdosi Jun 29 '12 at 08:20
  • yes your service would have to expose a servlet for downloading the attached files ... I already did something similar the only problem had been figuring, from the web service, the full servlet address (host name + port etc.) ... at last I gave up and configured it on a properties file. I was working with Axis may be JAX-RS offers sone different way to do it ... – Maxx Jun 29 '12 at 09:14
  • You may have a look at here too ... http://stackoverflow.com/questions/5736973/dynamically-create-image-from-jax-rs-servlet – Maxx Jun 29 '12 at 09:22

0 Answers0