You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@wicket.apache.org by "Igor Vaynberg (JIRA)" <ji...@apache.org> on 2010/02/05 03:48:27 UTC

[jira] Assigned: (WICKET-2711) Wicket 1.4.5 + Websphere Portal Express 6.1: query string parameters are not forwarded through WicketPortlet

     [ https://issues.apache.org/jira/browse/WICKET-2711?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Igor Vaynberg reassigned WICKET-2711:
-------------------------------------

    Assignee: Ate Douma

> Wicket 1.4.5 + Websphere Portal Express 6.1: query string parameters are not forwarded through WicketPortlet
> ------------------------------------------------------------------------------------------------------------
>
>                 Key: WICKET-2711
>                 URL: https://issues.apache.org/jira/browse/WICKET-2711
>             Project: Wicket
>          Issue Type: Bug
>          Components: wicket-portlet
>    Affects Versions: 1.4.5
>         Environment: Windows XP SP3 
> jdk1.5.0_15 
> Wicket 1.4.5 
> Spring 2.5.2 
> Websphere Portal Express 6.1
>            Reporter: Uttam Phalnikar
>            Assignee: Ate Douma
>   Original Estimate: 168h
>  Remaining Estimate: 168h
>
> In my application, I am using portlet init parameter "viewPage" to define view page URL with query string parameter. For e.g.
> >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
> 	<portlet>
> 		<description>My Test</description>
> 		<portlet-name>Test</portlet-name>
> 		<display-name>Test</display-name>
> 		<portlet-class>org.apache.wicket.protocol.http.portlet.WicketPortlet</portlet-class>
> 		<init-param>
> 			<name>wicketFilterPath</name>
> 			<value>/test</value>
> 		</init-param>
> 		<init-param>
> 			<name>viewPage</name>
> 			<value>/test?portletid=portlet1</value>
> 		</init-param>
> 		<supports>
> 			<mime-type>*/*</mime-type>
> 			<portlet-mode>VIEW</portlet-mode>
> 		</supports>
> 		<portlet-info>
> 			<title>Test Portlet</title>
> 			<keywords>Wicket</keywords>
> 		</portlet-info>
> 	</portlet>
> <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
> In my web.xml, I have filter mapping that maps "/test/*" to WicketFilter. The home page of my application displays appropriate contents on the basis of "portletid".
> This setup works fine with JBoss Portal 2.7.2, but with Websphere Portal Express 6.1, my home page never gets the "portletid" parameters. 
> After investigation, it was realized that org.apache.wicket.protocol.http.portlet.PortletServletRequestWrapper has logic to obtain the querystring from wrapped request, but doesnt override methods getParameterMap / getParameters & getParameter to convert query string into parameters. I am not very sure whether Websphere Portal Server has any setting to do this conversion. 
> Here is the workaround that I have used
> 1. Created MyServletWebRequest that extends ServletWebRequest 
> >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
> public class MyServletWebRequest extends ServletWebRequest {
>   private Map<String, String[]> paramMap;
>   public MyServletWebRequest(HttpServletRequest httpServletRequest) {
>     super(httpServletRequest);
>     if (httpServletRequest instanceof PortletServletRequestWrapper) {
>       String qs = this.getQueryString();
>       if (StringUtil.hasLength(qs)) {
>         paramMap = new HashMap<String, String[]>();
>         StringTokenizer tokens = new StringTokenizer(qs, "&");
>         while (tokens.hasMoreTokens()) {
>           String tuple = tokens.nextToken();
>           int index = tuple.indexOf("=");
>           if (index != -1) {
>             String key = tuple.substring(0, index);
>             String value = tuple.substring(index + 1);
>             paramMap.put(key, new String[] { value });
>           }
>         }
>       } else {
>         paramMap = Collections.EMPTY_MAP;
>       }
>     }
>   }
>   @Override
>   public Map getParameterMap() {
>     Map<String, String[]> combinedMap =
>       new HashMap<String, String[]>(super.getParameterMap());
>       combinedMap.putAll(paramMap);
>     return combinedMap;
>   }
>   @Override
>   public String getParameter(String key) {
>     if (paramMap.containsKey(key))
>       return paramMap.get(key)[0];
>     return super.getParameter(key);
>   }
>   @Override
>   public String[] getParameters(String key) {
>     if (paramMap.containsKey(key))
>       return paramMap.get(key);
>     return super.getParameters(key);
>   }
> }
> <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
> 2. Then updated the MyWebApplication class (extends WebApplication) to override newWebRequest method
> >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
>   @Override
>   protected WebRequest newWebRequest(HttpServletRequest servletRequest) {
>     return new MyServletWebRequest(servletRequest);
>   }
> <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
> That has solved the issue. 
> I think PortletServletRequestWrapper should override getParameterMap / getParameters & getParameter methods. 

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