Package org.webswing.server.base
Class PrimaryUrlHandler
- java.lang.Object
-
- org.webswing.server.base.AbstractUrlHandler
-
- org.webswing.server.base.PrimaryUrlHandler
-
- All Implemented Interfaces:
UrlHandler,org.webswing.server.common.model.meta.ConfigContext,org.webswing.server.services.security.api.SecurityContext,SecuredPathHandler,SecurableService
- Direct Known Subclasses:
GlobalUrlHandler,SwingInstanceManagerImpl
public abstract class PrimaryUrlHandler extends AbstractUrlHandler implements SecuredPathHandler, org.webswing.server.services.security.api.SecurityContext
-
-
Field Summary
Fields Modifier and Type Field Description protected ConfigurationServiceconfigServicestatic StringJAVASCRIPT_NLS_PREFIXprotected SecurityModuleServicesecurityModuleServiceprotected org.webswing.server.common.util.VariableSubstitutorvarSubs
-
Constructor Summary
Constructors Constructor Description PrimaryUrlHandler(UrlHandler parent, SecurityModuleService securityModuleService, ConfigurationService configService)
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description voiddestroy()voiddisable()StringgenerateCsrfToken()org.webswing.server.services.security.api.WebswingSecurityModuleget()StringgetAdminUrl()Returns resolved admin URL form configuration.abstract List<SwingInstanceManager>getApplications()org.webswing.server.common.model.SecuredPathConfiggetConfig()ObjectgetFromSecuritySession(String attributeName)protected org.webswing.server.services.security.api.WebswingSecurityConfiggetSecurityConfig()InstanceManagerStatusgetStatus()org.webswing.server.common.model.SwingConfiggetSwingConfig()Map<String,String>getVariableMap()URLgetWebResource(String resource)voidinit()voidinitConfiguration()booleanisEnabled()booleanisOriginAllowed(String header)booleanisSameOrigin(javax.servlet.http.HttpServletRequest req)booleanisSubPath(String subpath, String path)protected voidkillAll()StringreplaceVariables(String string)FileresolveFile(String name)booleanserve(javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse res)voidsetToSecuritySession(String attributeName, Object value)booleanvalidateCsrfToken(javax.servlet.http.HttpServletRequest req)-
Methods inherited from class org.webswing.server.base.AbstractUrlHandler
checkMasterPermission, checkPermission, checkPermissionLocalOrMaster, getFullPathMapping, getLastModified, getMasterUser, getPath, getPathInfo, getPathMapping, getRootHandler, getSecuredPath, getSecurityProvider, getServletContext, getUser, registerChildUrlHandler, registerFirstChildUrlHandler, removeChildUrlHandler, secureServe, toPath
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.webswing.server.services.security.login.SecuredPathHandler
getPathMapping
-
-
-
-
Field Detail
-
JAVASCRIPT_NLS_PREFIX
public static final String JAVASCRIPT_NLS_PREFIX
- See Also:
- Constant Field Values
-
configService
protected final ConfigurationService configService
-
securityModuleService
protected final SecurityModuleService securityModuleService
-
varSubs
protected org.webswing.server.common.util.VariableSubstitutor varSubs
-
-
Constructor Detail
-
PrimaryUrlHandler
public PrimaryUrlHandler(UrlHandler parent, SecurityModuleService securityModuleService, ConfigurationService configService)
-
-
Method Detail
-
init
public void init()
- Specified by:
initin interfaceUrlHandler- Overrides:
initin classAbstractUrlHandler
-
getApplications
public abstract List<SwingInstanceManager> getApplications()
-
initConfiguration
public void initConfiguration()
- Specified by:
initConfigurationin interfaceSecuredPathHandler
-
disable
public void disable()
-
killAll
protected void killAll()
-
getSecurityConfig
protected org.webswing.server.services.security.api.WebswingSecurityConfig getSecurityConfig()
-
destroy
public void destroy()
- Specified by:
destroyin interfaceUrlHandler- Overrides:
destroyin classAbstractUrlHandler
-
serve
public boolean serve(javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse res) throws org.webswing.server.model.exception.WsException- Specified by:
servein interfaceUrlHandler- Overrides:
servein classAbstractUrlHandler- Throws:
org.webswing.server.model.exception.WsException
-
isSubPath
public boolean isSubPath(String subpath, String path)
- Overrides:
isSubPathin classAbstractUrlHandler
-
getAdminUrl
public String getAdminUrl()
Returns resolved admin URL form configuration. This can be either full or relative URL.
-
isOriginAllowed
public boolean isOriginAllowed(String header)
-
isSameOrigin
public boolean isSameOrigin(javax.servlet.http.HttpServletRequest req)
-
getConfig
public org.webswing.server.common.model.SecuredPathConfig getConfig()
- Specified by:
getConfigin interfaceSecuredPathHandler
-
getSwingConfig
public org.webswing.server.common.model.SwingConfig getSwingConfig()
-
getStatus
public InstanceManagerStatus getStatus()
-
isEnabled
public boolean isEnabled()
- Specified by:
isEnabledin interfaceorg.webswing.server.common.model.meta.ConfigContext- Specified by:
isEnabledin interfaceSecuredPathHandler
-
get
public org.webswing.server.services.security.api.WebswingSecurityModule get()
- Specified by:
getin interfaceSecuredPathHandler
-
resolveFile
public File resolveFile(String name)
- Specified by:
resolveFilein interfaceorg.webswing.server.common.model.meta.ConfigContext
-
getWebResource
public URL getWebResource(String resource)
- Specified by:
getWebResourcein interfaceorg.webswing.server.common.model.meta.ConfigContext
-
generateCsrfToken
public String generateCsrfToken()
-
validateCsrfToken
public boolean validateCsrfToken(javax.servlet.http.HttpServletRequest req)
-
replaceVariables
public String replaceVariables(String string)
- Specified by:
replaceVariablesin interfaceorg.webswing.server.common.model.meta.ConfigContext
-
getFromSecuritySession
public Object getFromSecuritySession(String attributeName)
- Specified by:
getFromSecuritySessionin interfaceorg.webswing.server.services.security.api.SecurityContext
-
-