Package org.ametys.runtime.servlet
Class RuntimeServlet
- java.lang.Object
-
- javax.servlet.GenericServlet
-
- javax.servlet.http.HttpServlet
-
- org.ametys.runtime.servlet.RuntimeServlet
-
- All Implemented Interfaces:
Serializable,Servlet,ServletConfig
public class RuntimeServlet extends HttpServlet
Main entry point for applications.
Overrides the CocoonServlet to add some initialization.- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classRuntimeServlet.RunModeThe run modes
-
Field Summary
Fields Modifier and Type Field Description static StringAMETYS_HOME_DEFAULTThe default ametys home path (relative to the servlet context)static StringAMETYS_HOME_PROPERTYName of the servlet initialization parameter for the ametys home propertystatic StringCOCOON_CONF_URLThe cocoon.xconf URLstatic StringCONFIG_FILE_NAMEThe config file namestatic StringCONTEXT_CONTEXT_ROOTConstant for storing the servlet context URL in the Avalon contextstatic StringCONTEXT_SERVLET_CONFIGConstant for storing theServletConfigin the Avalon contextstatic intDEFAULT_MAX_UPLOAD_SIZEDefault max upload size (10 Mb)static StringEXTERNAL_LOCATIONSThe optional location (relative to application context) of the file that configures the list of plugins/workspaces/kernel to get somewhere else
-
Constructor Summary
Constructors Constructor Description RuntimeServlet()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voiddestroy()static booleandoMigrationAndInit(PluginsComponentManager pluginCM)Init migration and pluginsstatic RuntimeServlet.RunModegetRunMode()Get the run modevoidinit()voidrestartCocoon(HttpServletRequest req)Restart cocoonvoidservice(HttpServletRequest req, HttpServletResponse res)static voidsetRunMode(RuntimeServlet.RunMode mode)Set the run mode-
Methods inherited from class javax.servlet.http.HttpServlet
doDelete, doGet, doHead, doOptions, doPost, doPut, doTrace, getLastModified, service
-
Methods inherited from class javax.servlet.GenericServlet
getInitParameter, getInitParameterNames, getServletConfig, getServletContext, getServletInfo, getServletName, init, log, log
-
-
-
-
Field Detail
-
CONTEXT_SERVLET_CONFIG
public static final String CONTEXT_SERVLET_CONFIG
Constant for storing theServletConfigin the Avalon context- See Also:
- Constant Field Values
-
CONTEXT_CONTEXT_ROOT
public static final String CONTEXT_CONTEXT_ROOT
Constant for storing the servlet context URL in the Avalon context- See Also:
- Constant Field Values
-
COCOON_CONF_URL
public static final String COCOON_CONF_URL
The cocoon.xconf URL- See Also:
- Constant Field Values
-
DEFAULT_MAX_UPLOAD_SIZE
public static final int DEFAULT_MAX_UPLOAD_SIZE
Default max upload size (10 Mb)- See Also:
- Constant Field Values
-
CONFIG_FILE_NAME
public static final String CONFIG_FILE_NAME
The config file name- See Also:
- Constant Field Values
-
AMETYS_HOME_PROPERTY
public static final String AMETYS_HOME_PROPERTY
Name of the servlet initialization parameter for the ametys home property- See Also:
- Constant Field Values
-
AMETYS_HOME_DEFAULT
public static final String AMETYS_HOME_DEFAULT
The default ametys home path (relative to the servlet context)- See Also:
- Constant Field Values
-
EXTERNAL_LOCATIONS
public static final String EXTERNAL_LOCATIONS
The optional location (relative to application context) of the file that configures the list of plugins/workspaces/kernel to get somewhere else- See Also:
- Constant Field Values
-
-
Constructor Detail
-
RuntimeServlet
public RuntimeServlet()
-
-
Method Detail
-
init
public void init() throws ServletException
- Overrides:
initin classGenericServlet- Throws:
ServletException
-
doMigrationAndInit
public static boolean doMigrationAndInit(PluginsComponentManager pluginCM) throws Exception
Init migration and plugins- Parameters:
pluginCM- Plugins Component Manager- Returns:
- true if a server restart is required
- Throws:
Exception- Something went wrong
-
destroy
public void destroy()
- Specified by:
destroyin interfaceServlet- Overrides:
destroyin classGenericServlet
-
service
public final void service(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException
- Overrides:
servicein classHttpServlet- Throws:
ServletExceptionIOException
-
restartCocoon
public void restartCocoon(HttpServletRequest req)
Restart cocoon- Parameters:
req- The http servlet request, used to read safeMode and normalMode request attribute if possible. If null, safe mode will be forced only if it was alread forced.
-
setRunMode
public static void setRunMode(RuntimeServlet.RunMode mode)
Set the run mode- Parameters:
mode- the running mode
-
getRunMode
public static RuntimeServlet.RunMode getRunMode()
Get the run mode- Returns:
- the current run mode
-
-