You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@karaf.apache.org by conejo <lo...@gmail.com> on 2016/03/03 08:35:47 UTC
Jetty dynamic redirection
Good Morning.
I wonder if redirections can be added dynamically without restarting jetty.
I know with pax-web handlers can be added as services but have not found an
appropriate example.
The idea is that by modifying a configuration file (or similar mechanism)
can add or remove redirects on the server without having to reboot.
For example, a rule like this could be added or changed without restarting
the server.
<Call name="addRule">
<Arg>
<New class="org.eclipse.jetty.rewrite.handler.RedirectPatternRule">
<Set name="pattern">/gestorWeb</Set>
<Set name="location">http://localhost:8181/manager</ Set>
</New>
</Arg>
</Call>
--
View this message in context: http://karaf.922171.n3.nabble.com/Jetty-dynamic-redirection-tp4045668.html
Sent from the Karaf - User mailing list archive at Nabble.com.
Re: Jetty dynamic redirection
Posted by conejo <lo...@gmail.com>.
I think I have the answer. The following data file can create a service that
allows you to add redirections. It can serve as a working basis.
<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0">
<service ref="rewriteHandler"
interface="org.eclipse.jetty.server.Handler"/>
<bean id="rewriteHandler"
class="org.eclipse.jetty.rewrite.handler.RewriteHandler">
<property name="rewriteRequestURI" value="true"/>
<property name="rewritePathInfo" value="false"/>
<property name="originalPathAttribute" value="requestedPath"/>
<property name="rules">
<list>
<ref component-id="redirectPatternRule"/>
</list>
</property>
</bean>
<bean id="redirectPatternRule"
class="org.eclipse.jetty.rewrite.handler.RedirectPatternRule">
<property name="terminating" value="true"/>
<property name="pattern" value="/console"/>
<property name="location" value="/system/console"/>
</bean>
</blueprint>
--
View this message in context: http://karaf.922171.n3.nabble.com/Jetty-dynamic-redirection-tp4045668p4045679.html
Sent from the Karaf - User mailing list archive at Nabble.com.