loading table of contents...

4.3.2.4. Best Practices

It's a good idea to put handler, corresponding link implementations and post-processors into the same class since these are strongly related. Also, the URI pattern used in @RequestMapping and in @Link can be shared by a constant like

private static final String URI = "/content/{0}";

@RequestMapping(value=URI, ...);
public ModelAndView handle(...) { ... }

@Link(uri=URI, type=MyBean.class, ...)
public UriComponents buildLink(MyBean myBean, ...) {...}

@LinkPostProcessor(type=MyBean.class, ...)
public UriComponents prefixLink(UriComponents originalUri, ...) {...}

The PostProcessorPrecendences class provides some constants to control the order of post-processors. All the Blueprint's default post-processors are ordered by these constants. You can use the constants for additional independent post-processors or use other values in order to apply subsequent post-processors in between.