GithubHelp home page GithubHelp logo

broehiehoa / rewrite Goto Github PK

View Code? Open in Web Editor NEW

This project forked from ocpsoft/rewrite

0.0 1.0 0.0 7.99 MB

OCPsoft URL-Rewriting Framework

Home Page: http://ocpsoft.org/rewrite/

License: Apache License 2.0

Shell 0.03% Java 57.62% HTML 1.27% CSS 0.16% Ruby 26.16% JavaScript 14.77%

rewrite's Introduction

Rewrite Build Status

Join the chat at https://gitter.im/ocpsoft/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()
            .addRule()
              .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
    

Note that your annotated class won't be found, by default, if your ConfigurationProvider is in a jar inside a war. You can either set the servlet parameter org.ocpsoft.rewrite.annotation.SCAN_LIB_DIRECTORY to true, or use the ServiceLoader approach instead.

  1. 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.

  2. Consider using Rewrite extensions for extra power:

  3. 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

rewrite's People

Contributors

andreiamariei avatar andrewcromwell avatar balta3 avatar beikov avatar bryncooke avatar ceefour avatar cgendreau avatar chkal avatar codylerum avatar dboldureanu avatar fabmars avatar gastaldi avatar gitter-badger avatar janario avatar jsight avatar kalgon avatar lincolnthree avatar mbenson avatar mdfst13 avatar romixch avatar rumdidumdum avatar seanf avatar silvafabio avatar tires avatar wienczny avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.