org.beanlet.rest
Class RestServlet

java.lang.Object
  extended by javax.servlet.GenericServlet
      extended by javax.servlet.http.HttpServlet
          extended by org.beanlet.rest.RestServlet
All Implemented Interfaces:
Serializable, javax.servlet.Servlet, javax.servlet.ServletConfig

public class RestServlet
extends javax.servlet.http.HttpServlet

Add the following configuration to the web application's web.xml file to support restlets.
Not required for Servlet 3.0 containers.

 <web-app>
   ...
   <listener>
     <listener-class>org.beanlet.rest.RequestContextListener<listener-class>
   </listener>
   ...
 </web-app>
 
Restlets are deployed automatically by defining a RestFilter or RestServlet in the web.xml:
 <servlet>
   <servlet-name>Beanlet Rest Servlet</servlet-name>
   <servlet-class>org.beanlet.rest.RestServlet</servlet-class>
   <init-param>
     <param-name>om.sun.jersey.config.property.packages</param-name>
     <param-value>com.acme</param-value>
   </init-param>
   <load-on-startup>1</load-on-startup>
 </servlet>

 <servlet-mapping>
   <servlet-name>Beanlet Rest Servlet</servlet-name>
   <url-pattern>/*</url-pattern>
 </servlet-mapping>  
 

See Also:
Serialized Form

Constructor Summary
RestServlet()
           
 
Method Summary
 void destroy()
           
 String getInitParameter(String s)
           
 Enumeration<String> getInitParameterNames()
           
 javax.servlet.ServletConfig getServletConfig()
           
 javax.servlet.ServletContext getServletContext()
           
 String getServletInfo()
           
 String getServletName()
           
 void init()
           
 void init(javax.servlet.ServletConfig servletConfig)
           
 void log(String s)
           
 void log(String s, Throwable throwable)
           
 void service(javax.servlet.ServletRequest servletRequest, javax.servlet.ServletResponse servletResponse)
           
 
Methods inherited from class javax.servlet.http.HttpServlet
doDelete, doGet, doHead, doOptions, doPost, doPut, doTrace, getLastModified, service
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

RestServlet

public RestServlet()
Method Detail

getServletName

public String getServletName()
Specified by:
getServletName in interface javax.servlet.ServletConfig
Overrides:
getServletName in class javax.servlet.GenericServlet

service

public void service(javax.servlet.ServletRequest servletRequest,
                    javax.servlet.ServletResponse servletResponse)
             throws javax.servlet.ServletException,
                    IOException
Specified by:
service in interface javax.servlet.Servlet
Overrides:
service in class javax.servlet.http.HttpServlet
Throws:
javax.servlet.ServletException
IOException

destroy

public void destroy()
Specified by:
destroy in interface javax.servlet.Servlet
Overrides:
destroy in class javax.servlet.GenericServlet

getInitParameter

public String getInitParameter(String s)
Specified by:
getInitParameter in interface javax.servlet.ServletConfig
Overrides:
getInitParameter in class javax.servlet.GenericServlet

getInitParameterNames

public Enumeration<String> getInitParameterNames()
Specified by:
getInitParameterNames in interface javax.servlet.ServletConfig
Overrides:
getInitParameterNames in class javax.servlet.GenericServlet

getServletConfig

public javax.servlet.ServletConfig getServletConfig()
Specified by:
getServletConfig in interface javax.servlet.Servlet
Overrides:
getServletConfig in class javax.servlet.GenericServlet

getServletContext

public javax.servlet.ServletContext getServletContext()
Specified by:
getServletContext in interface javax.servlet.ServletConfig
Overrides:
getServletContext in class javax.servlet.GenericServlet

getServletInfo

public String getServletInfo()
Specified by:
getServletInfo in interface javax.servlet.Servlet
Overrides:
getServletInfo in class javax.servlet.GenericServlet

init

public void init(javax.servlet.ServletConfig servletConfig)
          throws javax.servlet.ServletException
Specified by:
init in interface javax.servlet.Servlet
Overrides:
init in class javax.servlet.GenericServlet
Throws:
javax.servlet.ServletException

init

public void init()
          throws javax.servlet.ServletException
Overrides:
init in class javax.servlet.GenericServlet
Throws:
javax.servlet.ServletException

log

public void log(String s)
Overrides:
log in class javax.servlet.GenericServlet

log

public void log(String s,
                Throwable throwable)
Overrides:
log in class javax.servlet.GenericServlet


Copyright © 2006-2012. All Rights Reserved.