Results 1 to 4 of 4

Thread: Can't add WebRequestInterceptor in Spring Test MVC Unittest

  1. #1
    Join Date
    Dec 2012
    Posts
    3

    Default Can't add WebRequestInterceptor in Spring Test MVC Unittest

    Hi Community,

    I build a Test with the help of the Spring Test MVC Framework. I am using the StandaloneMockMvcBuilder.
    Example:
    standaloneSetup(echoController).setViewResolvers(v iewResolver).build().perform(get("/apps/echo"))....

    now I like to add a WebRequestInterceptor. But it is only possible to add a HandlerInterceptor.

    Any Idea how to solve the problem?
    Or is this a case for a feature request.

    Regards Philipp

  2. #2
    Join Date
    Jun 2006
    Location
    The Netherlands
    Posts
    13,624

    Default

    Wrap it in a WebRequestHandlerInterceptorAdapter for the time being. That is basically what Spring does also...

    And you might want to add an enhancement request to JIRA to add a convenience method for this.
    Marten Deinum
    Java Consultant / Pragmatist / Open Source Enthousiast / Author


    Pro Spring MVC: With Web Flow
    Conspect

    Have you read the reference guide.
    Use the [ code ] tags, young padawan

  3. #3
    Join Date
    Dec 2012
    Posts
    3

    Default

    Many thanks for the Tip.
    Regards Philipp

  4. #4
    Join Date
    Aug 2006
    Location
    Brooklyn
    Posts
    556

    Default

    StandaloneMockMvcBuilder has a method to add interceptors.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •