branaway / japid42

A full feaured Java-based template engine for Play2
57 stars 11 forks source link

Play Framework 2.2.1 Japid router configuration #23

Open optionalDimension opened 10 years ago

optionalDimension commented 10 years ago

I am using Play Framework version 2.2.1, and trying to integrate with Japid routing mechanism.

I removed play's default routes file, and left my Application controller this way.

@Path("app") public class Application extends JapidController {

@GET @Path("create") public static Result createTicket() { return renderText("Hello Woasddasddsdsadsd!"); } }

At this point I tried these routes without success: localhost:9000/iwant/app/create localhost:9000/app/create

Then I changed to:

@Path("") public class Application extends JapidController {

public static Result createTicket() { return renderText("Hello Woasddasddsdsadsd!"); } }

And tried these urls also without success: localhost:9000/iwant/Application/create localhost:9000/Application/create

I also added/removed @ApplicationPath("iwant") annotaion, but still no success.

This is the error message in browser: Action not found(404) For request 'GET /app/create' These following routes have been tried, in this order: No routes derived from JAX-RS annotations found. No static router defined.

Hope someone can help!

Thanks

Rauan

branaway commented 10 years ago

I'll take a look the next moment.

2013/12/17 Kussembayev notifications@github.com

I am using Play Framework version 2.2.1, and trying to integrate with Japid routing mechanism.

I removed play's default routes file, and left my Application controller this way.

@Path https://github.com/Path("app") public class Application extends JapidController {

@GET https://github.com/GET @Path https://github.com/Path("create") public static Result createTicket() { return renderText("Hello Woasddasddsdsadsd!"); } }

At this point I tried these routes without success: localhost:9000/iwant/app/create localhost:9000/app/create

Then I changed to:

@Path https://github.com/Path("") public class Application extends JapidController {

public static Result createTicket() { return renderText("Hello Woasddasddsdsadsd!"); } }

And tried these urls also without success: localhost:9000/iwant/Application/create localhost:9000/Application/create

I also added/removed @ApplicationPath("iwant") annotaion, but still no success.

This is the error message in browser: Action not found(404) For request 'GET /app/create' These following routes have been tried, in this order: No routes derived from JAX-RS annotations found. No static router defined.

Hope someone can help!

Thanks

Rauan

— Reply to this email directly or view it on GitHubhttps://github.com/branaway/japid42/issues/23 .

branaway commented 10 years ago

were you using Japid version 0.9.16 which is the latest version? I tested just now it worked here. Some of the earlier version requires you to call setUseJapidRouting(true) in the Global#onStartJapid. As long as your controllers are in controller..* package and they're annotated with @Path, they should be picked up by the router.

Or you can post your project on Github and let me have shot.