Created
November 9, 2011 20:28
-
-
Save markchadwick/1352886 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class RoutingModule extends ServletModule { | |
override def configureServlets() = { | |
filter("*").through(classOf[vistar.adserver.servlet.LoggingFilter]) | |
serve("/api/v1/get_ad/json").with(classOf[JsonAdRequestHandler]) | |
serve("/api/v1/get_ad/park/*").with(classOf[ParkMediaAdRequestHandler]) | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.rightaction.servlet | |
class ServletConfig extends GuiceServletContextListener { | |
private var injector: Injector = null | |
override def getInjector = { | |
Guice.createInjector(new ProductionModule(), | |
new InstrumentationModule(), | |
new RoutingModule()) | |
} | |
// You get normal ServletContextListener methods here, so context created and | |
// context destroyed stuff. You can hide .init() calls here for now | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="UTF-8"?> | |
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | |
xmlns="http://java.sun.com/xml/ns/javaee" | |
xmlns:web="http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd" | |
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd" | |
version="2.4"> | |
<listener> | |
<listener-class>com.rightaction.servlet.ServletConfig</listener-class> | |
</listener> | |
<filter> | |
<filter-name>guiceFilter</filter-name> | |
<filter-class>com.google.inject.servlet.GuiceFilter</filter-class> | |
</filter> | |
<filter-mapping> | |
<filter-name>guiceFilter</filter-name> | |
<url-pattern>/*</url-pattern> | |
</filter-mapping> | |
</web-app> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment