WPS 6.1 and JSR286 compatibility - Websphere

This is a discussion on WPS 6.1 and JSR286 compatibility - Websphere ; I tested the latest wiket snapshot (version 1.4-SNAPSHOT) within websphere portal 6.1. It seems that WPS does not interpret query parameters correctly. Assume you have a portlet which calls: PortletRequestDispatcher rd = getPortletContext().getRequestDispatcher("/myfilter/?param1=value1"); In the filter you should see the ...

+ Reply to Thread
Results 1 to 9 of 9

Thread: WPS 6.1 and JSR286 compatibility

  1. WPS 6.1 and JSR286 compatibility

    I tested the latest wiket snapshot (version 1.4-SNAPSHOT) within websphere portal 6.1. It seems that WPS does not interpret query parameters correctly.

    Assume you have a portlet which calls:

    PortletRequestDispatcher rd = getPortletContext().getRequestDispatcher("/myfilter/?param1=value1");

    In the filter you should see the parameter as request parameter by calling:

    "value1".equals( request.getParameter("param1") )

    I tested it in JBoss 2.7.1-GA and in works, not so in Websphere 6.1 ( WebSphere Platform 6.1 [ND 6.1.0.15 cf150808.12]).


    You can find the expected beaviour desribed in PortletSpec 2.0 (2008-01-11):

    "PLT.19.1.1 Query Strings in Request Dispatcher Paths

    The getRequestDispatcher method of the PortletContext that creates PortletRequestDispatcher objects using path information allows the optional
    attachment of query string information to the path. For example, a Developer may obtain a PortletRequestDispatcher by using the following code:

    String path = "/raisons.jsp?orderno=5";
    PortletRequestDispatcher rd = context.getRequestDispatcher(path);
    rd.include(renderRequest, renderResponse);

    Parameters specified in the query string used to create the PortletRequestDispatcher
    must be aggregated with the portlet render parameters and take precedence over other
    portlet render parameters of the same name passed to the included servlet or JSP. The
    5 parameters associated with a PortletRequestDispatcher are scoped to apply only for
    the duration of the include call."


    Here is the issue I created in apache wicket jira:

    [https://issues.apache.org/jira/browse/WICKET-2078]

    I configured the "com.ibm.ws.webcontainer.invokefilterscompatibility" to "true".
    Do I have to configure something else?
    Should I open a new PMR for that issue?

  2. Re: WPS 6.1 and JSR286 compatibility

    I'd love to see this issue resolved, so please open a PMR. IBM doesn't read these forums as they're too busy responding to open PMRs. :-)

  3. Re: WPS 6.1 and JSR286 compatibility

    If you want to use a PortletRequestDispatcher with javax.servlet.Filter's, you have to be aware of the fact that the PortletRequest used with the dispatcher is not the same as the ServletRequest you get in the doFilter method of your servlet filter. According to the Portlet 2.0 spec (PLT.19.3.2), you should be able to retrieve the current PortletRequest like this from the servlet request in a servlet filter (filtering an rd included JSP or Servlet):
    {code}
    public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException,
    ServletException
    {
    PortletRequest portletRequest = (PortletRequest) request.getAttribute("javax.portlet.request");
    portletRequest.getParameter("param1");
    [...]
    chain.doFilter(request, response);
    }
    {code}
    Or did you use portlet filters?

  4. Re: WPS 6.1 and JSR286 compatibility

    From my point of view your suggestion does not address this issue. I believe the problem is that the IBM implementation treats action and render requests differently. For example when you trigger an action in a test portlet:

    {code}
    public void processAction(ActionRequest request, ActionResponse response) throws PortletException, java.io.IOException {
    String rdInput="/JSR286ParameterRDAction/"+ "?param1=111&param2=222";
    PortletRequestDispatcher rd = getPortletContext().getRequestDispatcher( rdInput );
    rd.include(request,response);
    }
    {code}

    you wont get the parameters in the servlet-filter mapped to "/JSR286ParameterRDAction/*":

    {code}
    public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException,
    ServletException
    {
    int parameterCount=request.getParameterMap().size() ;
    }
    {code}

    the value of "parameterCount" must be 2 in this example, but with WPS 6.1.0.23 it is 0!
    when you do the same from a render request you get the expected result of 2.

    I also tested it with your suggestion:

    {code}
    public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException,
    ServletException
    {
    PortletRequest portletRequest= (PortletRequest) request.getAttribute("javax.portlet.request");
    int parameterCount=portletRequest.getParameterMap().si ze() ;
    }
    {code}
    But it makes no difference (parameterCount is also 0 ), and I think thats (in this case) the correct and expected value but helps nothing to fix this issue:

    [https://issues.apache.org/jira/browse/WICKET-2078]

  5. Re: WPS 6.1 and JSR286 compatibility

    hi it-e-hp,

    I am pretty sure this is the correct way of doing it.
    Perhaps you have missed out on another piece in the puzzle when you tried out my hint.
    An ActionRequest is just not the same as a ServletRequest.
    Hopefully, the attached sample app can convince you. It is
    tested to run on both WebSphere Portal and on WebSphere Application Server
    and it has been verified to work as specified in JSR-286.
    It demonstrates it for action requests as well as for render requests.

  6. Re: WPS 6.1 and JSR286 compatibility

    When running the sample app I provided above, you should be able to observe the following entries in your SystemOut.log:

    [6/23/09 16:56:40:062 CEST] 00000017 SystemOut O ServletFilterRDPortlet.processAction called.
    [6/23/09 16:56:40:093 CEST] 00000017 servlet I com.ibm.ws.webcontainer.servlet.ServletWrapper init SRVE0242I: [ServletFilterRDPortlet_war] [/filterdemo] [SomeActionServlet]: Initialization successful.
    [6/23/09 16:56:40:093 CEST] 00000017 SystemOut O MyServletFilter received 3 portlet request parameters.
    [6/23/09 16:56:40:093 CEST] 00000017 SystemOut O Contents of parameter Map found in portlet request with MyServletFilter:{ / second_param: [0] RyanTest // _wuview: [0] test // wicket:interface: [0] :0:form::IFormSubmitLister:: / }
    [6/23/09 16:56:40:109 CEST] 00000017 SystemOut O SomeActionServlet received 3 portlet request parameters.
    [6/23/09 16:56:40:109 CEST] 00000017 SystemOut O Contents of parameter Map found in portlet request with SomeActionServlet:{ / second_param: [0] RyanTest // _wuview: [0] test // wicket:interface: [0] :0:form::IFormSubmitLister:: / }
    [6/23/09 16:56:40:203 CEST] 00000017 SystemOut O ServletFilterRDPortlet.doView called.
    [6/23/09 16:56:40:234 CEST] 00000017 SystemOut O MyServletFilter received 3 portlet request parameters.
    [6/23/09 16:56:40:234 CEST] 00000017 SystemOut O Contents of parameter Map found in portlet request with MyServletFilter:{ / second_param: [0] RyanTest // _wuview: [0] test // wicket:interface: [0] :0:form::IFormSubmitLister:: / }

    (log obtained in this case on WAS 7.0.0.3, but analog for WebSphere Portal 6.1)

  7. Re: WPS 6.1 and JSR286 compatibility

    The test jacomac71 provides is correct. But there is indeed a defect in Websphere Portal 6.1 that prevents servlet filters to receive query string parameters passed along with a request dispatcher include in processAction method of a portlet. This issue has been addressed with Portal-APAR PK89838, see http://www.ibm.com/support/fixcentral/ for more information, once it is published.

  8. Re: WPS 6.1 and JSR286 compatibility

    Which version of Portal will APAR PK89838 be applicable to?

    Is that fix already part of 6.1.0.2?

    I'm facing an issue in 6.1.0.1 that is probably caused by this bug and I'm wondering if upgrading to 6.1.0.2 might help solve the problem.

    Regards,
    Luciano Silva

  9. Re: WPS 6.1 and JSR286 compatibility

    It's not a good idea to piggyback an unrelated topic to this thread.

    To answer your question, the APAR is still open. So it is definitely not in 6102.

    -FF

    The postings on this site are my own and do not necessarily represent the positions, strategies or opinions of IBM.

+ Reply to Thread