public abstract class BaseServlet extends HttpServlet
Modifier and Type | Class and Description |
---|---|
static class |
BaseServlet.PathRefInfo
Simple structure class for returning both a NodeRef and Filename String
|
Modifier and Type | Field and Description |
---|---|
static String |
FACES_SERVLET |
static String |
KEY_ROOT_PATH |
static String |
KEY_STORE |
Constructor and Description |
---|
BaseServlet() |
Modifier and Type | Method and Description |
---|---|
boolean |
checkAccess(HttpServletRequest req,
HttpServletResponse res,
org.alfresco.service.cmr.repository.NodeRef nodeRef,
String permission,
boolean allowLogIn)
Check the user has the given permission on the given node.
|
static ServiceRegistry |
getServiceRegistry(ServletContext sc)
Return the ServiceRegistry helper instance
|
static void |
redirectToLoginPage(HttpServletRequest req,
HttpServletResponse res,
ServletContext sc)
Redirect to the Login page - saving the current URL which can be redirected back later
once the user has successfully completed the authentication process.
|
static void |
redirectToLoginPage(HttpServletRequest req,
HttpServletResponse res,
ServletContext sc,
boolean sendRedirect)
Redirect to the Login page - saving the current URL which can be redirected back later
once the user has successfully completed the authentication process.
|
static BaseServlet.PathRefInfo |
resolveNamePath(ServletContext sc,
String path)
Resolve a name based into a NodeRef and Filename string
|
static org.alfresco.service.cmr.repository.NodeRef |
resolveWebDAVPath(FacesContext context,
String[] args)
Resolves the given path elements to a NodeRef in the current repository
|
static org.alfresco.service.cmr.repository.NodeRef |
resolveWebDAVPath(FacesContext context,
String[] args,
boolean decode)
Resolves the given path elements to a NodeRef in the current repository
|
static org.alfresco.service.cmr.repository.NodeRef |
resolveWebDAVPath(ServletContext context,
String[] args)
Resolves the given path elements to a NodeRef in the current repository
|
static org.alfresco.service.cmr.repository.NodeRef |
resolveWebDAVPath(ServletContext context,
String[] args,
boolean decode)
Resolves the given path elements to a NodeRef in the current repository
|
AuthenticationStatus |
servletAuthenticate(HttpServletRequest req,
HttpServletResponse res)
Perform an authentication for the servlet request URI.
|
AuthenticationStatus |
servletAuthenticate(HttpServletRequest req,
HttpServletResponse res,
boolean redirectToLoginPage)
Perform an authentication for the servlet request URI.
|
static void |
setNoCacheHeaders(HttpServletResponse res)
Apply the headers required to disallow caching of the response in the browser
|
static boolean |
validRedirectJSP(String jsp)
Returns true if the specified JSP file is valid for a redirect after login.
|
doDelete, doGet, doHead, doOptions, doPost, doPut, doTrace, getLastModified, service, service
destroy, getInitParameter, getInitParameterNames, getServletConfig, getServletContext, getServletInfo, getServletName, init, init, log, log
public static final String FACES_SERVLET
public static final String KEY_STORE
public static final String KEY_ROOT_PATH
public static ServiceRegistry getServiceRegistry(ServletContext sc)
sc
- ServletContextpublic AuthenticationStatus servletAuthenticate(HttpServletRequest req, HttpServletResponse res) throws IOException
IOException
public AuthenticationStatus servletAuthenticate(HttpServletRequest req, HttpServletResponse res, boolean redirectToLoginPage) throws IOException
IOException
public boolean checkAccess(HttpServletRequest req, HttpServletResponse res, org.alfresco.service.cmr.repository.NodeRef nodeRef, String permission, boolean allowLogIn) throws IOException, ServletException
req
- the requestres
- the responsenodeRef
- the node in questionallowLogIn
- Indicates whether guest users without access to the node should be redirected to the log in page. If
false
, a status 403 forbidden page is displayed instead.true
, if the user has accessIOException
- Signals that an I/O exception has occurred.ServletException
- On other errorspublic static void redirectToLoginPage(HttpServletRequest req, HttpServletResponse res, ServletContext sc) throws IOException
IOException
public static void redirectToLoginPage(HttpServletRequest req, HttpServletResponse res, ServletContext sc, boolean sendRedirect) throws IOException
sendRedirect
- allow a redirect status code to be set? If false
redirect
will be via markup rather than status code (to allow the status code to be used for handshake
responses etc.IOException
public static void setNoCacheHeaders(HttpServletResponse res)
public static boolean validRedirectJSP(String jsp)
jsp
- Filename of JSP to check, for example "/jsp/browse/browse.jsp"public static org.alfresco.service.cmr.repository.NodeRef resolveWebDAVPath(FacesContext context, String[] args)
context
- Faces contextargs
- The elements of the path to lookuppublic static org.alfresco.service.cmr.repository.NodeRef resolveWebDAVPath(FacesContext context, String[] args, boolean decode)
context
- Faces contextargs
- The elements of the path to lookupdecode
- True to decode the arg from UTF-8 format, false for no decodingpublic static org.alfresco.service.cmr.repository.NodeRef resolveWebDAVPath(ServletContext context, String[] args)
context
- ServletContext contextargs
- The elements of the path to lookuppublic static org.alfresco.service.cmr.repository.NodeRef resolveWebDAVPath(ServletContext context, String[] args, boolean decode)
context
- ServletContext contextargs
- The elements of the path to lookupdecode
- True to decode the arg from UTF-8 format, false for no decodingpublic static final BaseServlet.PathRefInfo resolveNamePath(ServletContext sc, String path)
sc
- ServletContextpath
- 'cm:name' based path using the '/' character as a separatorIllegalArgumentException
Copyright © 2005–2017 Alfresco Software. All rights reserved.