2 * Copyright 2005-2010 the original author or authors.
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
8 * http://www.apache.org/licenses/LICENSE-2.0
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.
16 package org.wamblee.photos.wicket;
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;
30 * Application object for your web application. If you want to run this
31 * application without deploying, run the Start class.
33 * @see org.wamblee.Start#main(String[])
35 public class WicketApplication extends WebApplication {
40 public WicketApplication() {
45 public RequestCycle newRequestCycle(Request aRequest, Response aResponse) {
46 return new OpenTransactionInViewRequestCycle(this, (WebRequest) aRequest, aResponse);
50 protected void init() {
52 addComponentInstantiationListener(new ComponentInstantiationInjector());
54 IApplicationSettings settings = getApplicationSettings();
55 settings.setInternalErrorPage(ErrorPage.class);
57 mount(new MixedParamUrlCodingStrategy("view", HomePage.class, new String[]{"path"}));
58 mount(new MixedParamUrlCodingStrategy("editprofile", EditProfilePage.class, new String[]{}));
59 mount(new MixedParamUrlCodingStrategy("admin", AdminPage.class, new String[]{}));
61 // Use the lines below to get the internal error page also when in
63 // IExceptionSettings exs = getExceptionSettings();
64 // exs.setUnexpectedExceptionDisplay(IExceptionSettings.SHOW_INTERNAL_ERROR_PAGE);
68 * @see org.apache.wicket.Application#getHomePage()
70 public Class<HomePage> getHomePage() {
71 return HomePage.class;