Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow custom implementation of base Controller #1095

Closed
ryanitus opened this issue Feb 1, 2017 · 2 comments
Closed

Allow custom implementation of base Controller #1095

ryanitus opened this issue Feb 1, 2017 · 2 comments
Assignees
Milestone

Comments

@ryanitus
Copy link

ryanitus commented Feb 1, 2017

I would like to provide my own implementation of the underlying controller, so I can process my own code when an action like "render()" is called.

The ControllersEnhancer is essential to a proper functioning Controller, but it's hard coded to only work for play.mvc.Controller:

    if (field.getDeclaringClass().getName().equals("play.mvc.Controller") || field.getDeclaringClass().getName().equals("play.mvc.WebSocketController")) {

If this could be made more generic, I could provide my own implementation, so rather than controllers extending play.mvc.Controller, I could extend MyController instead. I've verified it works locally by changing .equals("play.mvc.Controller") to .startsWith("play.mvc.").

@asolntsev
Copy link
Contributor

@ryanitus I agree with you.
I suggest to create a "marker" interface like PlayController, so that

  • play.mvc.Controller implements PlayController
  • YourCustomController implements PlayController

Can you prepare a pull request, or do you need my help?

@asolntsev
Copy link
Contributor

Hi @ryanitus !
I have prepared pull request for your suggestion: #1102
Could you review it?
Does it solve your problem?

@asolntsev asolntsev self-assigned this Feb 8, 2017
@asolntsev asolntsev added this to the 1.5.0 milestone Feb 8, 2017
asolntsev added a commit that referenced this issue Feb 14, 2017
Fixes #1095 add marker interface for play controllers
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants