view web/war/src/main/webapp/WEB-INF/web.xml @ 1110:d586a5747cac

Set THERMOSTAT_HOME via context listener in the web app. Reviewed-by: vanaltj Review-thread: http://icedtea.classpath.org/pipermail/thermostat/2013-May/006668.html
author Severin Gehwolf <sgehwolf@redhat.com>
date Fri, 17 May 2013 19:51:56 +0200
parents dff087c3c875
children
line wrap: on
line source

<!DOCTYPE web-app PUBLIC
 "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
 "http://java.sun.com/dtd/web-app_2_3.dtd" >

<web-app>

  <display-name>Thermostat Web Service</display-name>
  <description>Thermostat Web Service</description> 
  <servlet>
    <init-param>
      <param-name>storage.class</param-name>
      <param-value>com.redhat.thermostat.storage.mongodb.MongoStorageProvider</param-value>
    </init-param>
    <init-param>
      <param-name>storage.endpoint</param-name>
      <param-value>mongodb://127.0.0.1:27518</param-value>
    </init-param>
    <!-- Credentials to use for connecting to the backing storage
         (currently mongodb). Uncomment the following two blocks in
         order to use this username/password for the connection. -->

    <!-- Username to use for connecting to the backing storage
         implementation. -->
    <!--
    <init-param>
      <param-name>storage.username</param-name>
      <param-value>thermostat-webservice</param-value>
    </init-param>
    -->
    <!-- Password to use for connecting to the backing storage
         implementation -->
    <!--
    <init-param>
      <param-name>storage.password</param-name>
      <param-value>supersecrit</param-value>
    </init-param>
    -->
    <!-- The timeout of the token manager in ms -->
    <init-param>
      <param-name>token-manager-timeout</param-name>
      <param-value>3000</param-value>
    </init-param>
    <servlet-name>reststorage-servlet</servlet-name>
    <servlet-class>com.redhat.thermostat.web.server.WebStorageEndPoint</servlet-class>
  </servlet>

  <servlet-mapping>
    <servlet-name>reststorage-servlet</servlet-name>
    <url-pattern>/storage/*</url-pattern>
  </servlet-mapping>

  <security-constraint>
    <web-resource-collection>
      <web-resource-name>Entire Application</web-resource-name>
      <url-pattern>/*</url-pattern>
    </web-resource-collection>
    <auth-constraint>
      <role-name>thermostat-realm</role-name>
    </auth-constraint>
  </security-constraint>

  <login-config>
    <auth-method>BASIC</auth-method>
    <realm-name>Thermostat Realm</realm-name>
  </login-config>

  <security-role>
    <role-name>thermostat-realm</role-name>
  </security-role>
  
  <!-- THERMOSTAT_HOME is set via the listener below -->
  <context-param>
    <param-name>THERMOSTAT_HOME</param-name>
    <param-value>${project.build.directory}/../../../distribution/target/</param-value>
  </context-param>
  
  <listener>
    <listener-class>com.redhat.thermostat.web.server.PropertySettingServletContextListener</listener-class>
  </listener>

</web-app>