GET/POST mismatch with stateless page/form. 
--------------------------------------------

                 Key: WICKET-2270
                 URL: https://issues.apache.org/jira/browse/WICKET-2270
             Project: Wicket
          Issue Type: Bug
          Components: wicket
    Affects Versions: 1.4-RC2
         Environment: JDK6/OpenSolaris/Jetty
            Reporter: Victor Igumnov


Stateless page constructor is hit on a stateless form POST, as if it was a GET 
request. Basically failing the example below. 

See example..

        public GroupSearchResultsPage(final PageParameters pp) {
                super(pp);
                this.pp = pp;
                // On stateless POST this will get executed and fail here.
                if(pp.getString("search") == null) {
                        throw new RestartAt404Page();
                } else {
                        this.searchName = pp.getString("search");
                }
        }

Here is the fix...

        public GroupSearchResultsPage(final PageParameters pp) {
                super(pp);
                this.pp = pp;
                // Make sure it is a GET request. 
                
if(RequestHandlerUtils.getInstance().getHttpServletRequest().getMethod().equalsIgnoreCase("GET"))
 {
                        if(pp.getString("search") == null) {
                                throw new RestartAt404Page();
                        } else {
                                this.searchName = pp.getString("search");
                        }
                }
        }

See the issue? stateless form POSTs hit the constructor as if it was a GET 
request and fail. 

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to