"Srini Sathya." wrote:

> craig, i am little bit curious here as per the posters words how could it
> work in JavaWebserver not in TOMCAT.  If it is going to be a browser problem
> then it should give him the same download option in javawebserver too.  I
> apologise if i missed out something obvious.
>

That is why I asked what the client program was.  The original poster did not
provide enough problem description to give any sort of complete answer.

Note that the client program *does* matter:
* Netscape tends to pay attention to the content type, but you can configure
  how it handles each different type -- two different Netscape browsers that
  access even the same server can behave differently.
* IE tends to ignore the content type and try to figure out what the data is
  by examining the first few bytes.
* Both browsers have different behaviors in different versions.
* None of the above probably matters, because browser are going to have
  no clue what to do with serialized Java objects anyway -- only Java applets
  or Java client programs would find that sort of thing useful.

>
> Cheers
> Srini
>

Craig McClanahan



>
> -----Original Message-----
> From: Craig R. McClanahan [mailto:[EMAIL PROTECTED]]
> Sent: Tuesday, September 19, 2000 4:37 PM
> To: [EMAIL PROTECTED]
> Subject: Re: It's Urgent
>
> help java wrote:
>
> > hi,
> > I am facing the same problem again and again.When i
> > create a output stream on resonse object using
> >  ObjectOutputStream oo = new
> > ObjectOutputStream(response.getOutputStream())
> >
> > and run this servlet it gives me Download option i
> > could no it's this behaviour.Even this code is working
> > fine in JAVA Webserver.but in tomcat it giving me
> > problem.
> > For ur reference i am sending u the code
> >
> > public void service(HttpServletRequest req,
> > HttpServletResponse res) throws ServletException,
> > IOException
> >         {
> > // Get the data posted by the calling form
> > organization    = req.getParameter("organization");
> > location                = req.getParameter("location");
> > userID                  = req.getParameter("userID");
> >
> > //i tried using application/octet-stream to set the
> > content type then i used text/html  but all in vain
> >
> > res.setContentType("text/html");
> >
>
> Setting the content type to "text/html" is inconsistent with the data you
> are
> actually sending -- a binary stream of serialized Java objects.  Normally,
> "application/octet-stream" or something like that is used for serialized
> Java
> objects.
>
> > String  dataFromApplet[] ={};
> > String org[];
> > String userType =
> > Resource_Usertype.getUsertype(userID);
> > if(userType != null && userType.length() > 0)
> > org = Resource_Org.getOrganizations(userType);
> > try
> > {
> > ObjectOutputStream out = new
> > ObjectOutputStream(res.getOutputStream());
> > // Write the vector to the client applet
> >  out.writeObject(userType);
> > out.flush();
> > out.close();
> > System.out.println("Successfully outputted objects");
> > }
> > catch(Exception e)
> > {
> > System.err.println("exception in writing " +
> > e.getMessage());
> > }
> >
> > hope now u got my problem.
> > thanx in advance.
> >
>
> What kind of client program is submitting the request to get this data?  If
> it
> is a browser, you're going to be out of luck -- browsers have no clue how to
> understand serialized Java objects.  Only Java applets or client
> applications
> can do that.
>
> If you want to generate an HTML page displaying your output, you should be
> writing HTML, not serialized Java objects.
>
> Craig McClanahan
>
> ====================
> See you at ApacheCon Europe <http://www.apachecon.com>!
> Session VS01 (23-Oct 13h00-17h00):  Sun Technical Briefing
> Session T06  (24-Oct 14h00-15h00):  Migrating Apache JServ
>                                     Applications to Tomcat
>
> ___________________________________________________________________________
> To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
> of the message "signoff SERVLET-INTEREST".
>
> Archives: http://archives.java.sun.com/archives/servlet-interest.html
> Resources: http://java.sun.com/products/servlet/external-resources.html
> LISTSERV Help: http://www.lsoft.com/manuals/user/user.html
>
> ___________________________________________________________________________
> To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
> of the message "signoff SERVLET-INTEREST".
>
> Archives: http://archives.java.sun.com/archives/servlet-interest.html
> Resources: http://java.sun.com/products/servlet/external-resources.html
> LISTSERV Help: http://www.lsoft.com/manuals/user/user.html

--
====================
See you at ApacheCon Europe <http://www.apachecon.com>!
Session VS01 (23-Oct 13h00-17h00):  Sun Technical Briefing
Session T06  (24-Oct 14h00-15h00):  Migrating Apache JServ
                                    Applications to Tomcat

___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".

Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html

Reply via email to