public static void removeAllApplicationServletPathMappings () { getInstance ().m_aStateMap.forEachValue (PhotonGlobalStatePerApp::removeServletPath); }
public static boolean containsNoState () { return getInstance ().m_aStateMap.isEmpty (); }
public static void clear () { final PhotonGlobalState aGlobalState = getInstance (); aGlobalState.m_aStateMap.clear (); aGlobalState.setDefaultApplicationID (null); }
public static boolean containsAnyApplicationServletPathMapping () { return getInstance ().m_aStateMap.containsAnyValue (x -> x.internalGetServletPath () != null); }
@Nonnull public static PhotonGlobalStatePerApp state (@Nonnull @Nonempty final String sAppID) { ValueEnforcer.notEmpty (sAppID, "AppID"); final PhotonGlobalState aGlobalState = getInstance (); return aGlobalState.m_aStateMap.computeIfAbsent (sAppID, k -> { // By default set first app ID as default if (!aGlobalState.hasDefaultApplicationID ()) aGlobalState.setDefaultApplicationID (sAppID); return new PhotonGlobalStatePerApp (); }); }
@Nonnull @ReturnsMutableCopy public static ICommonsMap <String, String> getAppIDToServletPathMap () { final ICommonsMap <String, String> ret = new CommonsHashMap <> (); getInstance ().m_aStateMap.forEach ( (sAppID, aState) -> ret.put (sAppID, aState.getServletPath ())); return ret; } }
@Nullable private static String _getApplicationIDOrNull (@Nonnull final IRequestWebScopeWithoutResponse aRequestScope) { String sAppID = aRequestScope.attrs ().getCastedValue (REQUEST_ATTR_APP_ID); if (StringHelper.hasNoText (sAppID)) { // Fallback to last saved state from session final PhotonSessionState aPSS = PhotonSessionState.getInstanceIfInstantiated (); if (aPSS != null) sAppID = aPSS.getLastApplicationID (); // None in request nor session -> fall back to default if (StringHelper.hasNoText (sAppID)) sAppID = PhotonGlobalState.getInstance ().getDefaultApplicationID (); } return sAppID; }
sAppID = aSessionState.getLastApplicationID (); if (StringHelper.hasNoText (sAppID)) sAppID = PhotonGlobalState.getInstance ().getDefaultApplicationID ();
PhotonGlobalState.state (CApplicationID.APP_ID_SECURE) .setServletPath (AbstractSecureApplicationServlet.SERVLET_DEFAULT_PATH); PhotonGlobalState.getInstance ().setDefaultApplicationID (CApplicationID.APP_ID_PUBLIC);