info.magnolia.module.blossom.annotation
Annotation Type VirtualURIMapper


@Retention(value=RUNTIME)
@Target(value=TYPE)
public @interface VirtualURIMapper

Used on a type to have all its methods that can be used as VirtualURIMappings exposed to Magnolia. Methods can return String or MappingResult and accept as arguments the incoming uri as a String and/or a HttpServletRequest. The returned URI can be prefixed with "redirect:", "permanent:" or "forward:" to trigger either a temporary redirect, a permanent redirect or a forward respectively. For redirects the URI can be absolute or relative within the web application (the context path is added automatically). For example:

 @VirtualURIMapper
 public class ExampleUriMapper {
   public String about(String uri, HttpServletRequest request) {
     if (uri.equals("/about.html")) return "/sections/about";
     return null;
   }
   public String newsletter(String uri) {
     if (uri.equals("/newsletter.html")) return "redirect:/sections/newsletter.html";
     return null;
   }
 }
 

Since:
1.1.1
See Also:
VirtualURIMapping



Copyright © 2009-2012 Magnolia International Ltd.. All Rights Reserved.