Nicolas Therrien et al.,
Thank you for sharing your custom RewriteHandler for use with Angular 6 routing. I am having trouble using it, however, because I am using XML configuration (non-embedded Jetty). My problem is I do not know how to access a reference to
the WebAppContext in my jetty-rewrite.xml file. Whereas you have instantiated the WebAppContext and the Html5PushStateConditionalRewriteHandler in a single Java file, and can simply pass the reference, I am seemingly forced to configure these objects in separate
Jetty IoC XML files (jetty-web.xml configures the WebAppContext and jett-rewrite.xml configures the Html5PushStateConditionalRewriteHandler).
Do you (or anyone else reading this) know a way I might access a reference to the WebAppContext configured in jetty-web.xml from within jetty-rewrite.xml? Or perhaps another way to access the “mappedServlet” within the custom RewriteHandler?
I tried adding an id to the WebAppContext in jetty-web.xml and using a Ref tag in jetty-rewrite.xml but the reference comes back null.
jetty-web.xml:
…
<Configure id="webAppContext" class="org.eclipse.jetty.webapp.WebAppContext">
…
jetty-rewrite.xml:
…
<Configure id="Server" class="org.eclipse.jetty.server.Server">
<Call name="insertHandler">
<Arg>
<New class="my.package.Html5PushStateConditionalRewriteHandler">
<Arg name="webAppContext"><Ref refid="webAppContext"/></Arg>
…
Thanks,
Peter Currivan