Package edu.mit.simile.butterfly
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 Summary
FieldsModifier and TypeFieldDescriptionprotected ButterflyClassLoaderprotected javax.servlet.ServletConfigprotected Exceptionprotected booleanprotected javax.servlet.ServletContextprotected Fileprotected Fileprotected Map<String,Map<String,ButterflyModule>>protected Map<String,ButterflyModule>protected ButterflyMounterprotected org.apache.commons.collections.ExtendedPropertiesprotected edu.mit.simile.butterfly.ButterflyScriptWatcherprotected Timerprotected Filestatic Stringstatic Stringstatic Stringstatic Stringprotected org.mozilla.javascript.ContextFactorystatic Stringstatic Stringstatic Stringstatic Stringstatic Stringstatic Stringstatic Stringstatic Stringprotected static Stringstatic String -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected Fileabsolutize(File base, String location)voidprotected voidprotected ButterflyModulecreateModule(String name)protected voidvoiddestroy()protected voidprotected voidfindModulesIn(File f)static StringgetFullHost(javax.servlet.http.HttpServletRequest request)static StringgetTrueContextPath(javax.servlet.http.HttpServletRequest request, boolean absolute)static StringgetTrueHost(javax.servlet.http.HttpServletRequest request)static StringgetTrueRequestURI(javax.servlet.http.HttpServletRequest request, boolean absolute)voidinit(javax.servlet.ServletConfig config)protected voidstatic booleanisGAE(javax.servlet.ServletConfig config)voidservice(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)protected voidsetDependency(ButterflyModule subj, String dep, ButterflyModule obj)protected voidsetRoutingCookie(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)protected static voidsetScript(ButterflyModule mod, URL location, org.mozilla.javascript.Script script)protected voidsetScriptable(ButterflyModule mod, ButterflyScriptableObject scriptable)protected voidwatch(URL script, ButterflyModule module)protected voidwireModules(org.apache.commons.collections.ExtendedProperties wirings)Methods inherited from class javax.servlet.http.HttpServlet
doDelete, doGet, doHead, doOptions, doPost, doPut, doTrace, getLastModified, serviceMethods inherited from class javax.servlet.GenericServlet
getInitParameter, getInitParameterNames, getServletConfig, getServletContext, getServletInfo, getServletName, init, log, log
-
Field Details
-
HOST_HEADER
- See Also:
- Constant Field Values
-
CONTEXT_HEADER
- See Also:
- Constant Field Values
-
NAME
- See Also:
- Constant Field Values
-
APPENGINE
- See Also:
- Constant Field Values
-
AUTORELOAD
- See Also:
- Constant Field Values
-
HOME
- See Also:
- Constant Field Values
-
ZONE
- See Also:
- Constant Field Values
-
BASE_URL
- See Also:
- Constant Field Values
-
DEFAULT_ZONE
- See Also:
- Constant Field Values
-
DEFAULT_MOUNTPOINT
- See Also:
- Constant Field Values
-
MODULES_IGNORE
- See Also:
- Constant Field Values
-
MODULES_PATH
- See Also:
- Constant Field Values
-
MAIN_ZONE
- See Also:
- Constant Field Values
-
_timer
-
_classLoader
-
_scriptWatcher
protected transient edu.mit.simile.butterfly.ButterflyScriptWatcher _scriptWatcher -
_config
protected transient javax.servlet.ServletConfig _config -
_context
protected transient javax.servlet.ServletContext _context -
_mounter
-
_properties
protected org.apache.commons.collections.ExtendedProperties _properties -
_contextDir
-
_homeDir
-
_webInfDir
-
_configurationException
-
_configured
protected boolean _configured -
contextFactory
protected org.mozilla.javascript.ContextFactory contextFactory -
_modulesByName
-
_modulesByInterface
-
_moduleProperties
-
_created
-
PATH_PROP
- See Also:
- Constant Field Values
-
-
Constructor Details
-
Butterfly
public Butterfly()
-
-
Method Details
-
getTrueHost
-
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
-
isGAE
public static boolean isGAE(javax.servlet.ServletConfig config) -
init
public void init(javax.servlet.ServletConfig config) throws javax.servlet.ServletException- Specified by:
initin interfacejavax.servlet.Servlet- Overrides:
initin classjavax.servlet.GenericServlet- Throws:
javax.servlet.ServletException
-
destroy
public void destroy()- Specified by:
destroyin interfacejavax.servlet.Servlet- Overrides:
destroyin classjavax.servlet.GenericServlet
-
configure
public void configure() -
initializeModule
-
service
public void service(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response) throws javax.servlet.ServletException, IOException- Overrides:
servicein classjavax.servlet.http.HttpServlet- Throws:
javax.servlet.ServletExceptionIOException
-
setRoutingCookie
protected void setRoutingCookie(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response) -
absolutize
-
findModulesIn
-
createModule
-
wireModules
protected void wireModules(org.apache.commons.collections.ExtendedProperties wirings) -
configureModules
protected void configureModules() -
setDependency
-
setScriptable
-
watch
- 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)
-