jurlmap - RESTful urls for java
What is jurlmap
A Java library for enabling your webapps to have clean, REST like urls.
Some features are:
- Simple pattern language for brevity and convenience
- Direct binding of parameters to bean properties or method parameters
- Configuration in plain java and annotations. No need for external configuration artifacts
- Implemented as a
Filter
for easy integration with your existing app or framework
How to use it
Here are some url pattern examples:
protected void configure() {
// In this pattern $ means a string, which when matched
// is bound to parameter `Username` and control forwarded to profile.jsp
// Parameter will be accessible via request.getParameter()
forward("/profile.jsp", "/profile/$Username");
// Here % means integer pattern and * means until end of the pattern.
// Binds integers to parameter ArticleId and forwards to article.jsp
forward("/article.jsp", "/article/%ArticleId/*");
// When matched will send a redirect back to browser and parameters
// are appended to query string so in this case the target will
// be `/servlets/profileservlet?Username=...`
redirect("/servlets/profileservlet", "/member/$Username");
// On match creates an instance eof LoginPage and calls it's service method
// LoginPage class implements com.pagegoblin.jurlmap.Page.
// If it is annotated with a @Deploy(url) annotation
// the we don't need to pass a url to the deploy method.
// In this case parameters are bound to bean properties or fields
// of the newly created LoginPage instance.
deploy(LoginPage.class);
}
Detailed info and more advanced use cases can be found in the manual.
License
jurlmap is licensed under the LGPL
Download
The source code is also available on github: https://github.com/mtomis/jurlmap