On 05/19/2011 01:35 AM, Caleb James DeLisle wrote:
The query string is literally the string which follows
the ? in the url. When you are posting you
are not using the query string but instead you are encoding the data in the body of the
post which
is why it can hold more data.
Instead of using getQueryString() then looking for the pieces of that you can use
getParameter('name') and it will return the value given with that name and you
won't even have to
URL decode it.
getParameter returns a single value for a parameter.
getParameterValues('name') returns all the values sent for a parameter.
This is useful, for example, for <select> elements with multi-select
enabled.
getParameterMap returns a map of all the parameters and their values.
If you want to manually process the POST body, you should use
getInputStream (byte reading) or getReader (character reading, using the
system's default encoding). But it's really better to use getParameter,
which will look both in the POST body and the GET query string.
More information about the request object here:
http://download.oracle.com/javaee/5/api/javax/servlet/http/HttpServletReque…
If you want to handle file uploads, then you should look at the
FileUpload plugin:
https://github.com/xwiki/xwiki-platform/blob/master/xwiki-platform-core/xwi…
On 05/18/2011 05:50 PM, China Sunrise wrote:
> Hi,
> My xwiki 3.0 implementation is using PHP in many pages, and some pages are
> based on simple HTML forms with a "submit" button. In the PHP part, I
> process $request->getQueryString() to check the form fields that were sent.
> It works very well when the form used the GET method, but doesn't work at
> all when the form used the POST method. Doing some research, it looks like
> the getQueryString() method should handle both scenarios but it doesn't, so
> I wonder if there is anything else blocking the POST data at a lower level.
>
> I also did the same test not inside PHP and run into the same issue, so it
> does not look to be PHP-related.
>
> Unfortunately this is becoming critical as GET data size is limited and I
> start running into this limit on some forms, so have to move to POST.
--
Sergiu Dumitriu
http://purl.org/net/sergiu/