View Javadoc

    1   /*
    2    * Licensed to the Apache Software Foundation (ASF) under one or more
    3    * contributor license agreements.  See the NOTICE file distributed with
    4    * this work for additional information regarding copyright ownership.
    5    * The ASF licenses this file to You under the Apache License, Version 2.0
    6    * (the "License"); you may not use this file except in compliance with
    7    * the License.  You may obtain a copy of the License at
    8    *
    9    *      http://www.apache.org/licenses/LICENSE-2.0
    10   *
    11   * Unless required by applicable law or agreed to in writing, software
    12   * distributed under the License is distributed on an "AS IS" BASIS,
    13   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    14   * See the License for the specific language governing permissions and
    15   * limitations under the License.
    16   */
    17  package org.apache.portals.bridges.struts;
    18
    19  import java.io.IOException;
    20
    21  import javax.servlet.ServletException;
    22  import javax.servlet.http.HttpServletRequest;
    23  import javax.servlet.http.HttpServletResponse;
    24
    25  import org.apache.struts.action.ActionMapping;
    26  import org.apache.struts.action.RequestProcessor;
    27
    28  /***
    29   * PortletRequestProcessor
    30   *
    31   * @author <a href="mailto:ate@douma.nu">Ate Douma</a>
    32   * @version $Id: PortletRequestProcessor.java 517068 2007-03-12 01:44:37Z ate $
    33   */
    34  public class PortletRequestProcessor extends RequestProcessor
    35  {
    36      public PortletRequestProcessor()
    37      {
    38          super();
    39      }
    40
    41      public void process(HttpServletRequest request, HttpServletResponse response)
    42              throws IOException, ServletException
    43      {
    44          if (PortletServlet.isPortletRequest(request))
    45          {
    46              if (!(response instanceof PortletServletResponseWrapper))
    47              {
    48                  response = new PortletServletResponseWrapper(request, response);
    49              }
    50          }
    51          super.process(request, response);
    52      }
    53      protected boolean processRoles(HttpServletRequest request,
    54              HttpServletResponse response, ActionMapping mapping)
    55              throws IOException, ServletException
    56      {
    57          boolean proceed = super.processRoles(request, response, mapping);
    58          if (proceed &&
    59                  PortletServlet.isPortletRequest(request) &&
    60                  ((PortletServlet) super.servlet).performActionRenderRequest(request, response, mapping))
    61          {
    62              return false;
    63          } else
    64              return proceed;
    65      }
    66  }