View Javadoc

    1   //========================================================================
    2   //$Id: Handler.java,v 1.1 2005/10/05 14:09:21 janb Exp $
    3   //Copyright 2004-2005 Mort Bay Consulting Pty. Ltd.
    4   //------------------------------------------------------------------------
    5   //Licensed under the Apache License, Version 2.0 (the "License");
    6   //you may not use this file except in compliance with the License.
    7   //You may obtain a copy of the License at
    8   //http://www.apache.org/licenses/LICENSE-2.0
    9   //Unless required by applicable law or agreed to in writing, software
    10  //distributed under the License is distributed on an "AS IS" BASIS,
    11  //WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    12  //See the License for the specific language governing permissions and
    13  //limitations under the License.
    14  //========================================================================
    15
    16  package org.mortbay.jetty;
    17
    18  import java.io.IOException;
    19
    20  import javax.servlet.ServletException;
    21  import javax.servlet.http.HttpServletRequest;
    22  import javax.servlet.http.HttpServletResponse;
    23
    24  import org.mortbay.component.LifeCycle;
    25
    26
    27  public interface Handler extends LifeCycle
    28  {
    29      /** Dispatch types */
    30      public static final int DEFAULT=0;
    31      public static final int REQUEST=1;
    32      public static final int FORWARD=2;
    33      public static final int INCLUDE=4;
    34      public static final int ERROR=8;
    35      public static final int ALL=15;
    36
    37
    38      /* ------------------------------------------------------------ */
    39      /** Handle a request.
    40       * @param target The target of the request - either a URI or a name.
    41       * @param request The request either as the {@link Request}
    42       * object or a wrapper of that request. The {@link HttpConnection#getCurrentConnection()}
    43       * method can be used access the Request object if required.
    44       * @param response The response as the {@link Response}
    45       * object or a wrapper of that request. The {@link HttpConnection#getCurrentConnection()}
    46       * method can be used access the Response object if required.
    47       * @param dispatch The dispatch mode: {@link #REQUEST}, {@link #FORWARD}, {@link #INCLUDE}, {@link #ERROR}
    48       * @throws IOException
    49       * @throws ServletException
    50       */
    51      public void handle(String target, HttpServletRequest request, HttpServletResponse response, int dispatch)
    52          throws IOException, ServletException;
    53
    54      public void setServer(Server server);
    55      public Server getServer();
    56
    57      public void destroy();
    58
    59  }
    60