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");
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.



--- Shital Kanitkar <[EMAIL PROTECTED]> wrote:
> Yes, copy the Applet class file to your servlet
> class file directory.
>
> If
> response.setContentType("application/octet-stream")
> works on Java Web
> Server, wherein lies the problem?
>
>
> ----- Original Message -----
> From: help java <[EMAIL PROTECTED]>
> To: <[EMAIL PROTECTED]>
> Sent: Monday, September 18, 2000 8:22 AM
> Subject: Re: It's Urgent
>
>
> > hi,
> > Still i did not get it clearly.And i am facing two
> > problems.The first one is
> > i am invoking applet through Html
> >
> > should i copy my applet class file in same
> directory
> > in which servlet class file is.
> > so that is could not give any error.
> > if u have any code related to this that will be
> > helpful
> >
> >
> > second problem is related to servlet.
> > when i give
> >
> response.setContentType("application/octet-stream")
> > it provide me a download option.I don't know why
> this
> > is giving me download option.B'cos this code is
> > perfectly working in javawebserver.May be i am
> > providing wrong content type option.but as far as
> i
> > know if u want to write on output stream u have to
> > give this content type.
> > or suggest me what content type  i should provide
> so
> > that it run perfectly.
> > thanx in advance.
> >
> > gunjan
> >
> >
> >
> >
> >
> >
> >
> > --- Shital Kanitkar <[EMAIL PROTECTED]> wrote:
> > > Oh, I thought you were not using a Web server
> and
> > > merely using the server
> > > utility that comes with the JSDK (startserver).
> > >
> > > To access your applet don't double-click it from
> the
> > > windows explorer. Start
> > > your browser and access the applet using your
> URL
> > > http://10.5.0.40:8080/servlet/AppletName"
> > >
> > > -Shital
> > >
> > > Regarding
> > > ----- Original Message -----
> > > From: help java <[EMAIL PROTECTED]>
> > > To: <[EMAIL PROTECTED]>
> > > Sent: Saturday, September 16, 2000 1:21 AM
> > > Subject: Re: It's Urgent
> > >
> > >
> > > > hi,
> > > > thanx for this quick reply.
> > > > Second answer i got it.First i did not get it.
> > > > same program when i run through appletviewer
> it
> > > > running properly but as i am using tomcat so
> in
> > > > browser it giving error.do u think it is not
> > > advisable
> > > > to use policy tool b'cos my applet and servlet
> are
> > > on
> > > > the same server.Can u explain first one in
> detail.
> > > >
> > > > gunjan
> > > >
> > > >
> > > >
> > > >
> > > > --- Shital Kanitkar <[EMAIL PROTECTED]>
> wrote:
> > > > > Lucky you! I'd just asked this question 2
> days
> > > back
> > > > > with no answer and had
> > > > > to ferret it out myself. Well, you have two
> > > options,
> > > > > one is to download a
> > > > > Web Server and access the applet by the URL
> and
> > > not
> > > > > by double clicking it in
> > > > > explorer. Otherwise, use the policy tool and
> > > grant
> > > > > your applet permission.
> > > > >
> > > > > Hope this helps,
> > > > >
> > > > > -Shital
> > > > >
> > > > > ----- Original Message -----
> > > > > From: help java <[EMAIL PROTECTED]>
> > > > > To: <[EMAIL PROTECTED]>
> > > > > Sent: Thursday, September 14, 2000 10:29 PM
> > > > > Subject: It's Urgent
> > > > >
> > > > >
> > > > > > hi,
> > > > > > I hope u can solve this problem.
> > > > > > I am using applet servlet communication.
> > > > > > till this code it's work fine in applet
> > > > > >
> > > > > > URL url = new
> > > > > >
> > > > >
> > > >
> > >
> >
>
URL("http://10.5.0.40:8080/servlet/SerResourceGroup");
> > > > > >                         urlConn =
> > > > > url.openConnection();
> > > > > >
> > > > > urlConn.setUseCaches(false);
> > > > > >
> > > > > >
> > > > >
> > > >
> > >
> >
>
urlConn.setRequestProperty("CONTENT_TYPE","application/octet-stream");
> > > > > >
> > > urlConn.setDoInput(true);
> > > > > >
> > > urlConn.setDoOutput(true);
> > > > > >
> > > > > >
> > > > > > but when i try to read using this ----
> > > > > >
> > > > > > ObjectInputStream oi = new
> > > > > >
> ObjectInputStream(urlConn.getInputStream());
> > > > > >
> > > > > showStatus((String)oi.readObject());
> > > > > >
> > > > > >
> > > > > > it's gives error ---
> > > > > > access denied (java.net.SocketPermission
> > > proxy.ur
> > > > > > servername.com resolve)
> > > > > >
> > > > > > can u pleae tell me how can i solve this
> > > problem
> > > > > > ..Applet and servlet both r on same
> server.
> > > > > >
> > > > > > thanx in advance.
> > > > > >
> >
> >
> > __________________________________________________
> > Do You Yahoo!?
> > Yahoo! Mail - Free email you can access from
> anywhere!
> > http://mail.yahoo.com/
> >
> >
>
___________________________________________________________________________
> > 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
>
=== message truncated ===


__________________________________________________
Do You Yahoo!?
Send instant messages & get email alerts with Yahoo! Messenger.
http://im.yahoo.com/

___________________________________________________________________________
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