Package org.springframework.web.method

Examples of org.springframework.web.method.ControllerAdviceBean


      if (logger.isDebugEnabled()) {
        logger.debug("Invoking ResponseBodyAdvice chain for body=" + body);
      }
      for (Object advice : this.advice) {
        if (advice instanceof ControllerAdviceBean) {
          ControllerAdviceBean adviceBean = (ControllerAdviceBean) advice;
          if (!adviceBean.isApplicableToBeanType(returnType.getContainingClass())) {
            continue;
          }
          advice = adviceBean.resolveBean();
        }
        if (advice instanceof ResponseBodyAdvice) {
          ResponseBodyAdvice<T> typedAdvice = (ResponseBodyAdvice<T>) advice;
          if (typedAdvice.supports(returnType, selectedConverterType)) {
            body = typedAdvice.beforeBodyWrite(body, returnType,
View Full Code Here


  }

  @Test
  public void controllerAdvice() {

    Object adviceBean = new ControllerAdviceBean(new MyControllerAdvice());
    ResponseBodyAdviceChain chain = new ResponseBodyAdviceChain(Arrays.asList(adviceBean));

    String actual = chain.invoke(this.body, this.returnType,
        this.contentType, this.converterType, this.request, this.response);
View Full Code Here

  }

  @Test
  public void controllerAdviceNotApplicable() {

    Object adviceBean = new ControllerAdviceBean(new TargetedControllerAdvice());
    ResponseBodyAdviceChain chain = new ResponseBodyAdviceChain(Arrays.asList(adviceBean));

    String actual = chain.invoke(this.body, this.returnType,
        this.contentType, this.converterType, this.request, this.response);
View Full Code Here

TOP

Related Classes of org.springframework.web.method.ControllerAdviceBean

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.