RFC: Use @Path and @GET/@PUT/@POST for annotation router

This is an implementation based on our discussion.  It implements JAX-RS-style (don't cry) routing support for both the Controller and Controller Methods.  It removes the former `@Route` annotation.

This supports mode-limited routes.  Multiple modes can be specified for a route via the `@Dev`, `@Prod`, and `@Test` annotations.

This PR does NOT support route ordering - which I have decided may still be important for things like my Swagger module.  I still am thinking that RegEx routes do not belong here; those should be non-annotated only.

I also tweaked the  `AnnotationRouter` to implement the `ApplicationRoutes` interface - this is the same design seen in the `CasinoRouter`.

I think this moves the `AnnotationRouter` forward, but Darren should review.

Hey guys,

I was going off the documentation about modes, but I can see being able to have extra nodes being handy like staging, jenkins, etc ...

I think that we either put effort into it to making modes work, or change the documentation.

D.
 

On 4 Sep 2014, at 22:07, James Moger <notifications@github.com> wrote:

> In ninja-annotation-router-beta/src/main/java/router/AnnotationRouter.java:
> 
> > +	 * Determines if this method may be registered as a route for the current
> > +	 * runtime mode. A method may be annotated to run in multiple modes.
> > +	 *
> > +	 * @param method
> > +	 * @return true if the method can be registered as a route
> > +	 */
> > +	private boolean allowMethod(Method method) {
> > +
> > +		int mode = MODE_ALL;
> > +		if (method.isAnnotationPresent(Dev.class)) {
> > +			mode |= MODE_DEV;
> > +		}
> > +		if (method.isAnnotationPresent(Test.class)) {
> > +			mode |= MODE_TEST;
> > +		}
> > +		if (method.isAnnotationPresent(Prod.class)) {
> Have you tried to create your own mode? I'm not sure it works like you expect. The mode is tied to an enum. If you create an mode named "james" you end up running in "prod" anyway. At least that was my finding.
> 
> —
> Reply to this email directly or view it on GitHub.
> 

Darren Hudson
Mobile: 07866 004000  Office: 01628 623367
www.docfacto.com