You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by kamiseq <ka...@gmail.com> on 2011/11/01 02:07:22 UTC

Re: request parameters

well this is not fixed.
the url will alwyas begin with
*
myapp.com/mypage/val1/val2*

but it may also contain additional keys like

*myapp.com/mypage/val1/val2?key=val* or
*myapp.com/mypage/val1/val2?otherkey=val&keykey=val* etc

inside my page im only interested in val1, val2 and depend on those values
I will choose service impl where I want pass all key-val pairs from request.
val1/val2 parameters are not a problem I can easily get them from
PageParameters using get(String) the trouble I have is that PageParameter
object is not built under original request's Map.

pozdrawiam
Paweł Kamiński

kamiseq@gmail.com
pkaminski.prv@gmail.com
______________________



On 31 October 2011 23:54, Igor Vaynberg <ig...@gmail.com> wrote:
> under what key should ${param1}/${param2} be stored?
>
> -igor
>
> On Mon, Oct 31, 2011 at 3:30 PM, kamiseq <ka...@gmail.com> wrote:
>> hej,
>> I need to obtain request parameters as Map like I would if I had
>> access to HttpServletRequest but with PageParameters I can't find a
>> way to do it
>>
>> I have mounted page with pattern : /mypage/${param1}/${param2}
>>
>> so every time I get request to myapp.com/mypage/val1/val2?key=val I
>> would like to get map of these parameters and pass it to service that
>> do not know anything about Page or PageParameters, on the other hand
>> page don know which parameter service is interested in.
>> how I can solve this problem?
>>
>> thanks
>>
>> pozdrawiam
>> Paweł Kamiński
>>
>> kamiseq@gmail.com
>> pkaminski.prv@gmail.com
>> ______________________
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>> For additional commands, e-mail: users-help@wicket.apache.org
>>
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>

Re: request parameters

Posted by kamiseq <ka...@gmail.com>.
I understand you mean something like this

final StringValue val1 = parameters.get("val1");
final Service service = ServiceFactory.getClient(val1);

final IRequestParameters requestParameters =
getRequest().getQueryParameters();
final Set<String> parameterNames = requestParameters.getParameterNames();
Map<String, String> params = new HashMap<String,
String>(parameterNames.size());
for (String name : parameterNames)
{
    final StringValue val = requestParameters.getParameterValue(name);
    params.put(name, val.toString());
}
service.handle(params);

giving it a second thought I could use

final List<PageParameters.NamedPair> named = parameters.getAllNamed();

pozdrawiam
Paweł Kamiński

kamiseq@gmail.com
pkaminski.prv@gmail.com
______________________

Re: request parameters

Posted by Igor Vaynberg <ig...@gmail.com>.
getRequest().getQueryParameters() will get you the query string params

-igor

On Mon, Oct 31, 2011 at 6:07 PM, kamiseq <ka...@gmail.com> wrote:
> well this is not fixed.
> the url will alwyas begin with
> *
> myapp.com/mypage/val1/val2*
>
> but it may also contain additional keys like
>
> *myapp.com/mypage/val1/val2?key=val* or
> *myapp.com/mypage/val1/val2?otherkey=val&keykey=val* etc
>
> inside my page im only interested in val1, val2 and depend on those values
> I will choose service impl where I want pass all key-val pairs from request.
> val1/val2 parameters are not a problem I can easily get them from
> PageParameters using get(String) the trouble I have is that PageParameter
> object is not built under original request's Map.
>
> pozdrawiam
> Paweł Kamiński
>
> kamiseq@gmail.com
> pkaminski.prv@gmail.com
> ______________________
>
>
>
> On 31 October 2011 23:54, Igor Vaynberg <ig...@gmail.com> wrote:
>> under what key should ${param1}/${param2} be stored?
>>
>> -igor
>>
>> On Mon, Oct 31, 2011 at 3:30 PM, kamiseq <ka...@gmail.com> wrote:
>>> hej,
>>> I need to obtain request parameters as Map like I would if I had
>>> access to HttpServletRequest but with PageParameters I can't find a
>>> way to do it
>>>
>>> I have mounted page with pattern : /mypage/${param1}/${param2}
>>>
>>> so every time I get request to myapp.com/mypage/val1/val2?key=val I
>>> would like to get map of these parameters and pass it to service that
>>> do not know anything about Page or PageParameters, on the other hand
>>> page don know which parameter service is interested in.
>>> how I can solve this problem?
>>>
>>> thanks
>>>
>>> pozdrawiam
>>> Paweł Kamiński
>>>
>>> kamiseq@gmail.com
>>> pkaminski.prv@gmail.com
>>> ______________________
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>
>>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>> For additional commands, e-mail: users-help@wicket.apache.org
>>
>>
>

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