Package com.oorian

Class ApplicationDefaults

java.lang.Object
com.oorian.ApplicationDefaults

public class ApplicationDefaults extends Object
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:

  • Method Details

    • getCommunicationMode

      public static CommunicationMode 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:
      true if CSRF protection is enabled, false otherwise.
    • 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:
      true if HTTPS enforcement is enabled, false otherwise.
    • getCookieDefaults

      public static CookieDefaults getCookieDefaults()
      Gets the application-wide secure cookie defaults.
      Returns:
      The cookie defaults configuration, or null if not configured.
    • getAllowedOrigins

      public static Set<String> 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:
      true if 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

      public static boolean isOriginAllowed(String origin)
      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:
      true if the origin is allowed or no restrictions are configured
    • getContentSecurityPolicy

      public static ContentSecurityPolicy getContentSecurityPolicy()
      Gets the application-wide Content Security Policy.
      Returns:
      The Content Security Policy, or null if not configured.
    • isCspReportOnly

      public static boolean isCspReportOnly()
      Checks whether the Content Security Policy is in report-only mode.
      Returns:
      true if report-only mode, false if enforcing.
    • getAuthenticator

      public static OorianAuthenticator getAuthenticator()
      Gets the application-wide authenticator.
      Returns:
      The authenticator, or null if none is configured.
    • getLoginPagePath

      public static String getLoginPagePath()
      Gets the login page path for authentication redirects.
      Returns:
      The login page path, or null if none is configured.
    • getExceptionHandler

      public static ExceptionHandler getExceptionHandler()
      Gets the application-wide exception handler.
      Returns:
      the exception handler, or null if none is set
    • isDevMode

      public static boolean isDevMode()
      Checks whether development mode is enabled.
      Returns:
      true if dev mode is active, false otherwise.
    • getOorianScript

      public static String 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").