You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@wicket.apache.org by "Bálint Kriván (Created JIRA)" <ji...@apache.org> on 2012/01/31 16:45:10 UTC
[jira] [Created] (WICKET-4375) Reading body of the request in
AbstractDefaultAjaxBehavior
Reading body of the request in AbstractDefaultAjaxBehavior
----------------------------------------------------------
Key: WICKET-4375
URL: https://issues.apache.org/jira/browse/WICKET-4375
Project: Wicket
Issue Type: Bug
Components: wicket
Affects Versions: 1.5.4
Reporter: Bálint Kriván
If you want to read the body of the request you will get null from 1.5.4 (I've tried 1.5.4 and 1.5-SNAPSHOT). In 1.5.3 it works as expected. I'll upload a quickstart.
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] [Resolved] (WICKET-4375) Reading body of the request in
AbstractDefaultAjaxBehavior
Posted by "Martin Grigorov (Resolved) (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/WICKET-4375?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Martin Grigorov resolved WICKET-4375.
-------------------------------------
Resolution: Not A Problem
Wicket reads the servlet input stream for you. Now you can use Request#getRequestParameters() to read both GET and POST parameters, or #getQueryParameters() to read just GET/query string parameters, or #getPostParameters() to read all POST (coming from the servlet input stream).
Since the input stream is already read it is empty when you try to read it again.
All these methods return an object from which you can read name/value pairs.
> Reading body of the request in AbstractDefaultAjaxBehavior
> ----------------------------------------------------------
>
> Key: WICKET-4375
> URL: https://issues.apache.org/jira/browse/WICKET-4375
> Project: Wicket
> Issue Type: Bug
> Components: wicket
> Affects Versions: 1.5.4
> Reporter: Bálint Kriván
> Labels: ajax, request
> Attachments: myproject.zip
>
>
> If you want to read the body of the request you will get null from 1.5.4 (I've tried 1.5.4 and 1.5-SNAPSHOT). In 1.5.3 it works as expected. I'll upload a quickstart.
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] [Commented] (WICKET-4375) Reading body of the request in
AbstractDefaultAjaxBehavior
Posted by "Martin Grigorov (Commented) (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/WICKET-4375?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13198667#comment-13198667 ]
Martin Grigorov commented on WICKET-4375:
-----------------------------------------
The reason is that now you can read POST parameters in PageParameters: https://issues.apache.org/jira/browse/WICKET-4338.
Here is a solution for your need:
@Override
protected void respond(final AjaxRequestTarget target) {
HttpServletRequest req = (HttpServletRequest) RequestCycle.get().getRequest().getContainerRequest();
try {
Request request = RequestCycle.get().getRequest();
IRequestParameters requestParameters = request.getPostParameters();
for (String paramName : requestParameters.getParameterNames())
{
List<StringValue> parameterValues = requestParameters.getParameterValues(paramName);
for (StringValue value : parameterValues)
{
System.err.println(paramName + " -> " + value);
}
}
BufferedReader in = new BufferedReader(new InputStreamReader(req.getInputStream()));
target.appendJavaScript("alert('" + in.readLine() + "')");
} catch (IOException ex) {
Logger.getLogger(AjaxBehavior.class.getName()).log(Level.SEVERE, null, ex);
}
}
> Reading body of the request in AbstractDefaultAjaxBehavior
> ----------------------------------------------------------
>
> Key: WICKET-4375
> URL: https://issues.apache.org/jira/browse/WICKET-4375
> Project: Wicket
> Issue Type: Bug
> Components: wicket
> Affects Versions: 1.5.4
> Reporter: Bálint Kriván
> Labels: ajax, request
> Attachments: myproject.zip
>
>
> If you want to read the body of the request you will get null from 1.5.4 (I've tried 1.5.4 and 1.5-SNAPSHOT). In 1.5.3 it works as expected. I'll upload a quickstart.
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] [Updated] (WICKET-4375) Reading body of the request in
AbstractDefaultAjaxBehavior
Posted by "Bálint Kriván (Updated JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/WICKET-4375?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Bálint Kriván updated WICKET-4375:
----------------------------------
Attachment: myproject.zip
The quickstart project which shows the problem. If you use 1.5.3 when you click the button you'll see an alert with '1.5.3', if you use 1.5.4+ you will see null.
> Reading body of the request in AbstractDefaultAjaxBehavior
> ----------------------------------------------------------
>
> Key: WICKET-4375
> URL: https://issues.apache.org/jira/browse/WICKET-4375
> Project: Wicket
> Issue Type: Bug
> Components: wicket
> Affects Versions: 1.5.4
> Reporter: Bálint Kriván
> Labels: ajax, request
> Attachments: myproject.zip
>
>
> If you want to read the body of the request you will get null from 1.5.4 (I've tried 1.5.4 and 1.5-SNAPSHOT). In 1.5.3 it works as expected. I'll upload a quickstart.
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] [Commented] (WICKET-4375) Reading body of the request in
AbstractDefaultAjaxBehavior
Posted by "Bálint Kriván (Commented JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/WICKET-4375?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13200750#comment-13200750 ]
Bálint Kriván commented on WICKET-4375:
---------------------------------------
So basically now I only can read the request body as the key of the last item of PostParameters?
Is this the expected behavior?
> Reading body of the request in AbstractDefaultAjaxBehavior
> ----------------------------------------------------------
>
> Key: WICKET-4375
> URL: https://issues.apache.org/jira/browse/WICKET-4375
> Project: Wicket
> Issue Type: Bug
> Components: wicket
> Affects Versions: 1.5.4
> Reporter: Bálint Kriván
> Labels: ajax, request
> Attachments: myproject.zip
>
>
> If you want to read the body of the request you will get null from 1.5.4 (I've tried 1.5.4 and 1.5-SNAPSHOT). In 1.5.3 it works as expected. I'll upload a quickstart.
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira