Re: CustomRequestCycle and post parameters

2012-03-19 Thread Sven Hohage
Hi Martin,
I've removed the getRequestCycleListeners().add(new
AbstractRequestCycleListener() - method in the application class and
tried to print some post-parameters in my Homepage.class:
System.out.println(RequestCycle.get().getRequest().getPostParameters().getParameterValue:
 + 
RequestCycle.get().getRequest().getPostParameters().getParameterValue(user));

But it's always null.
I've checked it with Firebug and also with Wireshark: the parameters are there:
Content-Type: application/x-www-form-urlencoded Content-Length: 84
token=7fb4ddbf9a9d4309e2a739a2ce51af7b3ca01602cc7bd28fe351f80d4986b3b0user=willy

-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



Re: CustomRequestCycle and post parameters

2012-03-19 Thread Martin Grigorov
Hi Sven,

This is strange.
Can you attach a mini app (a quickstart) that demonstrates the problem ?

On Mon, Mar 19, 2012 at 12:16 PM, Sven Hohage
sven.hoh...@googlemail.com wrote:
 Hi Martin,
 I've removed the getRequestCycleListeners().add(new
 AbstractRequestCycleListener() - method in the application class and
 tried to print some post-parameters in my Homepage.class:
 System.out.println(RequestCycle.get().getRequest().getPostParameters().getParameterValue:
  + 
 RequestCycle.get().getRequest().getPostParameters().getParameterValue(user));

 But it's always null.
 I've checked it with Firebug and also with Wireshark: the parameters are 
 there:
 Content-Type: application/x-www-form-urlencoded Content-Length: 84
 token=7fb4ddbf9a9d4309e2a739a2ce51af7b3ca01602cc7bd28fe351f80d4986b3b0user=willy

 -
 To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
 For additional commands, e-mail: users-h...@wicket.apache.org




-- 
Martin Grigorov
jWeekend
Training, Consulting, Development
http://jWeekend.com

-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



Re: CustomRequestCycle and post parameters

2012-03-16 Thread Martin Grigorov
Hi,

Which version of Wicket ?

try with getRequest().getPostParameters()

On Fri, Mar 16, 2012 at 12:28 PM, Sven Hohage
sven.hoh...@googlemail.com wrote:
 I try to read some form-encoded post parameters in my CustomRequestCycle.
 Unfortunately the value is always null.
 Does someone know why this happens and how to solve my problem?
 Kind regards.

 Excerpt:

 public CustomRequestCycle(final WebApplication application, final
 WebRequest request, final Response response) {
                super(application, request, response);
                Map params = request.getHttpServletRequest().getParameterMap();
                String user = (String) params.get(user);
 .

 -
 To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
 For additional commands, e-mail: users-h...@wicket.apache.org




-- 
Martin Grigorov
jWeekend
Training, Consulting, Development
http://jWeekend.com

-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



Re: CustomRequestCycle and post parameters

2012-03-16 Thread Sven Hohage
I've changed to 1.5 to implement your advice.

My actual try is (inside application-init()):

getRequestCycleListeners().add(new AbstractRequestCycleListener() {

@Override
public void onBeginRequest(RequestCycle rc) {
StringValue uservalue =
rc.get().getRequest().getPostParameters().getParameterValue(user);
StringValue tokenvalue =
rc.get().getRequest().getPostParameters().getParameterValue(token);
if (tokenvalue != null  uservalue != null) {

SecurityHandler.tokenLogin(uservalue.toString(), tokenvalue.toString());
}
}


Unfortunately I always got null.

-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



Re: CustomRequestCycle and post parameters

2012-03-16 Thread Martin Grigorov
Why in #onBeginRequest() ?
This way your code will be called for every request. I guess this
logic should be invoked only after submittion of a Form with POST
method. Or if you use some kind of http client to make the requests to
your page.

On Fri, Mar 16, 2012 at 3:10 PM, Sven Hohage sven.hoh...@googlemail.com wrote:
 I've changed to 1.5 to implement your advice.

 My actual try is (inside application-init()):

 getRequestCycleListeners().add(new AbstractRequestCycleListener() {

                        @Override
                        public void onBeginRequest(RequestCycle rc) {
                                StringValue uservalue =
 rc.get().getRequest().getPostParameters().getParameterValue(user);
                                StringValue tokenvalue =
 rc.get().getRequest().getPostParameters().getParameterValue(token);
                                if (tokenvalue != null  uservalue != null) {
                                        
 SecurityHandler.tokenLogin(uservalue.toString(), tokenvalue.toString());
                                }
                        }


 Unfortunately I always got null.

 -
 To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
 For additional commands, e-mail: users-h...@wicket.apache.org




-- 
Martin Grigorov
jWeekend
Training, Consulting, Development
http://jWeekend.com

-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org