org.springframework.security.web.savedrequest.RequestCache.getMatchingRequest()方法的使用及代码示例

x33g5p2x  于2022-01-29 转载在 其他  
字(2.2k)|赞(0)|评价(0)|浏览(127)

本文整理了Java中org.springframework.security.web.savedrequest.RequestCache.getMatchingRequest方法的一些代码示例,展示了RequestCache.getMatchingRequest的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。RequestCache.getMatchingRequest方法的具体详情如下:
包路径:org.springframework.security.web.savedrequest.RequestCache
类名称:RequestCache
方法名:getMatchingRequest

RequestCache.getMatchingRequest介绍

[英]Returns a wrapper around the saved request, if it matches the current request. The saved request should be removed from the cache.
[中]如果保存的请求与当前请求匹配,则返回该请求的包装。保存的请求应从缓存中删除。

代码示例

代码示例来源:origin: spring-projects/spring-security

@Test
public void getWhenInvokingExceptionHandlingTwiceThenOriginalEntryPointUsed() throws Exception {
  this.spring.register(InvokeTwiceDoesNotOverrideConfig.class).autowire();
  this.mvc.perform(get("/"));
  verify(InvokeTwiceDoesNotOverrideConfig.requestCache)
      .getMatchingRequest(any(HttpServletRequest.class), any(HttpServletResponse.class));
}

代码示例来源:origin: apache/servicemix-bundles

public void doFilter(ServletRequest request, ServletResponse response,
    FilterChain chain) throws IOException, ServletException {
  HttpServletRequest wrappedSavedRequest = requestCache.getMatchingRequest(
      (HttpServletRequest) request, (HttpServletResponse) response);
  chain.doFilter(wrappedSavedRequest == null ? request : wrappedSavedRequest,
      response);
}

代码示例来源:origin: org.craftercms/crafter-security-provider

/**
 * Checks if there's a request in the request cache (which means that a previous request was cached). If there's
 * one, the request cache creates a new request by merging the saved request with the current request. The new
 * request is used through the rest of the processor chain.
 *
 * @param context        the context which holds the current request and response
 * @param processorChain the processor chain, used to call the next processor
 */
public void processRequest(RequestContext context, RequestSecurityProcessorChain processorChain) throws Exception {
  HttpServletRequest request = context.getRequest();
  HttpServletResponse response = context.getResponse();
  HttpServletRequest wrappedSavedRequest = requestCache.getMatchingRequest(request, response);
  if (wrappedSavedRequest != null) {
    logger.debug("A previously saved request was found, and has been merged with the current request");
    context.setRequest(wrappedSavedRequest);
  }
  processorChain.processRequest(context);
}

相关文章

微信公众号

最新文章

更多