congrats Icon
New! Announcing Tabnine Chat Beta
Learn More
Tabnine Logo
RequestContextFilter
Code IndexAdd Tabnine to your IDE (free)

How to use
RequestContextFilter
in
org.springframework.web.filter

Best Java code snippets using org.springframework.web.filter.RequestContextFilter (Showing top 11 results out of 315)

origin: spring-projects/spring-framework

@Override
protected void doFilterInternal(
    HttpServletRequest request, HttpServletResponse response, FilterChain filterChain)
    throws ServletException, IOException {
  ServletRequestAttributes attributes = new ServletRequestAttributes(request, response);
  initContextHolders(request, attributes);
  try {
    filterChain.doFilter(request, response);
  }
  finally {
    resetContextHolders();
    if (logger.isTraceEnabled()) {
      logger.trace("Cleared thread-bound request context: " + request);
    }
    attributes.requestCompleted();
  }
}
origin: spring-projects/spring-framework

MockFilterConfig mfc = new MockFilterConfig(new MockServletContext(), "foo");
RequestContextFilter rbf = new RequestContextFilter();
rbf.init(mfc);
  rbf.doFilter(req, resp, fc);
  if (sex != null) {
    fail();
origin: stackoverflow.com

mockMvc = MockMvcBuilders
.webAppContextSetup(this.wac)
.addFilters(new RequestContextFilter(), testFilterChain)
.build();
origin: stackoverflow.com

 @Configuration
public class ListenerConfig {

  @Bean
  public RequestContextFilter requestContextFilter() {
    RequestContextFilter requestContextFilter = new RequestContextFilter();
    requestContextFilter.setThreadContextInheritable(true);
    return requestContextFilter;
  }
}
origin: org.esupportail/esup-commons2-web

  /**
   * Execute the filter.
   * @throws Exception
   */
  public void run() throws Exception {
    //TODO CL V2 : use dao in core module
//        DatabaseUtils.open();
//        DatabaseUtils.begin();
    contextFilter.doFilter(request, response, chain);
    //TODO CL V2 : use dao in core module
//        DatabaseUtils.commit();
//        DatabaseUtils.close();

  }
}
origin: stackoverflow.com

public RequestContextFilter requestContextFilter() {
 return new RequestContextFilter();
origin: org.springframework/spring-web

@Override
protected void doFilterInternal(
    HttpServletRequest request, HttpServletResponse response, FilterChain filterChain)
    throws ServletException, IOException {
  ServletRequestAttributes attributes = new ServletRequestAttributes(request, response);
  initContextHolders(request, attributes);
  try {
    filterChain.doFilter(request, response);
  }
  finally {
    resetContextHolders();
    if (logger.isTraceEnabled()) {
      logger.trace("Cleared thread-bound request context: " + request);
    }
    attributes.requestCompleted();
  }
}
origin: stackoverflow.com

 @Bean
@ConditionalOnMissingBean(RequestContextFilter.class)
public RequestContextFilter requestContextFilter() {
 return new RequestContextFilter();
}

@Bean
public FilterRegistrationBean requestContextFilterChainRegistration(
 @Qualifier("requestContextFilter") Filter securityFilter) {

 FilterRegistrationBean registration = 
  new FilterRegistrationBean(securityFilter);

 registration.setName("requestContextFilter");

 // note : must to be following order of springSessionRepositoryFilter
 registration.setOrder(SessionRepositoryFilter.DEFAULT_ORDER + 1);

 return registration;
}
origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.spring-web

@Override
protected void doFilterInternal(
    HttpServletRequest request, HttpServletResponse response, FilterChain filterChain)
    throws ServletException, IOException {
  ServletRequestAttributes attributes = new ServletRequestAttributes(request, response);
  initContextHolders(request, attributes);
  try {
    filterChain.doFilter(request, response);
  }
  finally {
    resetContextHolders();
    if (logger.isTraceEnabled()) {
      logger.trace("Cleared thread-bound request context: " + request);
    }
    attributes.requestCompleted();
  }
}
origin: stackoverflow.com

return new RequestContextFilter();
origin: apache/servicemix-bundles

@Override
protected void doFilterInternal(
    HttpServletRequest request, HttpServletResponse response, FilterChain filterChain)
    throws ServletException, IOException {
  ServletRequestAttributes attributes = new ServletRequestAttributes(request, response);
  initContextHolders(request, attributes);
  try {
    filterChain.doFilter(request, response);
  }
  finally {
    resetContextHolders();
    if (logger.isDebugEnabled()) {
      logger.debug("Cleared thread-bound request context: " + request);
    }
    attributes.requestCompleted();
  }
}
org.springframework.web.filterRequestContextFilter

Javadoc

Servlet Filter that exposes the request to the current thread, through both org.springframework.context.i18n.LocaleContextHolder and RequestContextHolder. To be registered as filter in web.xml.

Alternatively, Spring's org.springframework.web.context.request.RequestContextListenerand Spring's org.springframework.web.servlet.DispatcherServlet also expose the same request context to the current thread.

This filter is mainly for use with third-party servlets, e.g. the JSF FacesServlet. Within Spring's own web support, DispatcherServlet's processing is perfectly sufficient.

Most used methods

  • initContextHolders
  • resetContextHolders
  • <init>
  • doFilter
  • init
  • setThreadContextInheritable
    Set whether to expose the LocaleContext and RequestAttributes as inheritable for child threads (usin

Popular in Java

  • Making http requests using okhttp
  • getSupportFragmentManager (FragmentActivity)
  • scheduleAtFixedRate (ScheduledExecutorService)
  • getOriginalFilename (MultipartFile)
    Return the original filename in the client's filesystem.This may contain path information depending
  • InputStreamReader (java.io)
    A class for turning a byte stream into a character stream. Data read from the source input stream is
  • RandomAccessFile (java.io)
    Allows reading from and writing to a file in a random-access manner. This is different from the uni-
  • SocketTimeoutException (java.net)
    This exception is thrown when a timeout expired on a socket read or accept operation.
  • Date (java.sql)
    A class which can consume and produce dates in SQL Date format. Dates are represented in SQL as yyyy
  • StringTokenizer (java.util)
    Breaks a string into tokens; new code should probably use String#split.> // Legacy code: StringTo
  • XPath (javax.xml.xpath)
    XPath provides access to the XPath evaluation environment and expressions. Evaluation of XPath Expr
  • Best IntelliJ 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