org.springframework.web.servlet.HandlerInterceptor.postHandle()方法的使用及代码示例

x33g5p2x  于2022-01-20 转载在 其他  
字(5.9k)|赞(0)|评价(0)|浏览(139)

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

HandlerInterceptor.postHandle介绍

[英]Intercept the execution of a handler. Called after HandlerAdapter actually invoked the handler, but before the DispatcherServlet renders the view. Can expose additional model objects to the view via the given ModelAndView.

DispatcherServlet processes a handler in an execution chain, consisting of any number of interceptors, with the handler itself at the end. With this method, each interceptor can post-process an execution, getting applied in inverse order of the execution chain.

Note: special considerations apply for asynchronous request processing. For more details see org.springframework.web.servlet.AsyncHandlerInterceptor.

The default implementation is empty.
[中]拦截处理程序的执行。在HandlerAdapter实际调用处理程序之后调用,但在DispatcherServlet呈现视图之前调用。可以通过给定的ModelAndView向视图公开其他模型对象。
DispatcherServlet处理执行链中的处理程序,该执行链由任意数量的拦截器组成,处理程序本身位于末尾。通过这种方法,每个拦截器都可以对执行进行后处理,以执行链的相反顺序应用。
注意:特殊注意事项适用于异步请求处理。有关更多详细信息,请参阅org。springframework。网状物servlet。AsyncHandlerInterceptor。
默认实现为空。

代码示例

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

@Override
public void postHandle(HttpServletRequest request, HttpServletResponse response, Object handler,
    @Nullable ModelAndView modelAndView) throws Exception {
  this.interceptor.postHandle(request, response, handler, modelAndView);
}

代码示例来源:origin: org.springframework/spring-webmvc

@Override
public void postHandle(HttpServletRequest request, HttpServletResponse response, Object handler,
    @Nullable ModelAndView modelAndView) throws Exception {
  this.interceptor.postHandle(request, response, handler, modelAndView);
}

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

/**
 * Apply postHandle methods of registered interceptors.
 */
void applyPostHandle(HttpServletRequest request, HttpServletResponse response, @Nullable ModelAndView mv)
    throws Exception {
  HandlerInterceptor[] interceptors = getInterceptors();
  if (!ObjectUtils.isEmpty(interceptors)) {
    for (int i = interceptors.length - 1; i >= 0; i--) {
      HandlerInterceptor interceptor = interceptors[i];
      interceptor.postHandle(request, response, this.handler, mv);
    }
  }
}

代码示例来源:origin: org.springframework/spring-webmvc

/**
 * Apply postHandle methods of registered interceptors.
 */
void applyPostHandle(HttpServletRequest request, HttpServletResponse response, @Nullable ModelAndView mv)
    throws Exception {
  HandlerInterceptor[] interceptors = getInterceptors();
  if (!ObjectUtils.isEmpty(interceptors)) {
    for (int i = interceptors.length - 1; i >= 0; i--) {
      HandlerInterceptor interceptor = interceptors[i];
      interceptor.postHandle(request, response, this.handler, mv);
    }
  }
}

代码示例来源:origin: geoserver/geoserver

interceptor.postHandle(request, response, dispatcher, null);

代码示例来源:origin: geoserver/geoserver

interceptor.postHandle(request, response, dispatcher, null);

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

@Test
public void postHandle() throws Exception {
  HandlerInterceptor interceptor = mock(HandlerInterceptor.class);
  MappedInterceptor mappedInterceptor = new MappedInterceptor(new String[] { "/**" }, interceptor);
  mappedInterceptor.postHandle(mock(HttpServletRequest.class), mock(HttpServletResponse.class),
      null, mock(ModelAndView.class));
  then(interceptor).should().postHandle(any(), any(), any(), any());
}

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

@Override
public void postHandle(HttpServletRequest request, HttpServletResponse response, Object handler,
    ModelAndView modelAndView) throws Exception {
  this.interceptor.postHandle(request, response, handler, modelAndView);
}

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

/**
 * Apply postHandle methods of registered interceptors.
 */
void applyPostHandle(HttpServletRequest request, HttpServletResponse response, ModelAndView mv) throws Exception {
  HandlerInterceptor[] interceptors = getInterceptors();
  if (!ObjectUtils.isEmpty(interceptors)) {
    for (int i = interceptors.length - 1; i >= 0; i--) {
      HandlerInterceptor interceptor = interceptors[i];
      interceptor.postHandle(request, response, this.handler, mv);
    }
  }
}

代码示例来源:origin: pl.edu.icm.synat/synat-portal-core

@Override
public void postHandle(HttpServletRequest request, HttpServletResponse response, Object handler, ModelAndView modelAndView) throws Exception {
  processVoidDelegates(i -> i.postHandle(request, response, handler, modelAndView));
}

代码示例来源:origin: org.rythmengine/spring-rythm

public static void applyPostHandlers(HttpServletRequest req, HttpServletResponse res) {
  for (HandlerInterceptor in : getInterceptors().reverse()) {
    try {
      in.postHandle(req, res, null, null);
    } catch (Result r) {
      // ignore
    } catch (Exception e) {
      throw new RuntimeException(e);
    }
  }
}

代码示例来源:origin: com.stormpath.spring/stormpath-spring-webmvc

@Override
public void render(HttpServletRequest request, HttpServletResponse response, ViewModel vm) throws Exception {
  ModelAndView mav = convert(vm, request);
  handlerInterceptor.postHandle(request, response, null, mav);
  render(mav, request, response);
}

代码示例来源:origin: stormpath/stormpath-sdk-java

@Override
public void render(HttpServletRequest request, HttpServletResponse response, ViewModel vm) throws Exception {
  ModelAndView mav = convert(vm, request);
  handlerInterceptor.postHandle(request, response, null, mav);
  render(mav, request, response);
}

代码示例来源:origin: org.parancoe/parancoe-web

public void invokePluginPostHandle(HttpServletRequest request, HttpServletResponse response,
    Object handler, ModelAndView modelAndView) {
  for (WebPlugin plugin : getWebPlugins()) {
    for (HandlerInterceptor interceptor : plugin.getInterceptors()) {
      try {
        interceptor.postHandle(request, response, handler, modelAndView);
      } catch (Exception e) {
        log.error("error in postHandle for plugin '" + plugin.getName() + "'", e);
      }
    }
  }
}

代码示例来源:origin: pl.edu.icm.synat/synat-ui-commons

interceptor.postHandle(request, response, handler, modelAndView);

代码示例来源:origin: org.tinygroup/org.tinygroup.springmvc

for (int i = interceptors.length - 1; i >= 0; i--) {
  HandlerInterceptor interceptor = interceptors[i];
  interceptor.postHandle(processedRequest, response,
      mappedHandler.getHandler(), mv);

相关文章