diff --git a/guacamole-tunnel/src/main/java/org/openuds/guacamole/UDSModule.java b/guacamole-tunnel/src/main/java/org/openuds/guacamole/UDSModule.java index 344a9ae9..76e904d1 100644 --- a/guacamole-tunnel/src/main/java/org/openuds/guacamole/UDSModule.java +++ b/guacamole-tunnel/src/main/java/org/openuds/guacamole/UDSModule.java @@ -28,7 +28,7 @@ package org.openuds.guacamole; -import com.google.inject.AbstractModule; +import com.google.inject.servlet.ServletModule; import com.sun.jersey.guice.spi.container.servlet.GuiceContainer; import org.apache.guacamole.tunnel.TunnelRequestService; import org.openuds.guacamole.config.ConfigurationService; @@ -38,10 +38,10 @@ import org.openuds.guacamole.connection.ConnectionService; * Guice module which binds classes required by the OpenUDS integration of * Apache Guacamole. */ -public class UDSModule extends AbstractModule { +public class UDSModule extends ServletModule { @Override - protected void configure() { + protected void configureServlets() { // Serve servlets, etc. with Guice bind(GuiceContainer.class); diff --git a/guacamole-tunnel/src/main/java/org/openuds/guacamole/config/ConfigurationService.java b/guacamole-tunnel/src/main/java/org/openuds/guacamole/config/ConfigurationService.java index fe4d19f9..d6113b77 100644 --- a/guacamole-tunnel/src/main/java/org/openuds/guacamole/config/ConfigurationService.java +++ b/guacamole-tunnel/src/main/java/org/openuds/guacamole/config/ConfigurationService.java @@ -28,6 +28,7 @@ package org.openuds.guacamole.config; +import com.google.inject.Inject; import com.google.inject.Singleton; import java.io.BufferedReader; import java.io.FileReader; @@ -35,6 +36,7 @@ import java.io.IOException; import java.net.URI; import java.net.URISyntaxException; import java.util.Properties; +import javax.servlet.ServletContext; import org.apache.guacamole.GuacamoleException; import org.apache.guacamole.GuacamoleServerException; import org.slf4j.Logger; @@ -161,13 +163,18 @@ public class ConfigurationService { * resulting errors will simply be logged. If configuration information * cannot be read, attempts to retrieve this information later through calls * to the getters of this service will fail with appropriate exceptions. + * + * @param context + * The ServletContext associated with the servlet container which is + * serving this web application. */ - public ConfigurationService() { + @Inject + public ConfigurationService(ServletContext context) { // Read tunnel.properties Properties config = new Properties(); try { - config.load(ConfigurationService.class.getResourceAsStream("/WEB-INF/tunnel.properties")); + config.load(context.getResourceAsStream("/WEB-INF/tunnel.properties")); } catch (IOException e) { logger.error("Unable to read tunnel.properties.", e);