1 | package eu.clarin.cmdi.vlo; |
---|
2 | |
---|
3 | import eu.clarin.cmdi.vlo.wicket.pages.FacetedSearchPage; |
---|
4 | import org.apache.wicket.markup.html.WebPage; |
---|
5 | import org.apache.wicket.protocol.http.WebApplication; |
---|
6 | import org.apache.wicket.spring.injection.annot.SpringComponentInjector; |
---|
7 | import org.springframework.beans.BeansException; |
---|
8 | import org.springframework.context.ApplicationContext; |
---|
9 | import org.springframework.context.ApplicationContextAware; |
---|
10 | |
---|
11 | /** |
---|
12 | * Application object for your web application. If you want to run this |
---|
13 | * application without deploying, run the Start class. |
---|
14 | * |
---|
15 | * @see eu.clarin.cmdi.Start#main(String[]) |
---|
16 | */ |
---|
17 | public class VloWicketApplication extends WebApplication implements ApplicationContextAware { |
---|
18 | |
---|
19 | private ApplicationContext applicationContext; |
---|
20 | |
---|
21 | /** |
---|
22 | * @return the home page of this application |
---|
23 | * @see org.apache.wicket.Application#getHomePage() |
---|
24 | */ |
---|
25 | @Override |
---|
26 | public Class<? extends WebPage> getHomePage() { |
---|
27 | return FacetedSearchPage.class; |
---|
28 | } |
---|
29 | |
---|
30 | /** |
---|
31 | * @see org.apache.wicket.Application#init() |
---|
32 | */ |
---|
33 | @Override |
---|
34 | public void init() { |
---|
35 | super.init(); |
---|
36 | // this listener will inject any spring beans that need to be autowired |
---|
37 | getComponentInstantiationListeners().add(new SpringComponentInjector(this, applicationContext)); |
---|
38 | } |
---|
39 | |
---|
40 | /** |
---|
41 | * Method needed for dynamic injection of application context (as happens in |
---|
42 | * unit tests) |
---|
43 | * |
---|
44 | * @param applicationContext |
---|
45 | * @throws BeansException |
---|
46 | */ |
---|
47 | @Override |
---|
48 | public void setApplicationContext(ApplicationContext applicationContext) throws BeansException { |
---|
49 | this.applicationContext = applicationContext; |
---|
50 | } |
---|
51 | } |
---|