You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by "Lawrence, Andrew" <al...@medplus.com> on 2005/04/25 19:21:32 UTC
getRequest().getInputStream()
Hi,
For several reasons, I need to post an xml document from a webpage to a
tapestry page, and have been trying to use XMLHttpRequest objects to do
the work for me, like this: (Yes, IE Specific)
<javascript>
var req = new ActiveXObject("Msxml2.XMLHTTP");
req.onreadystatechange = processReqChange;
req.open("POST", ${URL_TO_LISTENER}, false);
req.setRequestHeader("Content-Type",
"application/x-www-form-urlencoded");
req.send("XML=" + theXML);
</javascript>
This all works, and in the listener can call
IRequestCycle.getRequestContext().getRequest().getParameter("XML") and
retrieve it.
The problem is this: the xml that is sent contains other URLs with query
parameters attached (that is, use of "&"). Before it is posted, those
characters are URLEncoded -- not the whole xml document, just those
values that are URLs. However, when I retrieve them in tapestry, they
are already decoded, which causes the xml parser to fail.
It seemed that the way around this was to use
IRequestCycle.getRequestContext().getRequest().getReader()
or .getInputStream(), but both seem to ALWAYS be null.
Tapestry looks to be doing this for me, as I built a plain old servlet
to do the same thing, and it works as I would expect, (that is, nothing
is decoded and I can parse just fine)
Is there a way to get ahold of a valid Reader or Inputstream from the
request in tapestry? Or some other avenue I haven't discovered yet?
Details: Tapestry 3.0.3, Weblogic 8.1sp4
Thanks in advance.
---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org