You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@wicket.apache.org by "Martin Grigorov (Commented) (JIRA)" <ji...@apache.org> on 2012/02/02 11:23:54 UTC

[jira] [Commented] (WICKET-4375) Reading body of the request in AbstractDefaultAjaxBehavior

    [ 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