Package io.milton.servlet
Class SpringAwareMiltonServlet
java.lang.Object
io.milton.servlet.SpringAwareMiltonServlet
- All Implemented Interfaces:
jakarta.servlet.Servlet
MiltonServlet is a thin wrapper around HttpManager. It takes care of initialisation
and delegates requests to the HttpManager
The servlet API is hidden by the Milton API, however you can get access to
the underlying request and response objects from the static request and response
methods which use ThreadLocal variables
This spring aware servlet will load the spring context from a classpath
resource named /applicationContext.xml
It will then load a bean named milton.http.manager which must be of type
HttpManager.
An example applicationContext.xml might look like this
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd">
<bean id="milton.resource.factory" class="com.ettrema.http.fs.FileSystemResourceFactory">
<property name="securityManager" ref="milton.fs.security.manager" />
<property name="maxAgeSeconds" value="3600" />
</bean>
<bean id="milton.fs.security.manager" class="com.ettrema.http.fs.NullSecurityManager" >
<property name="realm" value="aRealm" />
</bean>
<bean id="milton.response.handler" class="io.milton.http.DefaultResponseHandler" />
<bean id="milton.http.manager" class="io.milton.http.HttpManager">
<constructor-arg ref="milton.resource.factory" />
<constructor-arg ref="milton.response.handler" />
</bean>
</beans>
- Author:
- brad
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoiddestroy()static voidjakarta.servlet.ServletConfigvoidinit(jakarta.servlet.ServletConfig config) static jakarta.servlet.http.HttpServletRequestrequest()static jakarta.servlet.http.HttpServletResponseresponse()voidservice(jakarta.servlet.ServletRequest servletRequest, jakarta.servlet.ServletResponse servletResponse)
-
Constructor Details
-
SpringAwareMiltonServlet
public SpringAwareMiltonServlet()
-
-
Method Details
-
request
public static jakarta.servlet.http.HttpServletRequest request() -
response
public static jakarta.servlet.http.HttpServletResponse response() -
forward
-
init
public void init(jakarta.servlet.ServletConfig config) throws jakarta.servlet.ServletException - Specified by:
initin interfacejakarta.servlet.Servlet- Throws:
jakarta.servlet.ServletException
-
service
public void service(jakarta.servlet.ServletRequest servletRequest, jakarta.servlet.ServletResponse servletResponse) throws jakarta.servlet.ServletException, IOException - Specified by:
servicein interfacejakarta.servlet.Servlet- Throws:
jakarta.servlet.ServletExceptionIOException
-
getServletInfo
- Specified by:
getServletInfoin interfacejakarta.servlet.Servlet
-
getServletConfig
public jakarta.servlet.ServletConfig getServletConfig()- Specified by:
getServletConfigin interfacejakarta.servlet.Servlet
-
destroy
public void destroy()- Specified by:
destroyin interfacejakarta.servlet.Servlet
-