Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
  /*
   * Licensed to the Apache Software Foundation (ASF) under one
   * or more contributor license agreements.  See the NOTICE file
   * distributed with this work for additional information
   * regarding copyright ownership.  The ASF licenses this file
   * to you under the Apache License, Version 2.0 (the
   * "License"); you may not use this file except in compliance
   * with the License.  You may obtain a copy of the License at
   * 
  *   http://www.apache.org/licenses/LICENSE-2.0
  * 
  * Unless required by applicable law or agreed to in writing,
  * software distributed under the License is distributed on an
  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
  * KIND, either express or implied.  See the License for the
  * specific language governing permissions and limitations
  * under the License.    
  */
 package org.apache.tuscany.sca.host.http;
 
 import java.net.URL;
 
 import  javax.servlet.RequestDispatcher;
 import  javax.servlet.Servlet;
 import  javax.servlet.ServletContext;

Interface implemented by host environments that allow Servlets to be registered.

This interface allows a system service to register a Servlet to handle inbound requests.

Version:
$Rev: 980218 $ $Date: 2010-07-28 22:01:41 +0100 (Wed, 28 Jul 2010) $
Tuscany.spi.extension.inheritfrom:
 
 public interface ServletHost {
     
     ServletContext getServletContext();
    
    
Sets the default port for the server.

Parameters:
port the default port
 
     void setDefaultPort(int port);

    
Returns the default port for the server.

Returns:
the default port
 
     int getDefaultPort();
    
    
Add a mapping for an instance of a Servlet. This requests that the Servlet container direct all requests to the designated mapping to the supplied Servlet instance.

Parameters:
uri the URI-mapping for the Servlet
servlet the Servlet that should be invoked
Returns:
The deployed URI
Throws:
ServletMappingException
 
     String addServletMapping(String uri, Servlet servletthrows ServletMappingException;
    
    
Add a mapping for an instance of a Servlet. This requests that the Servlet container direct all requests to the designated mapping to the supplied Servlet instance. SecurityContext can be passed to enable QoS services such as Confidentiality (SSL) and Authentication/Authorization

Parameters:
uri the URI-mapping for the Servlet
servlet the Servlet that should be invoked
securityContext the SecurityContext to enable QoS services
Returns:
The deployed URI
Throws:
ServletMappingException
     
     String addServletMapping(String uri, Servlet servletSecurityContext securityContextthrows ServletMappingException;    

    
Remove a Servlet mapping. This directs the Servlet container not to direct any more requests to a previously registered Servlet.

Parameters:
uri the URI-mapping for the Servlet
Returns:
the Servlet that was registered to the mapping, null if nothing was registered to the mapping
Throws:
ServletMappingException
 
     Servlet removeServletMapping(String urithrows ServletMappingException;

    
Returns the Servlet mapped to the given URI.

Parameters:
uri the URI-mapping for the Servlet
Returns:
the Servlet registered with the mapping
Throws:
ServletMappingException
 
     Servlet getServletMapping(String urithrows ServletMappingException;

    
Returns a Servlet request dispatcher for the Servlet mapped to the specified URI.

Parameters:
uri the URI mapped to a Servlet
Returns:
a RequestDispatcher that can be used to dispatch requests to that Servlet
Throws:
ServletMappingException
    RequestDispatcher getRequestDispatcher(String urithrows ServletMappingException;

    
Returns the portion of the request URI that indicates the context of the request

Returns:
a String specifying the portion of the request URI that indicates the context of the request
    String getContextPath();

    
Sets the portion of the request URI that indicates the context of the request

Parameters:
path the context path
    void setContextPath(String path);

    
Returns the complete URL mapped to the specified URI.

Returns:
the URL mapped to the specified URI
    URL getURLMapping(String uriSecurityContext securityContext);

    
Set an attribute in the application ServletContext

Parameters:
name the name of the attribute
value the attribute value
    void setAttribute(String nameObject value);
    
    
Returns the name that identify the server type (e.g jetty)

Returns:
    String getName();
New to GrepCode? Check out our FAQ X