Hi Sebastien,

The problem is that Request#getQueryParameters() is about - parameters in
the query string.
And "/mypage/${param}" uses parameter in the path.
Both of these are GET parameters but they are different.

To get the correct values you should use something like:

IRequestHandler handler = application.getRootRequestMapper().map(request);
if (handler instance of IPageClassRequestHandler) {
  // cast and
use 
org.apache.wicket.core.request.handler.IPageClassRequestHandler#getPageParameters
}

You see this is much more time consuming operation than parsing the query
string parameters from a String (the url).
Maybe this should be the default, maybe not. I am not sure.

You can also make use
of org.apache.wicket.request.cycle.PageRequestHandlerTracker#getFirstHandler()
to skip the resolution of the IRequestMapper.

Martin Grigorov
Wicket Training and Consulting
https://twitter.com/mtgrigorov

On Wed, Nov 18, 2015 at 3:49 PM, Sebastien <seb...@gmail.com> wrote:

> Hi,
>
> I have a little concerns about PageParameters and mounted pages.
>
> On a first case - mypage?param=myvalue - I can retrieve param from both
> page-parameters and from Request#getQueryParameters()
>
> On a second case - mypage/myvalue (with a mounted page /mypage/${param}) -
> I am able to retrieve param only from page-parameters, but not from the
> request cycle (Request#getQueryParameters())
>
> Is it intended?
>
> I saw a previous thread on a similar topic, which suggests to parse
> requestCycle.getRequest().getUrl() but it looks a little bit weird to me
> and I was wondering if there is no other (built-in) feature...
>
> My context is the following: I am trying to secure a mounted page like this
> (this is currently just a POC...)
>
> @OACCAuthorizeInstantiation(resource = "${myparam}", permission = "VIEW")
>
> In OACCAuthorizationStrategy#isInstantiationAuthorized(Class<T>
> componentClass), I have access to the component class type, not the
> component/page instance so I cannot call #getPageParameters anyhow...
>
>
> Many thanks in advance,
> Sebastien
>

Reply via email to