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
Modifier and TypeClassDescriptionstatic final record
Informations about the maintenance status when forcedstatic enum
The maintenance status of Ametysstatic enum
The run modes -
Field Summary
Modifier and TypeFieldDescriptionstatic final String
The default ametys home path (relative to the servlet context)static final String
Name of the servlet initialization parameter for the ametys home propertystatic final String
The cocoon.xconf URLstatic final String
The config file namestatic final String
Constant for storing the servlet context URL in the Avalon contextstatic final String
Constant for storing theServletConfig
in the Avalon contextstatic final int
Default max upload size (10 Mb)static final String
The optional location (relative to application context) of the file that configures the list of plugins/workspaces/kernel to get somewhere elsestatic final String
File name in the administrator folder of the ametys homestatic final String
The maintenance file name -
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
destroy()
static boolean
doMigrationAndInit
(PluginsComponentManager pluginCM) Init migration and pluginsstatic String
Get the instance identifierGet the current maintenance statusWhen maintenance status is forced, this comment may explains whystatic RuntimeServlet.RunMode
Get the run modevoid
init()
void
Restart cocoonfinal void
service
(HttpServletRequest req, HttpServletResponse res) static void
setMaintenanceStatus
(RuntimeServlet.MaintenanceStatus maintenanceStatus, RuntimeServlet.ForcedMainteanceInformations forcedMainteanceInformations) Set the maintenance statusstatic void
Set the run modeMethods 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 Details
-
CONTEXT_SERVLET_CONFIG
Constant for storing theServletConfig
in 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:
init
in 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:
destroy
in interfaceServlet
- Overrides:
destroy
in classGenericServlet
-
service
public final void service(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException - Overrides:
service
in classHttpServlet
- Throws:
ServletException
IOException
-
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
-