Skip to content

Instantly share code, notes, and snippets.

@DmitryVarennikov
Created October 2, 2014 18:11
Show Gist options
  • Save DmitryVarennikov/259156e18b2ac5660dc2 to your computer and use it in GitHub Desktop.
Save DmitryVarennikov/259156e18b2ac5660dc2 to your computer and use it in GitHub Desktop.
Custom app initializer
package cuenation.api;
import org.springframework.web.WebApplicationInitializer;
import org.springframework.web.filter.ShallowEtagHeaderFilter;
import javax.servlet.ServletContext;
import javax.servlet.ServletException;
public class AppInitializer implements WebApplicationInitializer {
/**
* Configure the given {@link javax.servlet.ServletContext} with any servlets, filters, listeners
* context-params and attributes necessary for initializing this web application. See
* examples {@linkplain org.springframework.web.WebApplicationInitializer above}.
*
* @param servletContext the {@code ServletContext} to initialize
* @throws javax.servlet.ServletException if any call against the given {@code ServletContext}
* throws a {@code ServletException}
*/
@Override
public void onStartup(ServletContext servletContext) throws ServletException {
servletContext
.addFilter("ETag", ShallowEtagHeaderFilter.class)
.addMappingForUrlPatterns(null, false, "/cue-categories");
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment