Class WebAppMain
- All Implemented Interfaces:
jakarta.servlet.ServletContextListener
,EventListener
- Author:
- Kohsuke Kawaguchi
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic class
Add some metadata to a File, allowing to trace setup issues -
Field Summary
Modifier and TypeFieldDescriptionstatic final String
System property name to force the session tracking by cookie. -
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
contextDestroyed
(jakarta.servlet.ServletContextEvent event) void
contextInitialized
(jakarta.servlet.ServletContextEvent event) Creates the sole instance ofJenkins
and register it to theServletContext
.static int
This getter returns the int DEFAULT_RING_BUFFER_SIZE from the class RingBufferLogHandler from a static context.getHomeDir
(jakarta.servlet.ServletContextEvent event) Determines the home directory for Jenkins.static void
installExpressionFactory
(jakarta.servlet.ServletContextEvent event) static void
installExpressionFactory
(javax.servlet.ServletContextEvent event) Deprecated.void
joinInit()
-
Field Details
-
FORCE_SESSION_TRACKING_BY_COOKIE_PROP
@Restricted(org.kohsuke.accmod.restrictions.NoExternalUse.class) public static final String FORCE_SESSION_TRACKING_BY_COOKIE_PROPSystem property name to force the session tracking by cookie. This prevents Tomcat to use the URL tracking in addition to the cookie by default. This could be useful for instances that requires to have theSuspiciousRequestFilter.allowSemicolonsInPath
turned off.If you allow semicolon in URL and the session to be tracked by URL and you have a SecurityRealm that does not invalidate session after authentication, your instance is vulnerable to session hijacking.
The SecurityRealm should be corrected but this is a hardening in Jenkins core.
As this property is read during startup, you will not be able to change it at runtime depending on your application server (not possible with Jetty nor Tomcat)
When running hpi:run, the default tracking is COOKIE+URL. When running java -jar with Winstone/Jetty, the default setting is set to COOKIE only. When running inside Tomcat, the default setting is COOKIE+URL.
-
-
Constructor Details
-
WebAppMain
public WebAppMain()
-
-
Method Details
-
getDefaultRingBufferSize
public static int getDefaultRingBufferSize()This getter returns the int DEFAULT_RING_BUFFER_SIZE from the class RingBufferLogHandler from a static context. Exposes access from RingBufferLogHandler.DEFAULT_RING_BUFFER_SIZE to WebAppMain. Written for the requirements of JENKINS-50669- Returns:
- int This returns DEFAULT_RING_BUFFER_SIZE
- Since:
- 2.259
- See Also:
-
contextInitialized
public void contextInitialized(jakarta.servlet.ServletContextEvent event) Creates the sole instance ofJenkins
and register it to theServletContext
.- Specified by:
contextInitialized
in interfacejakarta.servlet.ServletContextListener
-
joinInit
- Throws:
InterruptedException
-
installExpressionFactory
public static void installExpressionFactory(jakarta.servlet.ServletContextEvent event) - Since:
- 2.475
-
installExpressionFactory
Deprecated. -
getHomeDir
Determines the home directory for Jenkins.We look for a setting that affects the smallest scope first, then bigger ones later.
People make configuration mistakes, so we are trying to be nice with those by doing
String.trim()
.- Returns:
- the File alongside with some description to help the user troubleshoot issues
-
contextDestroyed
public void contextDestroyed(jakarta.servlet.ServletContextEvent event) - Specified by:
contextDestroyed
in interfacejakarta.servlet.ServletContextListener
-
installExpressionFactory(ServletContextEvent)