Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
OCPsoft URL-Rewriting Framework

Merge pull request #204 from wienczny/master

Use static methods in Request HttpOperation
latest commit 7ea86d7986
Christian Kaltepoth chkal authored
Failed to load latest commit information.
addressbuilder Test to show that AddressBuilder cannot handle curly braces in URLs (#…
annotations-api [maven-release-plugin] prepare for next development iteration
annotations-impl [maven-release-plugin] prepare for next development iteration
api-el [maven-release-plugin] prepare for next development iteration
api-servlet Don't decode + in a path segment to a space (fixes #203)
api-tests Fixed #199 - Filesystem condition fails in windows.
api System.lineSeparator() isn't available in JDK6, next try
config-annotations Verify that @Parameter rules work even if parameter is missing (#192)
config-jodatime [maven-release-plugin] prepare for next development iteration
config-prettyfaces-tests [maven-release-plugin] prepare for next development iteration
config-prettyfaces Generated method to make easier customize url
config-proxy [maven-release-plugin] prepare for next development iteration
config-servlet-tests [maven-release-plugin] prepare for next development iteration
config-servlet Use static methods in Request HttpOperation
config-tuckey [maven-release-plugin] prepare for next development iteration
distribution [maven-release-plugin] prepare for next development iteration
documentation Remove ToC from Annotations guide. Will generate with JS.
examples [maven-release-plugin] prepare for next development iteration
impl-servlet-2.5 [maven-release-plugin] prepare for next development iteration
impl-servlet-3.0 [maven-release-plugin] prepare for next development iteration
impl-servlet-tests [maven-release-plugin] prepare for next development iteration
impl-servlet Contexts must actually clear their underlying map.
impl-tests [maven-release-plugin] prepare for next development iteration
impl Add ability to consult ParameterValueStore for validity before reques…
integration-cdi-tests [maven-release-plugin] prepare for next development iteration
integration-cdi [maven-release-plugin] prepare for next development iteration
integration-faces-tests [maven-release-plugin] prepare for next development iteration
integration-faces #201 - solves concurrency issue w/ double checked locking
integration-gwt [maven-release-plugin] prepare for next development iteration
integration-spring [maven-release-plugin] prepare for next development iteration
rewrite-servlet [maven-release-plugin] prepare for next development iteration
security-integration-shiro [maven-release-plugin] prepare for next development iteration
showcase [maven-release-plugin] prepare for next development iteration
test-base [maven-release-plugin] prepare for next development iteration
test-harness [maven-release-plugin] prepare for next development iteration
transform-less [maven-release-plugin] prepare for next development iteration
transform-markup [maven-release-plugin] prepare for next development iteration
transform-minify [maven-release-plugin] prepare for next development iteration
transform [maven-release-plugin] prepare for next development iteration
.gitignore Added examples project to assemble example source zipfiles
.travis-deploy.sh Skip GPG signing when doing snapshot deployment
.travis-settings.xml Snapshot deployment
.travis.yml Workaround for missing exec permission
CHANGELOG.md changelog again
LICENSE Initial import
NOTICE rewrite-servlet and distribution modules working
README.md Update README.md
ocpsoft-eclipse-code-format.xml Added code style format profile for Eclipse
pom.xml [maven-release-plugin] prepare for next development iteration

README.md

Rewrite:

A highly configurable URL-rewriting tool for Java EE 6+ and Servlet 2.5+ applications, supporting integration with:

  • CDI
  • Spring DI
  • JodaTime configuration
  • Tuckey.org URLRewriteFilter configuration
  • JavaServer Faces (JSF)
  • JavaServer Pages (JSP)
  • Struts
  • Wicket
  • Grails
  • Spring Roo
  • Spring Web Flow
  • Any servlet & web framework!
  • All major servlet containers and application servers

Get Help

Get Started

  1. It is recommended but not required to remove other URL-rewriting tools from your application before using Rewrite. If you choose to leave them in place, weird things may happen, be warned.

  2. Include OCPSoft Rewrite in your application's POM file:

    <dependency>
       <groupId>org.ocpsoft.rewrite</groupId>
       <artifactId>rewrite-servlet</artifactId>
       <version>${rewrite.version}</version>
    </dependency>
    
  3. Add a configuration provider implementing the 'org.ocpsoft.rewrite.config.ConfigurationProvider' interface, or extending from the abstract HttpConfigurationProvider class for convenience:

    package com.example;
    
    @RewriteConfiguration
    public class ExampleConfigurationProvider extends HttpConfigurationProvider
    {
    
       @Override
       public int priority()
       {
         return 10;
       }
    
       @Override
       public Configuration getConfiguration(final ServletContext context)
       {
         return ConfigurationBuilder.begin()
           .defineRule()
             .when(Direction.isInbound().and(Path.matches("/some/page/{p}/")))
             .perform(Forward.to("/new-page/{p}.html"));
        }
    }
    
  4. You must either annotate your ConfigurationProvider class with the @RewriteConfiguration annotation, OR create a file named: '/META-INF/services/org.ocpsoft.rewrite.config.ConfigurationProvider' which contains the fully qualified name of your ConfigurationProvider implementation:

    /META-INF/services/org.ocpsoft.rewrite.config.ConfigurationProvider
    ---
    com.example.ExampleConfigurationProvider
    
  5. Add rules to your configuration. Condition objects such as 'Direction.isInbound()' and 'Path.matches(...)' can be found in the 'org.ocpsoft.rewrite.config.' and 'org.ocpsoft.rewrite.servlet.config.' packages.

  6. Consider using Rewrite extensions for extra power:

  7. Run your application!

FEEDBACK

This project is looking for your feedback! What would make your task easier? How can we simplify this experience?

TODO's

  • Continue simplification of Configuration objects and convenience APIs.

  • Implement additional xml & file-based configuration support.

  • Implement http://localhost:8080/rewrite-status monitoring tool

Something went wrong with that request. Please try again.