[Laszlo-user] R: R: R: Change in the way lzpostbody works in 3.2?

James Howe openlaszlo at wingspread.imap-mail.com
Tue Mar 28 13:23:13 EST 2006


The thing is, I *do* have an empty string by using getInputStream.  If I  
use the code you gave below, the logger line is never executed because the  
result of reader.readLine() is NULL.  When I dump all the headers and  
parameters, I see the XML data passed as a parameter, not as the body of  
the request.  Just so were all on the same page here, my environment is  
this:

OpenLaszlo 3.2 (Proxied)
Flash 7 (although I also tried Flash 8)
Tomcat 5.5
Windows XP

My URL to invoke the app is:

http://localhost:8380/lps-3.2/app/src/test.lzx?&Compiler.property.url.proxied=true&Compiler.property.url.runtime=swf7

On Tue, 28 Mar 2006 13:05:20 -0500, <luca.rasconi at alice.it> wrote:

> you don't have an empty string by using getInputStream!
> request data contains the  xml
>
> try:
> ServletInputStream in = request.getInputStream();
> BufferedReader reader = new BufferedReader(new InputStreamReader(in));
> String s = "";
> while ( ( s = reader.readLine()) != null ) {
> 	logger.log(Level.INFO, "content: " + s);
> }
>
> i have <ds><foo><bar id="25030"/></foo></ds>
>
> there was a  misunderstanding for me:  i look for lzpostbody within  
> request parameters.
>
> Luca
>
> -----Messaggio originale-----
> Da: James Howe [mailto:openlaszlo at wingspread.imap-mail.com]
> Inviato: mar 28/03/2006 18.13
> A: luca.rasconi at alice.it; Henry Minsky
> Cc: laszlo-user at openlaszlo.org
> Oggetto: Re: R: R: [Laszlo-user] Change in the way lzpostbody works in  
> 3.2?
> In a POST the data *should* be in the request body, if I understand  
> things
> correctly.  In 3.1.1 that's the way things worked.  In 3.2, if I try to
> read the request body using the stream provided by the
> request.getInputStream call, I get an empty string and the XML that was
> sent in the lzpostbody shows up as a strangely named request parameter.
> For example, I do the following to write out the parameters:
>
> for (Enumeration enumx = req.getParameterNames();
> enumx.hasMoreElements();) {
> 	String name = (String) enumx.nextElement();
> 	String parameterValue = (String) req.getParameter(name);
> 	System.out.println("Name: " + name);
> 	System.out.println("Value: " + parameterValue);
> }	
>
> With the XML given below, I see the following output:
>
> Name: <ds><foo><bar
> Value: id="25030"/></foo></ds>
>
> Reading the entire content of the input stream via req.getInputStream()
> yields blank.  This is under Laszlo 3.2.  Under 3.1.1 there are no
> parameter values and the req.getInputStream() produces the expected  
> value.
>
>
> On Tue, 28 Mar 2006 11:04:49 -0500, <luca.rasconi at alice.it> wrote:
>
>> from my back-end app:
>>
>> if i call request.getParameter("lzpostbody") i have null data!!!!
>> if i call
>> ...
>> while ( ( s = reader.readLine()) != null ) {
>> 		write s;
>> }
>> ...
>> where BufferedReader reader = new BufferedReader(new
>> InputStreamReader(request.getInputStream()));
>>
>> s writes <ds><foo><bar id="25030"/></foo></ds>
>>
>> is it correct having data in the request body instead parameter?
>>
>> Luca
>>
>> -----Messaggio originale-----
>> Da: Henry Minsky [mailto:henry.minsky at gmail.com]
>> Inviato: mar 28/03/2006 16.21
>> A: luca.rasconi at alice.it
>> Cc: James Howe; laszlo-user at openlaszlo.org
>> Oggetto: Re: R: [Laszlo-user] Change in the way lzpostbody works in 3.2?
>> Can you send me a zip file or attachment which contains the exact XML
>> data
>> your back-end app is returning?
>>
>>
>> On 3/28/06, luca.rasconi at alice.it <luca.rasconi at alice.it> wrote:
>>>
>>>
>>> but why when i run the application below i have this messages
>>> ERROR: data conversion error for
>>> http://10.172.69.155:8080/my-laszlo-webapp/command?lzpostbody=%CdsNAN.000000%CfooNAN.000000%Cbar
>>> NaNdNAN%22NAN.000000NAN.000000%CNAN.000000fooNAN.000000%CNAN.000000dsNAN.000000:
>>> Parsing XML: only whitespace content allowed before start tag and not n
>>> (position: START_DOCUMENT seen n... @1:1)
>>>
>>>
>>> ???
>>>
>>> seems use GET instead POST
>>>
>>>
>>> -----Messaggio originale-----
>>> Da: laszlo-user-bounces at openlaszlo.org per conto di James Howe
>>> Inviato: mar 28/03/2006 0.00
>>> A: Henry Minsky
>>> Cc: laszlo-user at openlaszlo.org
>>> Oggetto: Re: [Laszlo-user] Change in the way lzpostbody works in 3.2?
>>>
>>> My application is running in proxied mode.
>>>
>>>
>>> On Mon, 27 Mar 2006 16:35:20 -0500, Henry Minsky
>>> <henry.minsky at gmail.com>
>>> wrote:
>>>
>>> > I've seen a couple of reports about the lzpostbody behavior and the
>>> > 3.2release. I am looking at it now.  Note that lzpostbody is only
>>> > supported for proxied data requests, it is not supported for SOLO  
>>> data
>>> > requests at this
>>> > time (this was true in previous releases also, it's not a  
>>> regression).
>>> >
>>> >
>>> >
>>> > On 3/27/06, James Howe <openlaszlo at wingspread.imap-mail.com> wrote:
>>> >>
>>> >> I'm trying to get my application to work under 3.2 and I've run into
>>> a
>>> >> problem with submitting information to my back end server via POST.
>>> >> Take
>>> >> this program, for example:
>>> >>
>>> >> <canvas debug="true">
>>> >>      <dataset name="ds">
>>> >>         <foo><bar id="25030"/></foo>
>>> >>      </dataset>
>>> >>      <dataset name="updater" type="http"/>
>>> >>         <view>
>>> >>                 <button onclick="doit()">Push Me
>>> >>                         <method name="doit">
>>> >>                                 var pointer = ds.getPointer();
>>> >>                                 updater.setSrc("
>>> http://localhost/test/foo
>>> >> ");
>>> >>                                 updater.setHeader("Content-Type",
>>> >> "application/xml");
>>> >>                                 updater.setQueryType("POST");
>>> >>                                 updater.setQueryParam("lzpostbody",
>>> >> pointer.serialize());
>>> >>                                 updater.doRequest();
>>> >>                         </method>
>>> >>                 </button>
>>> >>         </view>
>>> >> </canvas>
>>> >>
>>> >> I have a simple servlet which writes information to a log file based
>>> on
>>> >> the information contained in the request.  When I run this program
>>> under
>>> >> 3.1.1, I get my XML content as the content of the request (I ask the
>>> >> request for the content length and then get an input stream on the
>>> >> request
>>> >> and read the content).  Under 3.1.1, the content information is  
>>> this:
>>> >>
>>> >> Content-Type: application/xml
>>> >> Content-Length: 41
>>> >> Content: <ds><foo><bar>Some Stuff</bar></foo></ds>
>>> >>
>>> >> However, when I run the same application under 3.2, the content is
>>> not
>>> >> retrievable via the input stream for the request, instead, the
>>> content
>>> >> is
>>> >> contained as a parameter value.  My servlet produces the following
>>> >> information for the content:
>>> >>
>>> >> Content-Type: application/x-www-form-urlencoded;charset=UTF-8
>>> >> Content-Length: 37
>>> >> Content:
>>> >>
>>> >> Something obviously changed.  If 3.2 has some improvement which
>>> >> corrects a
>>> >> defect in 3.1.1, I'm happy to make code changes to work with the new
>>> way
>>> >> of doing things.  I've already had to do that with namespaces.
>>> >> Basically
>>> >> what I need to be able to do is execute a POST operation with
>>> arbitrary
>>> >> XML as the posted value.  I'm not posting a form, I'm using a
>>> REST-style
>>> >> interaction where I want to POST some XML which is used to update a
>>> >> resource identified by the URL.
>>> >>
>>> >> Thanks!
>>> >>
>>> >> --
>>> >> James Howe
>>> >> _______________________________________________
>>> >> Laszlo-user mailing list
>>> >> Laszlo-user at openlaszlo.org
>>> >> http://www.openlaszlo.org/mailman/listinfo/laszlo-user
>>> >>
>>> >
>>> >
>>> >
>>> > --
>>> > Henry Minsky
>>> > Software Architect
>>> > hminsky at laszlosystems.com
>>>
>>>
>>>
>>> --
>>> James Howe
>>> _______________________________________________
>>> Laszlo-user mailing list
>>> Laszlo-user at openlaszlo.org
>>> http://www.openlaszlo.org/mailman/listinfo/laszlo-user
>>>
>>>
>>
>>
>> --
>> Henry Minsky
>> Software Architect
>> hminsky at laszlosystems.com
>>
>
>
>



-- 
James Howe


More information about the Laszlo-user mailing list