ali haider
ali haider

Reputation: 20202

experiencing issue with route in play 1.2.5

I probably have misconfigured my route file for play-1.2.5 - below is the relevant route file part & the URL being used:

URL:

GET /application/autoComplete?term=mac 

Route:

GET     /autoComplete/{term}     controllers.Application.AutoCompleteTerm

I also have the following route defined but its not getting picked up:

GET     /autoComplete/     controllers.Application.AutoCompleteTerm

The route does not get hit - instead, I get a template not found exception:

play.exceptions.TemplateNotFoundException: Template not found

Any suggestions to help troubleshoot this will be quite welcome. thanks

Upvotes: 0

Views: 310

Answers (1)

The route:

GET     /autoComplete/{term}     controllers.Application.AutoCompleteTerm

...is wrong. It should be like this:

GET     /autoComplete/{term}     Application.autoCompleteTerm

This would correspond to the following URL:

GET http://127.0.0.1:9000/autoComplete/mac

The corresponding method in Application would look like this:

public static void autoCompleteTerm(String term) {
    ...
}

The URL:

GET http://127.0.0.1:9000/autoComplete?term=mac

...would need the following route:

GET     /autoComplete     Application.autoCompleteTerm

...and the same method as above:

public static void autoCompleteTerm(String term) {
    ...
}

Upvotes: 1

Related Questions