Class GenericFilter
- All Implemented Interfaces:
jakarta.servlet.Filter
- Author:
- tomyeh
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoiddestroy()Called by the web container to indicate to a filter that it is being taken out of service.protected final voidforward(jakarta.servlet.ServletRequest request, jakarta.servlet.ServletResponse response, String uri) Forward to the specified page.protected final voidforward(jakarta.servlet.ServletRequest request, jakarta.servlet.ServletResponse response, String uri, Map params, int mode) Forward to the specified page with parameters.final StringReturns the filter's name.final StringgetInitParameter(String name) Returns a String containing the value of the named initialization parameter, or null if the parameter does not exist.final EnumerationReturns a String containing the value of the named initialization parameter, or null if the parameter does not exist.final jakarta.servlet.ServletContextReturns the servlet context in which this filter is running.protected final voidinclude(jakarta.servlet.ServletRequest request, jakarta.servlet.ServletResponse response, String uri) Includes the specified page.protected final voidinclude(jakarta.servlet.ServletRequest request, jakarta.servlet.ServletResponse response, String uri, Map params, int mode) Includes the specified page with parameters.protected voidinit()A convenience method which can be overridden so that there's no need to call super.init(config).final voidinit(jakarta.servlet.FilterConfig config) Called by the web container to indicate to a filter that it is being placed into service.protected voidsendRedirect(jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response, String page, Map params, int mode) Redirects to another page.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface jakarta.servlet.Filter
doFilter
-
Field Details
-
_config
protected jakarta.servlet.FilterConfig _config
-
-
Constructor Details
-
GenericFilter
protected GenericFilter()
-
-
Method Details
-
init
protected void init() throws jakarta.servlet.ServletExceptionA convenience method which can be overridden so that there's no need to call super.init(config).- Throws:
jakarta.servlet.ServletException- See Also:
-
init
public final void init(jakarta.servlet.FilterConfig config) throws jakarta.servlet.ServletException Called by the web container to indicate to a filter that it is being placed into service. However, deriving class usually doesn't override this method but overridinginit().- Specified by:
initin interfacejakarta.servlet.Filter- Throws:
jakarta.servlet.ServletException
-
getInitParameter
Returns a String containing the value of the named initialization parameter, or null if the parameter does not exist. -
getInitParameterNames
Returns a String containing the value of the named initialization parameter, or null if the parameter does not exist. -
getFilterName
Returns the filter's name. -
getServletContext
public final jakarta.servlet.ServletContext getServletContext()Returns the servlet context in which this filter is running. -
sendRedirect
protected void sendRedirect(jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response, String page, Map params, int mode) throws jakarta.servlet.ServletException, IOException Redirects to another page. Note: it supports only HTTP.It resolves "*" contained in URI, if any, to the proper Locale, and the browser code. Refer to
Servlets.locate(ServletContext, ServletRequest, String, Locator)for details.- Parameters:
page- the page's uri; null to denote the same requestmode- one ofServlets.OVERWRITE_URI,Servlets.IGNORE_PARAM, andServlets.APPEND_PARAM. It defines how to handle if both uri and params contains the same parameter. mode is used only if both uri contains query string and params is not empty.- Throws:
jakarta.servlet.ServletExceptionIOException
-
forward
protected final void forward(jakarta.servlet.ServletRequest request, jakarta.servlet.ServletResponse response, String uri) throws jakarta.servlet.ServletException, IOException Forward to the specified page.It resolves "*" contained in URI, if any, to the proper Locale, and the browser code. Refer to
Servlets.locate(ServletContext, ServletRequest, String, Locator)for details.- Throws:
jakarta.servlet.ServletExceptionIOException- Since:
- 3.6.3
-
forward
protected final void forward(jakarta.servlet.ServletRequest request, jakarta.servlet.ServletResponse response, String uri, Map params, int mode) throws jakarta.servlet.ServletException, IOException Forward to the specified page with parameters.It resolves "*" contained in URI, if any, to the proper Locale, and the browser code. Refer to
Servlets.locate(ServletContext, ServletRequest, String, Locator)for details.- Throws:
jakarta.servlet.ServletExceptionIOException- Since:
- 3.6.3
-
include
protected final void include(jakarta.servlet.ServletRequest request, jakarta.servlet.ServletResponse response, String uri) throws jakarta.servlet.ServletException, IOException Includes the specified page.It resolves "*" contained in URI, if any, to the proper Locale, and the browser code. Refer to
Servlets.locate(ServletContext, ServletRequest, String, Locator)for details.- Throws:
jakarta.servlet.ServletExceptionIOException- Since:
- 3.6.3
-
include
protected final void include(jakarta.servlet.ServletRequest request, jakarta.servlet.ServletResponse response, String uri, Map params, int mode) throws jakarta.servlet.ServletException, IOException Includes the specified page with parameters.It resolves "*" contained in URI, if any, to the proper Locale, and the browser code. Refer to
Servlets.locate(ServletContext, ServletRequest, String, Locator)for details.- Throws:
jakarta.servlet.ServletExceptionIOException- Since:
- 3.6.3
-
destroy
public void destroy()Called by the web container to indicate to a filter that it is being taken out of service.This implementation does nothing.
- Specified by:
destroyin interfacejakarta.servlet.Filter
-