wicket-routes-mount

Provide a way to group mount paths into a central routes file (a la Play!/Rails...)

License

License

Categories

Categories

Wicket User Interface Web Frameworks
GroupId

GroupId

com.code-troopers
ArtifactId

ArtifactId

wicket-routes-mount
Last Version

Last Version

0.2
Release Date

Release Date

Type

Type

jar
Description

Description

wicket-routes-mount
Provide a way to group mount paths into a central routes file (a la Play!/Rails...)
Source Code Management

Source Code Management

https://github.com/code-troopers/wicket-routes-mount

Download wicket-routes-mount

How to add to project

<!-- https://jarcasting.com/artifacts/com.code-troopers/wicket-routes-mount/ -->
<dependency>
    <groupId>com.code-troopers</groupId>
    <artifactId>wicket-routes-mount</artifactId>
    <version>0.2</version>
</dependency>
// https://jarcasting.com/artifacts/com.code-troopers/wicket-routes-mount/
implementation 'com.code-troopers:wicket-routes-mount:0.2'
// https://jarcasting.com/artifacts/com.code-troopers/wicket-routes-mount/
implementation ("com.code-troopers:wicket-routes-mount:0.2")
'com.code-troopers:wicket-routes-mount:jar:0.2'
<dependency org="com.code-troopers" name="wicket-routes-mount" rev="0.2">
  <artifact name="wicket-routes-mount" type="jar" />
</dependency>
@Grapes(
@Grab(group='com.code-troopers', module='wicket-routes-mount', version='0.2')
)
libraryDependencies += "com.code-troopers" % "wicket-routes-mount" % "0.2"
[com.code-troopers/wicket-routes-mount "0.2"]

Dependencies

compile (2)

Group / Artifact Type Version
org.apache.wicket : wicket-core jar [6.0.0,]
org.apache.wicket : wicket-auth-roles jar [6.0.0,]

provided (1)

Group / Artifact Type Version
org.eclipse.jetty.aggregate : jetty-all-server jar 8.1.10.v20130312

test (2)

Group / Artifact Type Version
org.slf4j : slf4j-log4j12 jar 1.7.5
junit : junit jar 4.11

Project Modules

There are no modules declared in this project.

Wicket Routes Mount Build Status

Apache Wicket is a Java Web framework providing clean separation between markup and logic.

This project allows to group page mounting in a single file. It also permits to set permissions on mounts.

Setup on your project

Add the following Maven dependency (available on Maven Central)

<dependency>
    <groupId>com.code-troopers</groupId>
    <artifactId>wicket-route-mount</artifactId>
    <version>0.2</version>
</dependency>

Standard usage

Then you will need to write your mounts in a routes.conf located at the root of your sources (typically src/main/resources/routes.conf)

The content of your file must look like the following (standard Wicket mount syntax applies : ${requiredParam} #{optionalParam}) :

# mountPoint            class                           roles
/home                   codetroopers.HomePage           
/secured                codetroopers.SecuredPage        USER

To parse the file and mount pages, you will need to add the following code in your Application#init() method

@Override
public void init(){
    super.init();
    RoutesMountParser.mount(this);
}

Regular expression parameter checking

If you want you can use the built-in mecanism allowing to check your parameters using regular expressions. This way you can easily define only numerical parameters or restriction over special values. When you want to use this, just add a : followed by the regular expression at the end of your param like this : ${param:[0-0]+}. Your routes.conf can look like the following :

# mountPoint            class                           roles
/user/${id:[0-9]+}      codetroopers.UserPage           

Package mounting

If you want to mount all the pages in a package, you can put the packageName after the mounting point in your routes.conf file. When reading the file, all the pages in the package will be mounted under the specified mount point (the standard PackageMapper is used).

Bug tracker

Have a bug? Please create an issue here on GitHub!

https://github.com/code-troopers/wicket-routes-mount/issues

Special notes

The implementation provided here is open for pull request or further integration into WicketStuff.

Thanks to Cloudbees buildhive for providing a free Jenkins instance.

Thanks to 55Minutes.com for providing the initial implementation of ParamCheckingPatternMapper.

Copyright and license

Copyright 2013 Code-Troopers.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this work except in compliance with the License. You may obtain a copy of the License in the LICENSE file, or at:

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

com.code-troopers

Code-Troopers

Versions

Version
0.2
0.1