Announcement Announcement Module
Collapse
No announcement yet.
need help with @RequestMapping Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • need help with @RequestMapping

    I just can't figure out how to resolve the application context with Request mapping.

    The application (app.war) that runs in the context /app
    I don't want to hardcode the context in the controller urls so that I can run the app under different contexts e.g. in root context.

    Until now I was using relative urls like so

    page url : /app/module/123
    form action : doSomething/abc
    controller method: @RequestMapping("module/doSomething/{abc}")

    I want to include this jsp form on different modules but this means it must work in different paths and relative urls will be impossible to manage. How can I specify the application context to controller method .. something equivalent to this without hardcoding it.

    controller method: @RequestMapping("{app}/module/doSomething/{abc}")

  • #2
    Caused by @Secured annotation failing..

    Wow.. after some serious debugging it turns out it was failing because the @Secured tag on the method wasn't working for some reason. I removed this tag and it works. If I add any @Secured on the class or the method the Request mapping is not picked up (doesn't show up in mvc log output) and I get a 404 on the post.

    Now i need to know why @Secured is failing .. anyone?? It works perfectly in other parts of the application. Anyone experience something like this. I will try to post more details as I investigate it a bit

    One thing I found was that if I have @Secured on one of the other methods in the class then this url mapping fails (with a 404).


    Originally posted by lilolme View Post
    I just can't figure out how to resolve the application context with Request mapping.

    The application (app.war) that runs in the context /app
    I don't want to hardcode the context in the controller urls so that I can run the app under different contexts e.g. in root context.

    Until now I was using relative urls like so

    page url : /app/module/123
    form action : doSomething/abc
    controller method: @RequestMapping("module/doSomething/{abc}")

    I want to include this jsp form on different modules but this means it must work in different paths and relative urls will be impossible to manage. How can I specify the application context to controller method .. something equivalent to this without hardcoding it.

    controller method: @RequestMapping("{app}/module/doSomething/{abc}")
    Last edited by lilolme; Apr 24th, 2012, 03:16 AM.

    Comment


    • #3
      Finally figured it out .. It was because the controller class was implementing Validator. I pulled this out to another bean and it works..

      Comment

      Working...
      X