me again I was just reading old post to this I hope my last post was helpful
I was reading someone post about servlets don't handling this correct (which
is false..)... I just wanna make clear this is the way that i'm implementing
it and is working with tomcat 5 and my client is a java app and also the
comunication is over ssl


--
David Casta;eda


On 4/9/06, davidecr <[EMAIL PROTECTED]> wrote:
>
> Hi i'mactually doing this in a project and to send objects and keep the
> parameters appart I send the parameters appenden to the end of the
> url... something like:
>
> new PostMethod("theURLofMyServlet" + "?" + "myparameter1" + "=" +
> "myparameter1VALUE");
>
> and use a RequestEntity to send the objects...
>
>
> ... in the servlet I use something like
>
> int param1 = Integer.parseInt(request.getParameter("myparameter1"));
> to get the parameter and ... to get the objects something like
>
> in = new ObjectInputStream(new
> BufferedInputStream(request.getInputStream()));
>
>         //get the client id
>         int clientId = (Integer) in.readObject();
>
>
> this is a silly example sorry i dont send you a better example because y
> made a group of classes that help me to handle this type of processing
> so i decide to write this instead of sending the real code...
>
> maybe someone else can see this nad make and opinion if there is a
> better way
>
> --
> David Casta;eda
>
> Sheetal D wrote:
> > Hi Roland,
> >          Thanks for showing me the right way,
> >   Could you clarify me one more doubt,
> >   If I want to write params and as well objects,
> >   Should i use ByteArrayPart with StringPart, is this the right way.  or
> Is there any other better ways of doing this.
> >
> >   Thanks,
> >   Sheetal
> >
> >
> > Roland Weber <[EMAIL PROTECTED]> wrote:
> >   Hello Sheetal,
> >
> >
> >> post.addRequestParameter("1","2");
> >> post.addRequestParameter("3","4");
> >> post.setRequsetEntity();
> >> // These two will not work together,
> >>
> >
> > Right, they won't. Either you set the parameters which will create
> > a request entity with url-form-encoding, or you set a request entity
> > and the parameters will be ignored.
> > If you set a request entity and still need to set parameters, you
> > probably need the multipart request entity which will not be parsed
> > by the servlet engine, as you have detected. If you need to do a
> > file upload, you will have to use the multipart request entity.
> >
> >
> >
> >> When I use parts, Again I need to use ObjectInopuStream and read
> accorndly,
> >>
> >
> > You *never* use an ObjectInputStream, unless you have to deserialize
> > Java objects!
> >
> >
> >> Is it should always read using OutputStream.
> >>
> >
> > You cannot read from an OutputStream. Output streams are for writing.
> >
> > You can use the InputStream of the request object on the server side
> > to access the multipart-encoded request entity. Since you will need
> > a server-side parser for multipart request entities, you should have
> > a look at the FileUpload project:
> >
> > http://jakarta.apache.org/commons/fileupload/
> >
> >
> > hope that helps,
> > Roland
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
> >
> >
> >
> > __________________________________________________
> > Do You Yahoo!?
> > Tired of spam?  Yahoo! Mail has the best spam protection around
> > http://mail.yahoo.com
> >
>
>


--
David Castañeda R.

Reply via email to