Class Butterfly

java.lang.Object
javax.servlet.GenericServlet
javax.servlet.http.HttpServlet
edu.mit.simile.butterfly.Butterfly
All Implemented Interfaces:
Serializable, javax.servlet.Servlet, javax.servlet.ServletConfig

public class Butterfly extends javax.servlet.http.HttpServlet
This is the Butterfly servlet and the main entry point for a Butterfly-powered web application. This servlet is responsible for loading, configuring and wire together the various modules that compose your webapp and then manages the dispatching of requests to the modules that are supposed to handle them.
See Also:
Serialized Form
  • Field Details

  • Constructor Details

    • Butterfly

      public Butterfly()
  • Method Details

    • getTrueHost

      public static String getTrueHost​(javax.servlet.http.HttpServletRequest request)
    • getTrueContextPath

      public static String getTrueContextPath​(javax.servlet.http.HttpServletRequest request, boolean absolute)
    • getTrueRequestURI

      public static String getTrueRequestURI​(javax.servlet.http.HttpServletRequest request, boolean absolute)
    • getFullHost

      public static String getFullHost​(javax.servlet.http.HttpServletRequest request)
    • isGAE

      public static boolean isGAE​(javax.servlet.ServletConfig config)
    • init

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

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

      public void configure()
    • initializeModule

      protected void initializeModule​(String name, Set<String> initialized, Set<String> initializing)
    • service

      public void service​(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response) throws javax.servlet.ServletException, IOException
      Overrides:
      service in class javax.servlet.http.HttpServlet
      Throws:
      javax.servlet.ServletException
      IOException
    • setRoutingCookie

      protected void setRoutingCookie​(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
    • absolutize

      protected File absolutize​(File base, String location)
    • findModulesIn

      protected void findModulesIn​(File f)
    • createModule

      protected ButterflyModule createModule​(String name)
    • wireModules

      protected void wireModules​(org.apache.commons.collections.ExtendedProperties wirings)
    • configureModules

      protected void configureModules()
    • setDependency

      protected void setDependency​(ButterflyModule subj, String dep, ButterflyModule obj)
    • setScriptable

      protected void setScriptable​(ButterflyModule mod, ButterflyScriptableObject scriptable)
    • watch

      protected void watch​(URL script, ButterflyModule module) throws IOException
      Throws:
      IOException
    • delay

      protected void delay​(javax.servlet.http.HttpServletResponse response, String title) throws IOException
      Throws:
      IOException
    • error

      protected void error​(javax.servlet.http.HttpServletResponse response, String title, String msg, Exception e) throws IOException
      Throws:
      IOException
    • setScript

      protected static void setScript​(ButterflyModule mod, URL location, org.mozilla.javascript.Script script)