Same styling of photo albums as with tapestry based application.
[photos] / src / main / java / org / wamblee / photos / wicket / WicketApplication.java
1 /*
2  * Copyright 2005-2010 the original author or authors.
3  * 
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  * 
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  * 
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 package org.wamblee.photos.wicket;
17
18 import org.apache.wicket.Request;
19 import org.apache.wicket.RequestCycle;
20 import org.apache.wicket.Response;
21 import org.apache.wicket.protocol.http.WebApplication;
22 import org.apache.wicket.protocol.http.WebRequest;
23 import org.apache.wicket.request.target.coding.MixedParamUrlCodingStrategy;
24 import org.apache.wicket.settings.IApplicationSettings;
25 import org.apache.wicket.settings.IExceptionSettings;
26 import org.wamblee.wicket.inject.ComponentInstantiationInjector;
27 import org.wamblee.wicket.transactions.OpenTransactionInViewRequestCycle;
28
29 /**
30  * Application object for your web application. If you want to run this
31  * application without deploying, run the Start class.
32  *
33  * @see org.wamblee.Start#main(String[])
34  */
35 public class WicketApplication extends WebApplication {
36
37     /**
38      * Constructor
39      */
40     public WicketApplication() {
41         // Empty.
42     }
43
44     @Override
45     public RequestCycle newRequestCycle(Request aRequest, Response aResponse) {
46         return new OpenTransactionInViewRequestCycle(this, (WebRequest) aRequest, aResponse);
47     }
48
49     @Override
50     protected void init() {
51         super.init();
52         addComponentInstantiationListener(new ComponentInstantiationInjector());
53
54         IApplicationSettings settings = getApplicationSettings();
55         settings.setInternalErrorPage(ErrorPage.class);
56
57         mount(new MixedParamUrlCodingStrategy("view", HomePage.class, new String[]{"path"}));
58
59         // Use the lines below to get the internal error page also when in
60         // development mode.
61         // IExceptionSettings exs = getExceptionSettings();
62         // exs.setUnexpectedExceptionDisplay(IExceptionSettings.SHOW_INTERNAL_ERROR_PAGE);
63     }
64
65     /**
66      * @see org.apache.wicket.Application#getHomePage()
67      */
68     public Class<HomePage> getHomePage() {
69         return HomePage.class;
70     }
71 }