• Post Reply Bookmark Topic Watch Topic
  • New Topic

How can i read Serealized objects stream and pdf file stream simuntaneously in one servletconnection  RSS feed

 
Rohit kumar sharma
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have an applet which is communicating with the servlet .I have used the concept of serealization.Now my servlet is configure to read the contents as below




protected void doPost(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
processRequest(request, response);
try {
response.setContentType("application/x-java-serialized-object");
PrintWriter out = null;


InputStream in = request.getInputStream();
ObjectInputStream inputFromApplet = new ObjectInputStream(in);
.................
....................



Now to read pdf file from the servlet how can i set
response.setContentType("application/pdf");


So that it would work fine for both the serealized objects and pdf file.


i had used Jeditorpane previously,but it didint open pdf file.I searched on Java ranch and others sources all were saying that jeditorpane doenst support pdf file,we have to design parser for that.


Actually i have made an web based application which at front end uses applet and back end uses servlet.Now i want to provide help file in my project,as most application have.Help file, i have made in acrobat reader.Now i want to put one help file on server so that each client can get it at runtime(it would load at their machine from server).how can i do that?
 
Ulf Dittmer
Rancher
Posts: 42970
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
A servlet response can only contain a single type - you can't send both a serialized object and a PDF.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!