rstoyanchev/spring-mvc-31-demo

Implementation of custom @RequestCondition

Closed this issue · 3 comments

Hi,

I can easily understand how is the custom @RoleMapping in custom RequestCondition implemented.
But Is this the only way we can implement such feature?

I'd like to create my own mappings, so does that mean I have to create my own implementation of RequestMappingHandlerMapping to introduce them to context?

I'd like to link it to my questions elsewhere, to describe my situation and POV
http://stackoverflow.com/questions/10312177/how-to-implement-requestmapping-custom-properties/
http://forum.springsource.org/showthread.php?125780-RequestMapping-custom-properties

Thanks

I'd like to create my own mappings, so does that mean I have to create my own implementation of RequestMappingHandlerMapping to introduce them to context?

Yes, at the moment it is the only way to do it.

Looking at the Managing multiple domains... blog, do you need different controller logic or just different views? A HandlerInterceptor, in its postHandle method can modify the view name according to the sub-domain or add globally shared data.

You could also inject the request URL into a controller method using a method argument like @Value("#{request.requestURL}") String requestURL and then use an if-else condition. This could also be done from an @ModelAttribute method for data across all controller methods, somewhere in a base class.

Thanks, I've tried to implement my own @RequestCondition, so that I can use Type or Method annotation

@SubdomainMapping("www")

So basically yes, I'd like to have a different controller logic.
But I'm not able to plug-in this mapping, as there is no example, on how to implement this through XML.

I need to push my RequestMappingHandlerMapping extended class to HandlerMapping stack:

    @Override
    @Bean
    public RequestMappingHandlerMapping requestMappingHandlerMapping() {

I need to separate controller logic from user roles, and be compliant with @Secured annotations

Closing as duplicate to Issue #4