Tabnine Logo
Filter
Code IndexAdd Tabnine to your IDE (free)

How to use
Filter
in
javax.servlet

Best Java code snippets using javax.servlet.Filter (Showing top 20 results out of 15,543)

Refine searchRefine arrow

  • FilterChain
  • ServletException
  • Servlet
origin: jenkinsci/jenkins

  public void doFilter(ServletRequest request, ServletResponse response) throws IOException, ServletException {
    if(position==filters.length) {
      // reached to the end
      chain.doFilter(request,response);
    } else {
      // call next
      filters[position++].doFilter(request,response,this);
    }
  }
}.doFilter(request,response);
origin: spring-projects/spring-framework

/**
 * Initialize all the filters, calling each one's init method in turn in the order supplied.
 * @see Filter#init(FilterConfig)
 */
@Override
public void init(FilterConfig config) throws ServletException {
  for (Filter filter : this.filters) {
    filter.init(config);
  }
}
origin: spring-projects/spring-framework

@Override
public void destroy() {
  this.delegate.destroy();
}
origin: org.jasig.portal/uPortal-spring

@Override
public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain)
    throws IOException, ServletException {
  if (wrappedFilter == null) {
    throw new ServletException("No wrappedFilter configured");
  }
  if (this.enable) {
    this.wrappedFilter.doFilter(request, response, chain);
  } else {
    chain.doFilter(request, response);
  }
}
origin: com.google.inject.extensions/guice-servlet

 throw new ServletException(
   "Filters must be bound as singletons. "
     + filterKey
filter.init(
  new FilterConfig() {
   @Override
origin: sitemesh/sitemesh3

protected void deployNewFilter(Filter newFilter) throws ServletException {
  Filter oldFilter = filter;
  if (newFilter == null) {
    throw new ServletException("Cannot deploy null filter");
  }
  newFilter.init(filterConfig);
  filter = newFilter;
  if (oldFilter != null) {
    oldFilter.destroy();
  }
}
origin: Atmosphere/atmosphere

  try {
    filter = filterConfig.getFilter();
    filter.doFilter(request, response, this);
  } catch (IOException e) {
    throw e;
    throw e;
  } catch (Throwable e) {
    throw new ServletException("Throwable", e);
    servlet.service(request, response);
  } else {
    RequestDispatcher rd = configImpl.getServletContext().getNamedDispatcher("default");
    if (rd == null) {
      throw new ServletException("No Servlet Found");
  throw e;
} catch (Throwable e) {
  throw new ServletException("Throwable", e);
origin: sitemesh/sitemesh3

public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse, FilterChain filterChain) throws IOException, ServletException {
  if (!initialized) {
    throw new ServletException(getClass().getName() + ".init(FilterConfig) was not called");
  }
  reloadIfNecessary();
  filter.doFilter(servletRequest, servletResponse, filterChain);
}
origin: spring-projects/spring-framework

/**
 * Pass the call on to the Filter/Servlet.
 */
@Override
public void doFilter(ServletRequest request, ServletResponse response) throws ServletException, IOException {
  if (this.filter != null) {
    this.filter.doFilter(request, response, this.nextFilterChain);
  }
  else {
    Assert.state(this.servlet != null, "Neither a Filter not a Servlet set");
    this.servlet.service(request, response);
  }
}
origin: spring-projects/spring-framework

/**
 * Actually invoke the delegate Filter with the given request and response.
 * @param delegate the delegate Filter
 * @param request the current HTTP request
 * @param response the current HTTP response
 * @param filterChain the current FilterChain
 * @throws ServletException if thrown by the Filter
 * @throws IOException if thrown by the Filter
 */
protected void invokeDelegate(
    Filter delegate, ServletRequest request, ServletResponse response, FilterChain filterChain)
    throws ServletException, IOException {
  delegate.doFilter(request, response, filterChain);
}
origin: haraldk/TwelveMonkeys

@Test
public void testFilterBasic() throws ServletException, IOException {
  Filter filter = makeFilter();
  try {
    filter.init(makeFilterConfig());
    filter.doFilter(makeRequest(), makeResponse(), makeFilterChain());
  }
  finally {
    filter.destroy();
  }
}
origin: nutzam/nutz

public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain)
    throws IOException, ServletException {
  if (proxy == null) {
    synchronized (lock) {
      if (proxy == null) {
        Ioc ioc = Mvcs.ctx().getDefaultIoc();
        Filter proxy = ioc.get(null, beanName);
        proxy.init(filterConfig);
        this.proxy = proxy;
      }
    }
  }
  proxy.doFilter(request, response, chain);
}
origin: jenkinsci/jenkins

/**
 * Reset the proxies and filter for a change in {@link SecurityRealm}.
 */
public void reset(SecurityRealm securityRealm) throws ServletException {
  if (securityRealm != null) {
    SecurityRealm.SecurityComponents sc = securityRealm.getSecurityComponents();
    AUTHENTICATION_MANAGER.setDelegate(sc.manager);
    USER_DETAILS_SERVICE_PROXY.setDelegate(sc.userDetails);
    REMEMBER_ME_SERVICES_PROXY.setDelegate(sc.rememberMe);
    // make sure this.filter is always a valid filter.
    Filter oldf = this.filter;
    Filter newf = securityRealm.createFilter(this.filterConfig);
    newf.init(this.filterConfig);
    this.filter = newf;
    if(oldf!=null)
      oldf.destroy();
  } else {
    // no security related filter needed.
    AUTHENTICATION_MANAGER.setDelegate(null);
    USER_DETAILS_SERVICE_PROXY.setDelegate(null);
    REMEMBER_ME_SERVICES_PROXY.setDelegate(null);
    filter = null;
  }
}
origin: Atmosphere/atmosphere

/**
 * Initialize the {@link Filter}
 *
 * @throws javax.servlet.ServletException
 */
public void init() throws ServletException {
  for (FilterConfigImpl f : filters) {
    if (f != null) {
      f.getFilter().init(f);
    }
  }
  if (servlet != null) {
    servlet.init(configImpl);
  }
}
origin: haraldk/TwelveMonkeys

@Test
public void testInit() {
  Filter filter = makeFilter();
  try {
    filter.init(makeFilterConfig());
  }
  catch (ServletException e) {
    assertNotNull(e.getMessage());
  }
  finally {
    filter.destroy();
  }
}
origin: igniterealtime/Openfire

servlet.destroy();
filter.destroy();
origin: org.jasig.portal/uPortal-spring

@Override
public void init(FilterConfig filterConfig) throws ServletException {
  if (wrappedFilter == null) {
    throw new ServletException("No wrappedFilter configured");
  }
  if (this.enable) {
    this.wrappedFilter.init(filterConfig);
  }
}
origin: org.sitemesh/sitemesh

protected void deployNewFilter(Filter newFilter) throws ServletException {
  Filter oldFilter = filter;
  if (newFilter == null) {
    throw new ServletException("Cannot deploy null filter");
  }
  newFilter.init(filterConfig);
  filter = newFilter;
  if (oldFilter != null) {
    oldFilter.destroy();
  }
}
origin: org.sitemesh/sitemesh

public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse, FilterChain filterChain) throws IOException, ServletException {
  if (!initialized) {
    throw new ServletException(getClass().getName() + ".init(FilterConfig) was not called");
  }
  reloadIfNecessary();
  filter.doFilter(servletRequest, servletResponse, filterChain);
}
origin: spring-projects/spring-framework

/**
 * Pass the call on to the Filter/Servlet.
 */
@Override
public void doFilter(ServletRequest request, ServletResponse response) throws ServletException, IOException {
  if (this.filter != null) {
    this.filter.doFilter(request, response, this.nextFilterChain);
  }
  else {
    Assert.state(this.servlet != null, "Neither a Filter not a Servlet set");
    this.servlet.service(request, response);
  }
}
javax.servletFilter

Javadoc

A filter is an object that performs filtering tasks on either the request to a resource (a servlet or static content), or on the response from a resource, or both.

Filters perform filtering in the doFilter method. Every Filter has access to a FilterConfig object from which it can obtain its initialization parameters, and a reference to the ServletContext which it can use, for example, to load resources needed for filtering tasks.

Filters are configured in the deployment descriptor of a web application.

Examples that have been identified for this design are:

  1. Authentication Filters
  2. Logging and Auditing Filters
  3. Image conversion Filters
  4. Data compression Filters
  5. Encryption Filters
  6. Tokenizing Filters
  7. Filters that trigger resource access events
  8. XSL/T filters
  9. Mime-type chain Filter

Most used methods

  • doFilter
    The doFilter method of the Filter is called by the container each time a request/response pair is pa
  • init
    Called by the web container to indicate to a filter that it is being placed into service. The servle
  • destroy
    Called by the web container to indicate to a filter that it is being taken out of service. This meth
  • <init>

Popular in Java

  • Finding current android device location
  • setContentView (Activity)
  • putExtra (Intent)
  • addToBackStack (FragmentTransaction)
  • HttpServer (com.sun.net.httpserver)
    This class implements a simple HTTP server. A HttpServer is bound to an IP address and port number a
  • GridLayout (java.awt)
    The GridLayout class is a layout manager that lays out a container's components in a rectangular gri
  • SocketTimeoutException (java.net)
    This exception is thrown when a timeout expired on a socket read or accept operation.
  • URLConnection (java.net)
    A connection to a URL for reading or writing. For HTTP connections, see HttpURLConnection for docume
  • TimeZone (java.util)
    TimeZone represents a time zone offset, and also figures out daylight savings. Typically, you get a
  • ReentrantLock (java.util.concurrent.locks)
    A reentrant mutual exclusion Lock with the same basic behavior and semantics as the implicit monitor
  • Top PhpStorm plugins
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now