org.restafarian.core.servlets
Class GenericSpringServlet
java.lang.Object
javax.servlet.GenericServlet
javax.servlet.http.HttpServlet
org.restafarian.core.servlets.GenericSpringServlet
- All Implemented Interfaces:
- java.io.Serializable, javax.servlet.Servlet, javax.servlet.ServletConfig
public class GenericSpringServlet
- extends javax.servlet.http.HttpServlet
Generic servlet class that holds the Spring WebApplicationContext in its
init method. It delegates to another servlet defined in the Spring context
and injected through Spring. A servlet using a delegate should be defined
with scope 'prototype'; otherwise, when the container tries to instantiate
more than one instance of the generic servlet the delegate will still
remain one singleton.
- See Also:
- Serialized Form
|
Method Summary |
void |
init()
Retrieves a servlet bean from the context with the same name that the
generic servlet is configured. |
void |
service(javax.servlet.ServletRequest req,
javax.servlet.ServletResponse res)
just delegate to the "spring" servlet. |
| Methods inherited from class javax.servlet.http.HttpServlet |
doDelete, doGet, doHead, doOptions, doPost, doPut, doTrace, getLastModified, service |
| Methods inherited from class javax.servlet.GenericServlet |
destroy, getInitParameter, getInitParameterNames, getServletConfig, getServletContext, getServletInfo, getServletName, init, log, log |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
GenericSpringServlet
public GenericSpringServlet()
service
public void service(javax.servlet.ServletRequest req,
javax.servlet.ServletResponse res)
throws javax.servlet.ServletException,
java.io.IOException
- just delegate to the "spring" servlet.
- Specified by:
service in interface javax.servlet.Servlet- Overrides:
service in class javax.servlet.http.HttpServlet
- Throws:
javax.servlet.ServletException
java.io.IOException- See Also:
Servlet.service(javax.servlet.ServletRequest,
javax.servlet.ServletResponse)
init
public void init()
throws javax.servlet.ServletException
- Retrieves a servlet bean from the context with the same name that the
generic servlet is configured. If one instance of the generic servlet
is named 'test', a spring bean with id 'test' is searched and used as
delegate.
- Overrides:
init in class javax.servlet.GenericServlet
- Throws:
javax.servlet.ServletException- See Also:
Servlet.init(javax.servlet.ServletConfig)
Copyright © 2008. All Rights Reserved.