Package com.oorian
Class ApplicationDefaults
java.lang.Object
com.oorian.ApplicationDefaults
Holds application-wide default settings that can be overridden on individual pages.
This class provides global defaults for settings such as communication mode and poll interval.
These values are used when an HtmlPage's communication mode is set to
CommunicationMode.APP_DEFAULT or its poll interval is set to -1.
Values are set via the corresponding methods in Application:
Application.setDefaultCommunicationMode(CommunicationMode)Application.setDefaultPollInterval(long)Application.setCsrfProtectionEnabled(boolean)Application.setSecurityHeaders(com.oorian.security.SecurityHeaders)Application.setExceptionHandler(ExceptionHandler)Application.setDevMode(boolean)Application.setOorianScript(String)
-
Method Summary
Modifier and TypeMethodDescriptionstatic longReturns the application-wide absolute session timeout in milliseconds.Returns the set of allowed origins for WebSocket connections.static OorianAuthenticatorGets the application-wide authenticator.static CommunicationModeGets the application-wide default communication mode.static ContentSecurityPolicyGets the application-wide Content Security Policy.static CookieDefaultsGets the application-wide secure cookie defaults.static ExceptionHandlerGets the application-wide exception handler.static longReturns the application-wide idle session timeout in milliseconds.static StringGets the login page path for authentication redirects.static intReturns the maximum number of concurrent sessions allowed per user.static intReturns the maximum number of concurrent WebSocket connections allowed per IP address.static intReturns the maximum number of concurrent WebSocket connections allowed per session.static longReturns the maximum request body size in bytes.static intReturns the maximum WebSocket text message size in bytes.static StringGets the application-wide path to the Oorian client-side JavaScript file.static longGets the application-wide default poll interval for AJAX_ONLY mode.static intReturns the maximum number of requests allowed per rate limit window.static longReturns the rate limit time window in milliseconds.static booleanChecks whether the Content Security Policy is in report-only mode.static booleanChecks whether CSRF protection is enabled application-wide.static booleanChecks whether development mode is enabled.static booleanChecks whether HTTPS is required for all requests.static booleanisOriginAllowed(String origin) Checks whether a given origin is allowed for WebSocket connections.static booleanChecks whether WebSocket origin validation is enabled.
-
Method Details
-
getCommunicationMode
Gets the application-wide default communication mode.- Returns:
- The default communication mode.
-
getPollInterval
public static long getPollInterval()Gets the application-wide default poll interval for AJAX_ONLY mode.- Returns:
- The default poll interval in milliseconds (0 = disabled).
-
isCsrfProtectionEnabled
public static boolean isCsrfProtectionEnabled()Checks whether CSRF protection is enabled application-wide.- Returns:
trueif CSRF protection is enabled,falseotherwise.
-
getIdleTimeoutMillis
public static long getIdleTimeoutMillis()Returns the application-wide idle session timeout in milliseconds.- Returns:
- the idle timeout (0 = disabled)
-
getAbsoluteTimeoutMillis
public static long getAbsoluteTimeoutMillis()Returns the application-wide absolute session timeout in milliseconds.- Returns:
- the absolute timeout (0 = disabled)
-
getMaxConcurrentSessions
public static int getMaxConcurrentSessions()Returns the maximum number of concurrent sessions allowed per user.- Returns:
- the maximum concurrent sessions (0 = unlimited)
-
getRateLimitMaxRequests
public static int getRateLimitMaxRequests()Returns the maximum number of requests allowed per rate limit window.- Returns:
- the maximum requests per window (0 = disabled)
-
getRateLimitWindowMillis
public static long getRateLimitWindowMillis()Returns the rate limit time window in milliseconds.- Returns:
- the window duration in milliseconds
-
getMaxConnectionsPerSession
public static int getMaxConnectionsPerSession()Returns the maximum number of concurrent WebSocket connections allowed per session.- Returns:
- the maximum connections per session (0 = unlimited)
-
getMaxConnectionsPerIp
public static int getMaxConnectionsPerIp()Returns the maximum number of concurrent WebSocket connections allowed per IP address.- Returns:
- the maximum connections per IP (0 = unlimited)
-
getMaxRequestBodySize
public static long getMaxRequestBodySize()Returns the maximum request body size in bytes.- Returns:
- the maximum request body size (0 = unlimited)
-
isHttpsRequired
public static boolean isHttpsRequired()Checks whether HTTPS is required for all requests.- Returns:
trueif HTTPS enforcement is enabled,falseotherwise.
-
getCookieDefaults
Gets the application-wide secure cookie defaults.- Returns:
- The cookie defaults configuration, or
nullif not configured.
-
getAllowedOrigins
Returns the set of allowed origins for WebSocket connections.- Returns:
- an unmodifiable set of allowed origin patterns
-
isWebSocketOriginCheckEnabled
public static boolean isWebSocketOriginCheckEnabled()Checks whether WebSocket origin validation is enabled.Origin validation is automatically enabled when at least one allowed origin is configured via
Application.addAllowedOrigin(String).- Returns:
trueif origin validation is enabled
-
getMaxWebSocketMessageSize
public static int getMaxWebSocketMessageSize()Returns the maximum WebSocket text message size in bytes.- Returns:
- the maximum message size (default: 1,000,000 bytes)
-
isOriginAllowed
Checks whether a given origin is allowed for WebSocket connections.If no origins are configured, all origins are allowed. Otherwise the origin is matched against the configured set, supporting wildcard subdomain patterns.
- Parameters:
origin- the origin to check- Returns:
trueif the origin is allowed or no restrictions are configured
-
getContentSecurityPolicy
Gets the application-wide Content Security Policy.- Returns:
- The Content Security Policy, or
nullif not configured.
-
isCspReportOnly
public static boolean isCspReportOnly()Checks whether the Content Security Policy is in report-only mode.- Returns:
trueif report-only mode,falseif enforcing.
-
getAuthenticator
Gets the application-wide authenticator.- Returns:
- The authenticator, or
nullif none is configured.
-
getLoginPagePath
Gets the login page path for authentication redirects.- Returns:
- The login page path, or
nullif none is configured.
-
getExceptionHandler
Gets the application-wide exception handler.- Returns:
- the exception handler, or
nullif none is set
-
isDevMode
public static boolean isDevMode()Checks whether development mode is enabled.- Returns:
trueif dev mode is active,falseotherwise.
-
getOorianScript
Gets the application-wide path to the Oorian client-side JavaScript file.- Returns:
- the path to the Oorian JavaScript file (default:
"/oorian.min.js").
-