Interface ReactRenderPostProcessor
- All Superinterfaces:
io.micronaut.core.order.Ordered
public interface ReactRenderPostProcessor
extends io.micronaut.core.order.Ordered
Appends to a server-rendered React page once the component has been written.
Implement this to add something to every rendered page without touching the render script --
a development-mode reload listener is the motivating case, and
micronaut-views-react-dev ships one.
There is deliberately no HTTP filter equivalent. A @View route's response body is a
ModelAndView while filters run, and the markup is not produced until a
MessageBodyWriter encodes it, after the last filter. This is the point at which rendered
markup exists.
Beans are invoked in Ordered order, after the component's own output and before the
writer is flushed.
- Since:
- 6.2.1
-
Field Summary
Fields inherited from interface io.micronaut.core.order.Ordered
HIGHEST_PRECEDENCE, LOWEST_PRECEDENCE -
Method Summary
Modifier and TypeMethodDescriptionvoidafterRender(Writer writer, @Nullable io.micronaut.http.HttpRequest<?> request) Called once per render, after the component has written its markup.Methods inherited from interface io.micronaut.core.order.Ordered
getOrder
-
Method Details
-
afterRender
void afterRender(Writer writer, @Nullable io.micronaut.http.HttpRequest<?> request) throws IOException Called once per render, after the component has written its markup.- Parameters:
writer- the writer the page was rendered torequest- the request being answered, ornullfor a render that is not going to a browser -- an email body built bymicronaut-email-templateis the common case, and usually wants nothing added- Throws:
IOException- if writing fails
-