View Javadoc

    1   package org.codehaus.xfire.spring.remoting;
    2
    3   import javax.servlet.http.HttpServletRequest;
    4   import javax.servlet.http.HttpServletResponse;
    5   import javax.xml.namespace.QName;
    6
    7   import org.codehaus.xfire.XFire;
    8   import org.codehaus.xfire.transport.http.XFireServletController;
    9   import org.springframework.web.servlet.ModelAndView;
    10  import org.springframework.web.servlet.mvc.Controller;
    11
    12  /***
    13   * An adapter for the {@link XFireServletController} so that it conforms to Springs MVC {@link Controller} interface.
    14   *
    15   * @author <a href="mailto:dan@envoisolutions.com">Dan Diephouse</a>
    16   * @author <a href="mailto:poutsma@mac.com">Arjen Poutsma</a>
    17   */
    18  public class XFireServletControllerAdapter
    19          extends XFireServletController
    20          implements Controller
    21  {
    22      private QName serviceName;
    23
    24      /***
    25       * Initializes a new instance of the adapter with the given XFire instance and service name.
    26       *
    27       * @param xfire       the XFire instance
    28       * @param serviceName the name of the service
    29       */
    30      public XFireServletControllerAdapter(XFire xfire, QName serviceName)
    31      {
    32          super(xfire);
    33          this.serviceName = serviceName;
    34      }
    35
    36      protected String getService(HttpServletRequest request)
    37      {
    38          return serviceName.getLocalPart();
    39      }
    40
    41      /***
    42       * Process the incoming SOAP request and create a SOAP response.
    43       *
    44       * @param request  current HTTP request
    45       * @param response current HTTP response
    46       * @return <code>null</code>
    47       * @throws Exception in case of errors
    48       */
    49      public ModelAndView handleRequest(HttpServletRequest request, HttpServletResponse response)
    50              throws Exception
    51      {
    52          doService(request, response);
    53          return null;
    54      }
    55  }