use of com.sun.jersey.spi.container.servlet.ServletContainer in project spring-boot by spring-projects.
the class SampleJersey1Application method jersey.
@Bean
public FilterRegistrationBean<ServletContainer> jersey() {
FilterRegistrationBean<ServletContainer> bean = new FilterRegistrationBean<>();
bean.setFilter(new ServletContainer());
bean.addInitParameter("com.sun.jersey.config.property.packages", "com.sun.jersey;sample.jersey1");
return bean;
}
use of com.sun.jersey.spi.container.servlet.ServletContainer in project appengine-angular-guestbook-java by googlearchive.
the class GuestbookResourceTest method setUp.
@Before
public void setUp() throws ServletException {
helper.setUp();
// Create a jersey ServletContainer object with mocked ServletConfig and ServletContext.
servletContainer = new ServletContainer(Resources.class);
ServletConfig servletConfig = mock(ServletConfig.class);
ServletContext servletContext = mock(ServletContext.class);
when(servletConfig.getServletContext()).thenReturn(servletContext);
servletContainer.init(servletConfig);
}
use of com.sun.jersey.spi.container.servlet.ServletContainer in project spring-cloud-netflix by spring-cloud.
the class EurekaServerAutoConfiguration method jerseyFilterRegistration.
/**
* Register the Jersey filter
*/
@Bean
public FilterRegistrationBean jerseyFilterRegistration(javax.ws.rs.core.Application eurekaJerseyApp) {
FilterRegistrationBean bean = new FilterRegistrationBean();
bean.setFilter(new ServletContainer(eurekaJerseyApp));
bean.setOrder(Ordered.LOWEST_PRECEDENCE);
bean.setUrlPatterns(Collections.singletonList(EurekaConstants.DEFAULT_PREFIX + "/*"));
return bean;
}
use of com.sun.jersey.spi.container.servlet.ServletContainer in project nuxeo-filesystem-connectors by nuxeo.
the class WebDavServerFeature method setUpTomcat.
protected void setUpTomcat() throws Exception {
tomcat = new Tomcat();
// for tmp dir
tomcat.setBaseDir(".");
tomcat.setHostname(HOST);
tomcat.setPort(PORT);
ProtocolHandler p = tomcat.getConnector().getProtocolHandler();
AbstractEndpoint<?> endpoint = (AbstractEndpoint<?>) getFieldValue(p, "endpoint");
// vital for clean shutdown
endpoint.setMaxKeepAliveRequests(1);
File docBase = new File(".");
Context context = tomcat.addContext(CONTEXT, docBase.getAbsolutePath());
Application app = new org.nuxeo.ecm.webdav.Application();
ApplicationAdapter conf = new ApplicationAdapter(app);
conf.getFeatures().put(ResourceConfig.FEATURE_MATCH_MATRIX_PARAMS, Boolean.TRUE);
String servletName = "testServlet";
Servlet servlet = new ServletContainer(conf);
tomcat.addServlet(CONTEXT, servletName, servlet);
context.addServletMappingDecoded("/*", servletName);
addFilter(context, servletName, "RequestContextFilter", new RequestContextFilter());
addFilter(context, servletName, "SessionCleanupFilter", new SessionCleanupFilter());
addFilter(context, servletName, "NuxeoAuthenticationFilter", new NuxeoAuthenticationFilter());
addFilter(context, servletName, "WebEngineFilter", new WebEngineFilter());
tomcat.start();
}
use of com.sun.jersey.spi.container.servlet.ServletContainer in project zookeeper by apache.
the class RestMain method createJerseyAdapter.
private ServletAdapter createJerseyAdapter(Endpoint e) {
ServletAdapter jersey = new ServletAdapter();
jersey.setServletInstance(new ServletContainer());
jersey.addInitParameter("com.sun.jersey.config.property.packages", "org.apache.zookeeper.server.jersey.resources");
jersey.setContextPath(e.getContext());
Credentials c = Credentials.join(e.getCredentials(), cfg.getCredentials());
if (!c.isEmpty()) {
jersey.addFilter(new HTTPBasicAuth(c), e.getContext() + "-basic-auth", null);
}
return jersey;
}
Aggregations