public abstract class IlvParameterValidationListener extends Object implements EventListener
validate(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse)
to provide his own validation
logics or override the method of
handleViolation(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse)
to provide customized
violation handling when it is failed or override the method of
getServletParametersHandler(javax.servlet.ServletRequest)
to provide
customized parameter handler.Modifier and Type | Field and Description |
---|---|
static String |
ACTION_NAME
The action name handled by this server action.
|
static String |
ERROR_MESSAGES
The request attribute to store validation error messages
|
Constructor and Description |
---|
IlvParameterValidationListener()
The default construtor.
|
IlvParameterValidationListener(javax.servlet.ServletContext servletContext)
The constructor with the
ServletContext parameter. |
Modifier and Type | Method and Description |
---|---|
boolean |
actionPerformed(IlvServerActionEvent event)
Performs the parameter validation action.
|
protected abstract IlvServletParameterHandler |
getServletParametersHandler(javax.servlet.ServletRequest request)
Gets the parameter handler for the specific request,return null if no is
matched,This method should be implemented by subclasses.
|
protected void |
handleViolation(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response)
Handle violation when a unsecured request is caught,The subclass can
override this method to provide its' own violation handling logics.
|
void |
setParamChecking(javax.servlet.ServletContext servletContext)
Sets the flag of parmater checking.
|
protected boolean |
validate(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response)
Validate whether it is a secured request.
|
public static final String ACTION_NAME
public static final String ERROR_MESSAGES
public IlvParameterValidationListener()
public IlvParameterValidationListener(javax.servlet.ServletContext servletContext)
ServletContext
parameter.servletContext
- The servlet context.public void setParamChecking(javax.servlet.ServletContext servletContext)
public final boolean actionPerformed(IlvServerActionEvent event) throws javax.servlet.ServletException
event
- The server action event.true
if validation is passed, or false
if
failed.javax.servlet.ServletException
protected abstract IlvServletParameterHandler getServletParametersHandler(javax.servlet.ServletRequest request)
protected boolean validate(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
ERROR_MESSAGES
under request
context. Then it can be retrieved by the method of
handleViolation(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse)
request
- HttpServletRequestresponse
- HttpServletResponsetrue
if the request is secured,
false
otherwise.protected void handleViolation(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response) throws IOException
ERROR_MESSAGES
under
request scope.request
- HttpServletRequestresponse
- HttpServletResponseIOException
© Copyright Rogue Wave Software, Inc. 1997, 2018. All Rights Reserved.