-
Notifications
You must be signed in to change notification settings - Fork 11
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
Remove Groovy dependencies from framework
#65
Comments
Yes, that's right: initially module Good point, I will remove it. |
I think Groovy clocks in as one of RePlay's heaviest dependencies.
As said, this will require a new way to deal with the error page rendering (currently Groovy based). |
@cies But how do you solve error page rendering in your Kotlin-based project? |
We have not come to the error pages yet. They are at the bottom of our list. We are currently on 95% Kotlinx.html in the "customer login" part, but for the "shops part" we will port over the GT pages to an SPA approach later next year. The error pages are the same for both those parts and we override some that come with RePlay with out own:
I've briefly looked into how it is possible to port the GT for error pages to Kotlinx.html and found that would likely require some changes in RePlay as it currently is. It was a quick assessment some time ago, so I'm not really sure. Back then I thought it was acceptable, given that that our error pages are few in number and low in logic. If you are interested in the approach I'd take for this, I can have a look at it:
Off the bat see some ways overriding can be performed:
|
@cies Probably I see a simple solution here. We can use the fact that every Replay plugin can override method
|
Not sure if that works for us. To illustrate this, 2 snippets of template invocation: return viewResult().with("bulkRefunds", refunds); and return new views.intern.ui.refunds.Index(this).render(refunds); As you can see we do not use the template selecting/loading/rendering engine at all! Our templates are now simple method (or function) calls. This makes 'm very type safe (no So the approach you suggest would:
Certainly this is doable, and a great way to rid ourselves eventually from the dependency on Groovy, so that's great! Yet I was more interested in an approach that does not involve Either way I'd be very happy with the result :) Just that we are trying to move towards typed APIs. |
Just did a bit of research on removing Groovy from
But this is not enough. Stopping here will make the templates in public interface ErrorHandler {
Result serve400(ActionContext actionContext);
Result serve403(ActionContext actionContext);
Result serve404(ActionContext actionContext);
Result serve500(ActionContext actionContext);
} But this would change the way a replay app needs to be started. So there's probably some way in Java to allow for a default implementation that can be overwritten. The default can then simply fail at runtime if It's quite a bit of work. I'm interested in doing it but only if you, @asolntsev, agree with the approach and think it is both feasible and worthwhile. Thanks for looking into this, again (we're close to having all groovy code ported to kotlinx-html and I would not mind dropping this dependency entirely -- dynamic execution is box of attack vectors in my opinion, and it's the largest dependency, larger than hibernate). |
@cies Generally, I agree with your suggestions. Let's do it. The only thing I would suggest is the default implementation of ErrorHandler methods. |
Sounds good. What about the defaults? Simply by making the methods And to supply the an implementation of public Play(ConfLoader confLoader, BeanSource beanSource, SessionStore sessionStore, ErrorHandler errorHandler) {
// ...
} |
After my first attempt (take it a s a draft), these are my findings:
This only when it's decided that we want to decouple template "all the way":
The main question is: shall I proceed to implement "all the way" decoupling (as explained above), or do we want to merge the PR in its approximate current form (first)? In it's current form Groovy is no longer a dependency of |
it allows to fully avoid Groovy dependencies for users with another templating engine (e.g. Kotlin templates).
it allows to fully avoid Groovy dependencies for users with another templating engine (e.g. Kotlin templates).
it allows to fully avoid Groovy dependencies for users with another templating engine (e.g. Kotlin templates).
it allows to fully avoid Groovy dependencies for users with another templating engine (e.g. Kotlin templates).
I may be wrong, so please bear with me.
The existence of the
fastergt
plugin hints that RePlay provides GroovyTemplates as a plugin. But GroovyTemplates are also used byframework
, henceframework
depending on Groovy.A good reason for this is that the error pages (in
framework/errors/
) are GT-based.Groovy is quite a heavy dependency, and we are well underway to port all GT code over to Kotlinx.html. Would it be cool if I took a stab at removing Groovy as a dependency of
framework
: error pages should still work out of the box (I'll probably code them in Java then), but GT functionality then depends loading thefastergt
plugin.Maybe I miss that
fastergt
only makes the GTs faster, and that this functionality is intended to be "slow as part offramework
" and only fast when the plugin is loaded.The text was updated successfully, but these errors were encountered: