Kamlesh Sharma
Kamlesh Sharma

Reputation: 222

How to resolve Play framework routing conflicts programmatically

I have two routes defined in my application viz.

GET /resource/:resourceid  ResourceController.getResourceById(resourceid : String)
GET /resource/system       SystemResourceController.getAllSystemResources()

The above routes conflict with each other.

I cannot access getAllSystemResources() defined in SystemResourceController.

All the HTTP GET request to the /resource/system. routes to /resource/:resourceid

From the Play-framework documentation at the below link https://www.playframework.com/documentation/1.2.5/routes

I found that the routes priority is based on the order of route mentioned in the routes file.

Is there anyway I can resolve this conflict?

Upvotes: 0

Views: 200

Answers (1)

Abacus
Abacus

Reputation: 19471

Change the order. Put the rule for /resource/system before the other one

Upvotes: 2

Related Questions