Return-Path: Delivered-To: apmail-struts-user-archive@www.apache.org Received: (qmail 20606 invoked from network); 30 Jul 2010 19:00:21 -0000 Received: from unknown (HELO mail.apache.org) (140.211.11.3) by 140.211.11.9 with SMTP; 30 Jul 2010 19:00:21 -0000 Received: (qmail 78460 invoked by uid 500); 30 Jul 2010 19:00:19 -0000 Delivered-To: apmail-struts-user-archive@struts.apache.org Received: (qmail 78404 invoked by uid 500); 30 Jul 2010 19:00:18 -0000 Mailing-List: contact user-help@struts.apache.org; run by ezmlm Precedence: bulk List-Unsubscribe: List-Help: List-Post: List-Id: "Struts Users Mailing List" Reply-To: "Struts Users Mailing List" Delivered-To: mailing list user@struts.apache.org Received: (qmail 78396 invoked by uid 99); 30 Jul 2010 19:00:18 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 30 Jul 2010 19:00:18 +0000 X-ASF-Spam-Status: No, hits=2.2 required=10.0 tests=FREEMAIL_FROM,HTML_MESSAGE,RCVD_IN_DNSWL_NONE,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of arunkumar.boppudi@gmail.com designates 209.85.212.48 as permitted sender) Received: from [209.85.212.48] (HELO mail-vw0-f48.google.com) (209.85.212.48) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 30 Jul 2010 19:00:14 +0000 Received: by vws2 with SMTP id 2so2393496vws.35 for ; Fri, 30 Jul 2010 11:59:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:mime-version:received:in-reply-to :references:from:date:message-id:subject:to:content-type; bh=kExGUlfbMpYP/ABzcQh3EFUxLYHdxWeaul5nf1VqpeY=; b=CC2Vy6SOAkOlxXNkvU8yF0xVaVVhiHB1YapdOlEhlvZhrkL1oioKtSrp82bzP+oeW+ B4jLa9o60jYXmPS4/7eIpFh2hldCO1WdYc71XXy23JfykjFSZU61tYxOQiyOmo4SIm8R 6kdKTMIksG+e3KR5ToVON3LWalBeO8ZcFd5M0= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :content-type; b=so4FZUu8me4cF7i133NefNqswRbJGU/Ing8+BG5mQER1GLU7Q5ATl0VfQuhoBN6mXE MsZd4E4qrWwsywUxgLgCai0jwj9Orndh1El5GS2IIWqLZwz0Sjyt7GOXsWgDOR7NAgu5 OXo8jNfbH1RM4lL+zVfYSHRR8yfIDaLHnrVeE= Received: by 10.220.60.204 with SMTP id q12mr1414833vch.45.1280516392739; Fri, 30 Jul 2010 11:59:52 -0700 (PDT) MIME-Version: 1.0 Received: by 10.220.184.9 with HTTP; Fri, 30 Jul 2010 11:59:32 -0700 (PDT) In-Reply-To: References: From: Arun Kumar Boppudi Date: Sat, 31 Jul 2010 00:29:32 +0530 Message-ID: Subject: Re: Reading input stream (xml) To: Struts Users Mailing List Content-Type: multipart/alternative; boundary=e0cb4e887865b7e44c048c9f7494 --e0cb4e887865b7e44c048c9f7494 Content-Type: text/plain; charset=ISO-8859-1 Thanks. But I am looking for a solution in Struts 1.3. -- AB On Fri, Jul 30, 2010 at 4:17 PM, adam pinder wrote: > > > > your action could implement ServletRequestAware then it has access to the > full request including posted content. > > > > adam > > > > > From: arunkumar.boppudi@gmail.com > > Date: Fri, 30 Jul 2010 15:31:15 +0530 > > Subject: Re: Reading input stream (xml) > > To: user@struts.apache.org > > > > Request to this controller comes from other applications, only in XML > > format. So, I cannot expect multi-part. > > -- AB > > > > > > On Fri, Jul 30, 2010 at 2:38 PM, Rahul Mohan > wrote: > > > > > A variant of the first: change your encoding to multi-part and send > > > 'data=your_xml_content'. Then struts will take care of getting the > > > content, and also you don't have to worry about encoding the xml. > > > > > > > > > > > > From: > > > Arun Kumar Boppudi > > > To: > > > Struts Users Mailing List > > > Date: > > > 30-07-2010 13:48 > > > Subject: > > > Re: Reading input stream (xml) > > > > > > > > > > > > Unfortunately, I have to use XML here. So, I cannot use the first > > > suggestion. > > > > > > If I use request.getInputStream, subsequent request.getParameter calls > > > will > > > fail. Will it cause any problems in struts? > > > > > > I would like to give a try to the third one. But not all the action > > > controllers gets XML in the request. So, I may have to list down the > > > controllers which gets the XML content in the request. > > > > > > -- AB > > > > > > > > > On Fri, Jul 30, 2010 at 10:41 AM, Rahul Mohan > wrote: > > > > > > > Think I understand your problem now. AFAIK Struts doesn't have any > > > > available mechanism to handle these. I can suggest the following > > > > solutions: > > > > 1. Create your request body in the way Struts is expecting - > name-value > > > > pairs. > > > > > > > > 2. Extend struts by creating a custom request processor. ( See: > > > > http://onjava.com/pub/a/onjava/2004/11/10/ExtendingStruts.html ). > You > > > will > > > > have to identify the first possible hook and call getInputStream to > > > > extract the info and pass it as a request parameter or invoke a > custom > > > > action since request.getInputStream cannot be called after the > request > > > is > > > > parsed. > > > > > > > > 3. Put a custom servlet-filter in front of the struts controller to > get > > > > the request data and re-pass it as a request parameter to struts. > > > > > > > > I prefer the first approach which is the easiest and does no harm. > > > > > > > > - Rahul > > > > > > > > > > > > > > > > From: > > > > Arun Kumar Boppudi > > > > To: > > > > Struts Users Mailing List > > > > Date: > > > > 30-07-2010 09:49 > > > > Subject: > > > > Re: Reading input stream (xml) > > > > > > > > > > > > > > > > There is no form and I am sending XML content to the action > controller > > > > using > > > > Fiddler. > > > > > > > > And data sent is not in the format of query string. (not in the > format: > > > > paramname=*xml_content*). So, struts may not be mapping it to a > property > > > > in > > > > the form bean. In this case, how can I get the posted XML contents? > > > > > > > > > > > > -- AB > > > > > > > > > > > > On Thu, Jul 29, 2010 at 5:59 PM, Rahul Mohan > > > wrote: > > > > > > > > > Data goes in request body when you are posting a form. Post > requests > > > are > > > > > obviously handled by Struts. So it should work. ( Only you know > that > > > it > > > > is > > > > > XML, for Struts its just another String. ) Please see your log for > any > > > > > exceptions in setting the action form. Also try inspecting your > > > request > > > > > using firebug to see if it is being posted. > > > > > > > > > > > > > > > > > > > > From: > > > > > Arun Kumar Boppudi > > > > > To: > > > > > Struts Users Mailing List > > > > > Date: > > > > > 29-07-2010 14:58 > > > > > Subject: > > > > > Re: Reading input stream (xml) > > > > > > > > > > > > > > > > > > > > I think we should use the query string format to use the string in > > > > action > > > > > form class format. But I am not sending it in the query string > format. > > > > And > > > > > I > > > > > am not using multipart encoding. Just sending the XML content in > POST > > > > > body. > > > > > > > > > > -- AB > > > > > > > > > > > > > > > On Thu, Jul 29, 2010 at 2:38 PM, Rahul Mohan > > > > wrote: > > > > > > > > > > > Arun, > > > > > > > > > > > > Are you doing a POST with multi-part encoding? If so, a solution > > > > > similar > > > > > > to file upload would work for you. If not, then the String in > > > > > action-form > > > > > > approach that I posted earlier should work. > > > > > > > > > > > > - Rahul Mohan > > > > > > > > > > > > > > > > > > > > > > > > From: > > > > > > Arun Kumar Boppudi > > > > > > To: > > > > > > Struts Users Mailing List > > > > > > Date: > > > > > > 29-07-2010 13:34 > > > > > > Subject: > > > > > > Re: Reading input stream (xml) > > > > > > > > > > > > > > > > > > > > > > > > Rahul, > > > > > > > > > > > > I am not sending XML content as part of the query string, only > XML > > > > > content > > > > > > will be sent in the request body. As struts framework uses the > > > > > > getParameter > > > > > > to populate data into the form beans before calling the execute > > > > method, > > > > > we > > > > > > cannot use the request.getInputStream. > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > http://archives.java.sun.com/cgi-bin/wa?A2=ind0106&L=jsp-interest&F=&S=&P=49196 > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > -- AB > > > > > > > > > > > > > > > > > > On Thu, Jul 29, 2010 at 11:01 AM, Rahul Mohan < > rahul.mohan@tcs.com> > > > > > wrote: > > > > > > > > > > > > > Arun, > > > > > > > > > > > > > > You can keep a string property on action form and map it to the > > > xml > > > > > > field > > > > > > > so that the xml content is available here on page submit. In > the > > > > > action > > > > > > > class, then you will be able to get the string and parse it > using > > > > any > > > > > > > available xml parser. I don't think Struts provides any > shortcut > > > for > > > > > > this > > > > > > > requirement. > > > > > > > > > > > > > > - Rahul Mohan > > > > > > > > > > > > > > > > > > > > > > > > > > > > From: > > > > > > > Arun Kumar Boppudi > > > > > > > To: > > > > > > > Struts Users Mailing List > > > > > > > Date: > > > > > > > 29-07-2010 10:32 > > > > > > > Subject: > > > > > > > Re: Reading input stream (xml) > > > > > > > > > > > > > > > > > > > > > > > > > > > > Actually, I am not uploading a file. I am creating XML from the > > > data > > > > > > > entered > > > > > > > into the form and sending it to the action controller in the > POST > > > > > > request > > > > > > > body. In the action controller, I would like to parse the XML. > How > > > > to > > > > > do > > > > > > > it > > > > > > > in Struts 1.3? > > > > > > > > > > > > > > -- Arun Kumar Boppudi > > > > > > > > > > > > > > > > > > > > > On Thu, Jul 29, 2010 at 10:24 AM, Rahul Mohan > > > > > > > > > wrote: > > > > > > > > > > > > > > > Doesn't this link ( > > > > > > http://struts.apache.org/2.0.14/docs/file-upload.html > > > > > > > ) > > > > > > > > help you? > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > From: > > > > > > > > Arun Kumar Boppudi > > > > > > > > To: > > > > > > > > Struts Users Mailing List > > > > > > > > Date: > > > > > > > > 28-07-2010 22:09 > > > > > > > > Subject: > > > > > > > > Reading input stream (xml) > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > If we send XML content in the POST/PUT request to Struts > action > > > > > > > > controller, > > > > > > > > how to read this content in the Action class? > > > > > > > > > > > > > > > > -- AB > > > > > > > > > > > > > > > > > > > > > > > > =====-----=====-----===== > > > > > > > > Notice: The information contained in this e-mail > > > > > > > > message and/or attachments to it may contain > > > > > > > > confidential or privileged information. If you are > > > > > > > > not the intended recipient, any dissemination, use, > > > > > > > > review, distribution, printing or copying of the > > > > > > > > information contained in this e-mail message > > > > > > > > and/or attachments to it are strictly prohibited. If > > > > > > > > you have received this communication in error, > > > > > > > > please notify us by reply e-mail or telephone and > > > > > > > > immediately and permanently delete the message > > > > > > > > and any attachments. Thank you > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > =====-----=====-----===== > > > > > > > Notice: The information contained in this e-mail > > > > > > > message and/or attachments to it may contain > > > > > > > confidential or privileged information. If you are > > > > > > > not the intended recipient, any dissemination, use, > > > > > > > review, distribution, printing or copying of the > > > > > > > information contained in this e-mail message > > > > > > > and/or attachments to it are strictly prohibited. If > > > > > > > you have received this communication in error, > > > > > > > please notify us by reply e-mail or telephone and > > > > > > > immediately and permanently delete the message > > > > > > > and any attachments. Thank you > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > =====-----=====-----===== > > > > > > Notice: The information contained in this e-mail > > > > > > message and/or attachments to it may contain > > > > > > confidential or privileged information. If you are > > > > > > not the intended recipient, any dissemination, use, > > > > > > review, distribution, printing or copying of the > > > > > > information contained in this e-mail message > > > > > > and/or attachments to it are strictly prohibited. If > > > > > > you have received this communication in error, > > > > > > please notify us by reply e-mail or telephone and > > > > > > immediately and permanently delete the message > > > > > > and any attachments. Thank you > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > =====-----=====-----===== > > > > > Notice: The information contained in this e-mail > > > > > message and/or attachments to it may contain > > > > > confidential or privileged information. If you are > > > > > not the intended recipient, any dissemination, use, > > > > > review, distribution, printing or copying of the > > > > > information contained in this e-mail message > > > > > and/or attachments to it are strictly prohibited. If > > > > > you have received this communication in error, > > > > > please notify us by reply e-mail or telephone and > > > > > immediately and permanently delete the message > > > > > and any attachments. Thank you > > > > > > > > > > > > > > > > > > > > > > > > > > > =====-----=====-----===== > > > > Notice: The information contained in this e-mail > > > > message and/or attachments to it may contain > > > > confidential or privileged information. If you are > > > > not the intended recipient, any dissemination, use, > > > > review, distribution, printing or copying of the > > > > information contained in this e-mail message > > > > and/or attachments to it are strictly prohibited. If > > > > you have received this communication in error, > > > > please notify us by reply e-mail or telephone and > > > > immediately and permanently delete the message > > > > and any attachments. Thank you > > > > > > > > > > > > > > > > > > > > > =====-----=====-----===== > > > Notice: The information contained in this e-mail > > > message and/or attachments to it may contain > > > confidential or privileged information. If you are > > > not the intended recipient, any dissemination, use, > > > review, distribution, printing or copying of the > > > information contained in this e-mail message > > > and/or attachments to it are strictly prohibited. If > > > you have received this communication in error, > > > please notify us by reply e-mail or telephone and > > > immediately and permanently delete the message > > > and any attachments. Thank you > > > > > > > > > > > --e0cb4e887865b7e44c048c9f7494--