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
Main entry point for applications.
Overrides the CocoonServlet to add some initialization.
Overrides the CocoonServlet to add some initialization.
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final recordInformations about the maintenance status when forcedstatic enumThe maintenance status of Ametysstatic enumThe run modes -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StringThe default ametys home path (relative to the servlet context)static final StringName of the servlet initialization parameter for the ametys home propertystatic final StringThe cocoon.xconf URLstatic final StringThe config file namestatic final StringConstant for storing the servlet context URL in the Avalon contextstatic final StringConstant for storing theServletConfigin the Avalon contextstatic final intDefault max upload size (10 Mb)static final StringThe optional location (relative to application context) of the file that configures the list of plugins/workspaces/kernel to get somewhere elsestatic final StringFile name in the administrator folder of the ametys homestatic final StringThe maintenance file name -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoiddestroy()static booleandoMigrationAndInit(PluginsComponentManager pluginCM) Init migration and pluginsstatic StringGet the instance identifierGet the current maintenance statusWhen maintenance status is forced, this comment may explains whystatic RuntimeServlet.RunModeGet the run modevoidinit()voidRestart cocoonfinal voidservice(HttpServletRequest req, HttpServletResponse res) static voidsetMaintenanceStatus(RuntimeServlet.MaintenanceStatus maintenanceStatus, RuntimeServlet.ForcedMainteanceInformations forcedMainteanceInformations) Set the maintenance statusstatic voidSet the run modeMethods 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
-
CONTEXT_SERVLET_CONFIG
Constant for storing theServletConfigin the Avalon context- See Also:
-
CONTEXT_CONTEXT_ROOT
Constant for storing the servlet context URL in the Avalon context- See Also:
-
COCOON_CONF_URL
The cocoon.xconf URL- See Also:
-
DEFAULT_MAX_UPLOAD_SIZE
Default max upload size (10 Mb)- See Also:
-
MAINTENANCE_FILENAME
The maintenance file name- See Also:
-
CONFIG_FILE_NAME
The config file name- See Also:
-
AMETYS_HOME_PROPERTY
Name of the servlet initialization parameter for the ametys home property- See Also:
-
AMETYS_HOME_DEFAULT
The default ametys home path (relative to the servlet context)- See Also:
-
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:
-
INSTANCE_FILENAME
File name in the administrator folder of the ametys home- See Also:
-
-
Constructor Details
-
RuntimeServlet
public RuntimeServlet()
-
-
Method Details
-
init
- Overrides:
initin classGenericServlet- Throws:
ServletException
-
getInstanceId
Get the instance identifier- Returns:
- The UUID of the Ametys instance or null if the id could not be generated at startup
- Throws:
IllegalStateException- If the file cannot be read
-
doMigrationAndInit
Init migration and plugins- Parameters:
pluginCM- Plugins Component Manager- Returns:
- true if a server restart is required
- Throws:
Exception- Something went wrong
-
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
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 already forced.
-
setMaintenanceStatus
public static void setMaintenanceStatus(RuntimeServlet.MaintenanceStatus maintenanceStatus, RuntimeServlet.ForcedMainteanceInformations forcedMainteanceInformations) Set the maintenance status- Parameters:
maintenanceStatus- The new maintenance status. Cannot be null.forcedMainteanceInformations- The informations if the mode is FORCED. Can be null.
-
getMaintenanceStatus
Get the current maintenance status- Returns:
- The maintenance status
-
getMaintenanceStatusForcedInformations
When maintenance status is forced, this comment may explains why- Returns:
- The comment. Can be null even in forced mode.
-
setRunMode
Set the run mode- Parameters:
mode- the running mode
-
getRunMode
Get the run mode- Returns:
- the current run mode
-