01: /*
02: * $Id: NiceUrlApplication.java 5398 2006-04-17 00:26:51 -0700 (Mon, 17 Apr
03: * 2006) jdonnerstag $ $Revision: 462276 $ $Date: 2006-04-17 00:26:51 -0700 (Mon,
04: * 17 Apr 2006) $
05: *
06: * ==================================================================== Licensed
07: * under the Apache License, Version 2.0 (the "License"); you may not use this
08: * file except in compliance with the License. You may obtain a copy of the
09: * License at
10: *
11: * http://www.apache.org/licenses/LICENSE-2.0
12: *
13: * Unless required by applicable law or agreed to in writing, software
14: * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
15: * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
16: * License for the specific language governing permissions and limitations under
17: * the License.
18: */
19: package wicket.examples.niceurl;
20:
21: import wicket.examples.WicketExampleApplication;
22: import wicket.examples.niceurl.mounted.Page3;
23: import wicket.request.target.coding.QueryStringUrlCodingStrategy;
24: import wicket.util.lang.PackageName;
25:
26: /**
27: * Application class for this example.
28: *
29: * @author Eelco Hillenius
30: */
31: public class NiceUrlApplication extends WicketExampleApplication {
32: /**
33: * Construct.
34: */
35: public NiceUrlApplication() {
36: super ();
37: }
38:
39: /**
40: * @see wicket.Application#getHomePage()
41: */
42: public Class getHomePage() {
43: return Home.class;
44: }
45:
46: /**
47: * @see wicket.examples.WicketExampleApplication#init()
48: */
49: protected void init() {
50: // Disable creation of javascript which jWebUnit (test only)
51: // doesn't handle properly
52: getPageSettings().setAutomaticMultiWindowSupport(false);
53:
54: // mount single bookmarkable pages
55: mountBookmarkablePage("/the/homepage/path", Home.class);
56: mountBookmarkablePage("/a/nice/path/to/the/first/page",
57: Page1.class);
58: mountBookmarkablePage("/path/to/page2", Page2.class);
59:
60: mountBookmarkablePageWithUrlCoding("/path/to/page2qpencoded/",
61: Page2QP.class);
62:
63: // mount a whole package at once (all bookmarkable pages,
64: // the relative class name will be part of the url
65:
66: // maybe not the neatest sight, but for package mounting it makes
67: // sense to use one of the (important) classes in your package, so
68: // that any refactoring (like a package rename) will automatically
69: // be applied here.
70: mount("/my/mounted/package", PackageName.forClass(Page3.class));
71: }
72:
73: private void mountBookmarkablePageWithUrlCoding(String path,
74: Class pageClass) {
75: mount(path, new QueryStringUrlCodingStrategy(path, pageClass));
76: }
77: }
|