Align jetty-demo.xml with jetty.xml so we have the new web console included also.

This commit is contained in:
Claus Ibsen 2013-10-10 16:26:53 +02:00
parent e1b171e013
commit 3ae37a9ba3
1 changed files with 48 additions and 8 deletions

View File

@ -26,13 +26,24 @@
</bean> </bean>
<bean id="securityConstraint" class="org.eclipse.jetty.util.security.Constraint"> <bean id="securityConstraint" class="org.eclipse.jetty.util.security.Constraint">
<property name="name" value="BASIC" />
<property name="roles" value="user,admin" />
<!-- set authenticate=false to disable login -->
<property name="authenticate" value="true" />
</bean>
<bean id="adminSecurityConstraint" class="org.eclipse.jetty.util.security.Constraint">
<property name="name" value="BASIC" /> <property name="name" value="BASIC" />
<property name="roles" value="admin" /> <property name="roles" value="admin" />
<!-- set authenticate=false to disable login -->
<property name="authenticate" value="true" /> <property name="authenticate" value="true" />
</bean> </bean>
<bean id="securityConstraintMapping" class="org.eclipse.jetty.security.ConstraintMapping"> <bean id="securityConstraintMapping" class="org.eclipse.jetty.security.ConstraintMapping">
<property name="constraint" ref="securityConstraint" /> <property name="constraint" ref="securityConstraint" />
<property name="pathSpec" value="/*" /> <property name="pathSpec" value="/admin/*,*.jsp" />
</bean>
<bean id="adminSecurityConstraintMapping" class="org.eclipse.jetty.security.ConstraintMapping">
<property name="constraint" ref="adminSecurityConstraint" />
<property name="pathSpec" value="*.action" />
</bean> </bean>
<bean id="securityHandler" class="org.eclipse.jetty.security.ConstraintSecurityHandler"> <bean id="securityHandler" class="org.eclipse.jetty.security.ConstraintSecurityHandler">
<property name="loginService" ref="securityLoginService" /> <property name="loginService" ref="securityLoginService" />
@ -41,6 +52,7 @@
</property> </property>
<property name="constraintMappings"> <property name="constraintMappings">
<list> <list>
<ref bean="adminSecurityConstraintMapping" />
<ref bean="securityConstraintMapping" /> <ref bean="securityConstraintMapping" />
</list> </list>
</property> </property>
@ -49,13 +61,13 @@
<property name="handlers"> <property name="handlers">
<list> <list>
<bean class="org.eclipse.jetty.webapp.WebAppContext"> <bean class="org.eclipse.jetty.webapp.WebAppContext">
<property name="contextPath" value="/admin" /> <property name="contextPath" value="/hawtio" />
<property name="resourceBase" value="${activemq.home}/webapps/admin" /> <property name="war" value="${activemq.home}/webapps/hawtio" />
<property name="logUrlOnStart" value="true" /> <property name="logUrlOnStart" value="true" />
</bean> </bean>
<bean class="org.eclipse.jetty.webapp.WebAppContext"> <bean class="org.eclipse.jetty.webapp.WebAppContext">
<property name="contextPath" value="/demo" /> <property name="contextPath" value="/admin" />
<property name="resourceBase" value="${activemq.home}/webapps-demo/demo" /> <property name="resourceBase" value="${activemq.home}/webapps/admin" />
<property name="logUrlOnStart" value="true" /> <property name="logUrlOnStart" value="true" />
</bean> </bean>
<bean class="org.eclipse.jetty.webapp.WebAppContext"> <bean class="org.eclipse.jetty.webapp.WebAppContext">
@ -64,6 +76,16 @@
<property name="logUrlOnStart" value="true" /> <property name="logUrlOnStart" value="true" />
<property name="parentLoaderPriority" value="true" /> <property name="parentLoaderPriority" value="true" />
</bean> </bean>
<bean class="org.eclipse.jetty.webapp.WebAppContext">
<property name="contextPath" value="/demo" />
<property name="resourceBase" value="${activemq.home}/webapps-demo/demo" />
<property name="logUrlOnStart" value="true" />
</bean>
<bean class="org.eclipse.jetty.webapp.WebAppContext">
<property name="contextPath" value="/api" />
<property name="resourceBase" value="${activemq.home}/webapps/api" />
<property name="logUrlOnStart" value="true" />
</bean>
<bean class="org.eclipse.jetty.server.handler.ResourceHandler"> <bean class="org.eclipse.jetty.server.handler.ResourceHandler">
<property name="directoriesListed" value="false" /> <property name="directoriesListed" value="false" />
<property name="welcomeFiles"> <property name="welcomeFiles">
@ -82,16 +104,33 @@
</property> </property>
</bean> </bean>
<bean id="rewrite" class="org.eclipse.jetty.rewrite.handler.RewriteHandler">
<property name="rules">
<set>
<bean class="org.eclipse.jetty.rewrite.handler.RedirectRegexRule">
<property name="regex" value="/api/jolokia(.*)"/>
<property name="replacement" value="/hawtio/jolokia$1"/>
</bean>
</set>
</property>
</bean>
<bean id="contexts" class="org.eclipse.jetty.server.handler.ContextHandlerCollection"> <bean id="contexts" class="org.eclipse.jetty.server.handler.ContextHandlerCollection">
</bean> </bean>
<bean id="Server" class="org.eclipse.jetty.server.Server" init-method="start" <bean id="jettyPort" class="org.apache.activemq.web.WebConsolePort" init-method="start">
<!-- the default port number for the web console -->
<property name="port" value="8161"/>
</bean>
<bean id="Server" depends-on="jettyPort" class="org.eclipse.jetty.server.Server" init-method="start"
destroy-method="stop"> destroy-method="stop">
<property name="connectors"> <property name="connectors">
<list> <list>
<bean id="Connector" class="org.eclipse.jetty.server.nio.SelectChannelConnector"> <bean id="Connector" class="org.eclipse.jetty.server.nio.SelectChannelConnector">
<property name="port" value="8161" /> <!-- see the jettyPort bean -->
<property name="port" value="#{systemProperties['jetty.port']}" />
</bean> </bean>
<!-- <!--
Enable this connector if you wish to use https with web console Enable this connector if you wish to use https with web console
@ -110,6 +149,7 @@
<bean id="handlers" class="org.eclipse.jetty.server.handler.HandlerCollection"> <bean id="handlers" class="org.eclipse.jetty.server.handler.HandlerCollection">
<property name="handlers"> <property name="handlers">
<list> <list>
<ref bean="rewrite"/>
<ref bean="contexts" /> <ref bean="contexts" />
<ref bean="securityHandler" /> <ref bean="securityHandler" />
</list> </list>
@ -119,4 +159,4 @@
</bean> </bean>
</beans> </beans>