I've seen Spring HandlerInterceptor's used in the past for this sort of thing 
and it's worked out pretty well:

http://static.springsource.org/spring/docs/current/spring-framework-reference/html/mvc.html#mvc-handlermapping-interceptor

More specifically -- I've seen a class extending HandlerInterceptorAdapter 
registered with the DefaultAnnotationHandlerMapping to add common objects to 
the ModelAndView in the HandlerInterceptorAdapter.postHandle(...) method.

Tony was actually the one who implemented the specific case I'm thinking of for 
our internal portal -- maybe he could comment further if there are questions on 
it.

--Jesse

>-----Original Message-----
>From: Jasha Joachimsthal [mailto:[email protected]]
>Sent: Thursday, November 03, 2011 8:56 AM
>To: [email protected]
>Subject: Portal preferences set by admin
>
>Hi,
>
>in the design of the admin interface there's also a tab for portal wide
>preferences. The admin can change things like
>- the title suffix for each page (" - Rave" will then be replaced by " -
>ACME University")
>- the number of items on a page in the widget store (or any other pageable
>list)
>- company logo
>etc etc
>
>We could create some base controller with a "getPortalSettings" that calls
>some PortalSettingsService that retrieves settings through a repository
>from the db (for each request...). All controllers should then extend this
>base controller.
>I'm wondering what the cleanest solution would be in Spring MVC or should
>my suggestion be the good enough option for the time being?
>
>
>Jasha Joachimsthal
>
>Europe - Amsterdam - Oosteinde 11, 1017 WT Amsterdam - +31(0)20 522 4466
>US - Boston - 1 Broadway, Cambridge, MA 02142 - +1 877 414 4776 (toll free)
>
>www.onehippo.com

Reply via email to