You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The reason why the objects cannot be resolved is because the created context does not implement the correct interface. The resolver is unable to cast and retrieve the value.
Steps to Reproduce
Serve a view using
@View("home")
@Get("/")
public HttpResponse<Object> showHome() {
return HttpResponse.ok();
}
I could make a pull request to solve this issue but it would depend on https://micronaut-projects.github.io/micronaut-servlet/1.0.2/guide/index.html as Micronaut does not expose the servlet api by default.
An alternative would be to implement a IExpressionObjectFactory which adds some defaults for Micronaut and document them.
Predefined networking objects are not working
Coming from https://stackoverflow.com/questions/68305195/micronaut-thymeleaf-request-is-null
Templates that contain #request, #session, ... always give of null for these objects.
I've narrowed it down to the EngineContextFactory building a io.micronaut.views.thymeleaf.WebEngineContext instead of the expected org.thymeleaf.context.WebEngineContext.
The reason why the objects cannot be resolved is because the created context does not implement the correct interface. The resolver is unable to cast and retrieve the value.
Steps to Reproduce
with the view being
requestURL
cannot be read from value null.Expected Behaviour
The template should be able to resolve the
#request
as described by the docs similar to the spring behaviour.Actual Behaviour
The fetched value is always
null
and the view is not renderedEnvironment Information
Notes
I've tried creating my own context which implements the right interface to map those objects but Micronaut does not use the java httpservlet objects.
Workaround
I'm currently using the
#ctx.getRequest()
to get the NettyHttpRequest instance.The text was updated successfully, but these errors were encountered: