Return-Path: Delivered-To: apmail-jakarta-httpclient-user-archive@www.apache.org Received: (qmail 42154 invoked from network); 9 Apr 2006 18:43:02 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 9 Apr 2006 18:43:02 -0000 Received: (qmail 86057 invoked by uid 500); 9 Apr 2006 18:43:01 -0000 Delivered-To: apmail-jakarta-httpclient-user-archive@jakarta.apache.org Received: (qmail 86039 invoked by uid 500); 9 Apr 2006 18:43:01 -0000 Mailing-List: contact httpclient-user-help@jakarta.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: "HttpClient User Discussion" Reply-To: "HttpClient User Discussion" Delivered-To: mailing list httpclient-user@jakarta.apache.org Received: (qmail 86028 invoked by uid 99); 9 Apr 2006 18:43:01 -0000 Received: from asf.osuosl.org (HELO asf.osuosl.org) (140.211.166.49) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 09 Apr 2006 11:43:01 -0700 X-ASF-Spam-Status: No, hits=0.0 required=10.0 tests=HTML_MESSAGE,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (asf.osuosl.org: domain of davidecr@gmail.com designates 64.233.184.226 as permitted sender) Received: from [64.233.184.226] (HELO wproxy.gmail.com) (64.233.184.226) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 09 Apr 2006 11:43:00 -0700 Received: by wproxy.gmail.com with SMTP id i4so636948wra for ; Sun, 09 Apr 2006 11:42:39 -0700 (PDT) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:to:subject:in-reply-to:mime-version:content-type:references; b=Q/W5smU0c+IH17vwJpEWq0DCAF9p9sHQ56Liej9R5USURr+vCE0z5poaAa+pcl171UwQMNdJQp+U6hU+uGW6yCRjIucAnv0pTSs8uVDwPWIx4lMnDWpri9ufUZPgHp6CgENnDY1Df7j7aNK+jDm7uzbqTInySJLCyvMTrdFHUlU= Received: by 10.54.125.2 with SMTP id x2mr2684446wrc; Sun, 09 Apr 2006 11:42:39 -0700 (PDT) Received: by 10.54.160.13 with HTTP; Sun, 9 Apr 2006 11:42:39 -0700 (PDT) Message-ID: <82a9da910604091142r5199920et1b9be7cf467fede@mail.gmail.com> Date: Sun, 9 Apr 2006 13:42:39 -0500 From: "=?ISO-8859-1?Q?David_Casta=F1eda?=" To: "HttpClient User Discussion" Subject: Re: Help on Requst Params in Post In-Reply-To: <82a9da910604091137m264604b0pbc4a248bad0eccf2@mail.gmail.com> MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_Part_8916_19597575.1144608159488" References: <20060409145329.87132.qmail@web37810.mail.mud.yahoo.com> <4439518E.10308@gmail.com> <82a9da910604091137m264604b0pbc4a248bad0eccf2@mail.gmail.com> X-Virus-Checked: Checked by ClamAV on apache.org X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N ------=_Part_8916_19597575.1144608159488 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline ups also i have and implementation sending files... on the other side i'm useing file upload... but I know this is possible to handle the send of a file ... search well in google i'm sure you will find it anywhere if you search... here is some sample code.... FilePart filePart =3D null; try { filePart =3D new FilePart(LOGFILE, logFile); } catch (FileNotFoundException e) { //nothing to do here } MultipartRequestEntity requestEntity =3D new MultipartRequestEntity(new Part[]{filePart}, methodP.getParams()); methodP.setRequestEntity(requestEntity); String servletURL =3D ParametersConstants.SERVLET_LOGS + "?" + ParametersConstants.USER_ID_PARAM + "=3D" + 12; .... On 4/9/06, David Casta=F1eda wrote: > > 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 tha= t > 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 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" + "=3D" + > > "myparameter1VALUE"); > > > > and use a RequestEntity to send the objects... > > > > > > ... in the servlet I use something like > > > > int param1 =3D Integer.parseInt(request.getParameter("myparameter1")); > > to get the parameter and ... to get the objects something like > > > > in =3D new ObjectInputStream(new > > BufferedInputStream(request.getInputStream())); > > > > //get the client id > > int clientId =3D (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 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: httpclient-user-unsubscribe@jakarta.apache.or= g > > > > > For additional commands, e-mail: > > httpclient-user-help@jakarta.apache.org > > > > > > > > > > > > __________________________________________________ > > > Do You Yahoo!? > > > Tired of spam? Yahoo! Mail has the best spam protection around > > > http://mail.yahoo.com > > > > > > > > > > -- > David Casta=F1eda R. > -- David Casta=F1eda R. ------=_Part_8916_19597575.1144608159488--