Class SpringAwareMiltonServlet

java.lang.Object
io.milton.servlet.SpringAwareMiltonServlet
All Implemented Interfaces:
jakarta.servlet.Servlet

public class SpringAwareMiltonServlet extends Object implements 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 Details

    • SpringAwareMiltonServlet

      public SpringAwareMiltonServlet()
  • Method Details

    • request

      public static jakarta.servlet.http.HttpServletRequest request()
    • response

      public static jakarta.servlet.http.HttpServletResponse response()
    • forward

      public static void forward(String url)
    • init

      public void init(jakarta.servlet.ServletConfig config) throws jakarta.servlet.ServletException
      Specified by:
      init in interface jakarta.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:
      service in interface jakarta.servlet.Servlet
      Throws:
      jakarta.servlet.ServletException
      IOException
    • getServletInfo

      public String getServletInfo()
      Specified by:
      getServletInfo in interface jakarta.servlet.Servlet
    • getServletConfig

      public jakarta.servlet.ServletConfig getServletConfig()
      Specified by:
      getServletConfig in interface jakarta.servlet.Servlet
    • destroy

      public void destroy()
      Specified by:
      destroy in interface jakarta.servlet.Servlet