Skip to content

Instantly share code, notes, and snippets.

@nhojpatrick
Created February 2, 2017 17:32
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save nhojpatrick/b720671159f2e38735fa597550d5b272 to your computer and use it in GitHub Desktop.
Grizzly Servlet Filter
HttpServer server = new GrizzlyHttpServerFactory.createHttpServer(uri, resourceConfig);
server.getServerConfiguration()
.addHttpHandler(new CLStaticHttpHandler(Application.class.getClassLoader()), "/");
WebappContext webappContext = new WebappContext("grizzly web context", "/");
FilterRegistration filterRegistration = webappContext.addFilter("MyFilter", MyFilter.class);
filterRegistration.addMappingForUrlPatterns(EnumSet.of(DispatcherType.REQUEST), "/*");
webappContext.deploy(server);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment