source: vlo/branches/vlo-3.0/vlo-web-app/src/main/java/eu/clarin/cmdi/vlo/VloWicketApplication.java @ 4647

Last change on this file since 4647 was 4647, checked in by Twan Goosen, 10 years ago

mounted record page on /record

File size: 2.6 KB
Line 
1package eu.clarin.cmdi.vlo;
2
3import eu.clarin.cmdi.vlo.service.SolrDocumentService;
4import eu.clarin.cmdi.vlo.wicket.pages.FacetedSearchPage;
5import eu.clarin.cmdi.vlo.wicket.pages.RecordPage;
6import org.apache.wicket.Application;
7import org.apache.wicket.markup.html.WebPage;
8import org.apache.wicket.protocol.http.WebApplication;
9import org.apache.wicket.resource.loader.BundleStringResourceLoader;
10import org.apache.wicket.spring.injection.annot.SpringComponentInjector;
11import org.springframework.beans.BeansException;
12import org.springframework.beans.factory.annotation.Autowired;
13import org.springframework.context.ApplicationContext;
14import org.springframework.context.ApplicationContextAware;
15
16/**
17 * Application object for your web application. If you want to run this
18 * application without deploying, run the Start class.
19 *
20 * @see eu.clarin.cmdi.Start#main(String[])
21 */
22public class VloWicketApplication extends WebApplication implements ApplicationContextAware {
23
24    @Autowired
25    private SolrDocumentService documentService;
26
27    private ApplicationContext applicationContext;
28
29    /**
30     * @return the home page of this application
31     * @see org.apache.wicket.Application#getHomePage()
32     */
33    @Override
34    public Class<? extends WebPage> getHomePage() {
35        return FacetedSearchPage.class;
36    }
37
38    /**
39     * @see org.apache.wicket.Application#init()
40     */
41    @Override
42    public void init() {
43        super.init();
44        // this listener will inject any spring beans that need to be autowired
45        getComponentInstantiationListeners().add(new SpringComponentInjector(this, applicationContext));
46        // register the resource of field names (used by eu.clarin.cmdi.vlo.wicket.componentsSolrFieldNameLabel)
47        getResourceSettings().getStringResourceLoaders().add(new BundleStringResourceLoader("fieldNames"));
48       
49        // Record (query result) page. E.g. /vlo/record?docId=abc123
50        // (cannot encode docId in path because it contains a slash)
51        mountPage("/record", RecordPage.class);
52    }
53
54    /**
55     *
56     * @return the active VLO wicket application
57     */
58    public static VloWicketApplication get() {
59        return (VloWicketApplication) Application.get();
60    }
61
62    /**
63     * Method needed for dynamic injection of application context (as happens in
64     * unit tests)
65     *
66     * @param applicationContext
67     * @throws BeansException
68     */
69    @Override
70    public void setApplicationContext(ApplicationContext applicationContext) throws BeansException {
71        this.applicationContext = applicationContext;
72    }
73
74    public SolrDocumentService getDocumentService() {
75        return documentService;
76    }
77
78}
Note: See TracBrowser for help on using the repository browser.