0

I need to write a function that gets a Json via Spring and deliver a Data. The case is that a customer is sending me a Filename and im looking in a database where the file is and send him the data. I only need a little kickstart and someone who can answer me to my Questions:

  • Do I really need Sockets for this?
  • What for a Stream I should use (Its several Datatypes likes Pictures, Documents, Pdf....)
  • How can I identify the Destination to send
Brian Tompsett - 汤莱恩
  • 5,753
  • 72
  • 57
  • 129
Artur Rem
  • 209
  • 1
  • 4
  • 18

1 Answers1

1

You can use Response like this :

String yourData;
JsonWriter writer = new JsonWriter(response.getWriter());
    writer.beginObject();
    writer.name("data").value(yourData);
    writer.endObject();
    writer.close();
HeLL
  • 153
  • 6
  • Is that rly so easy? my data can be an Image or else. Will the Download windows appear when im doing this ? Excuse my Questions but im very new to File stuff. – Artur Rem Mar 10 '14 at 16:17
  • it's just a simple example to make ideas you cas see this for image http://stackoverflow.com/questions/2979758/writing-image-to-servlet-response-with-best-performance – HeLL Mar 10 '14 at 16:31