Search in sources :

Example 1 with ServletContainer

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;
}
Also used : ServletContainer(com.sun.jersey.spi.container.servlet.ServletContainer) FilterRegistrationBean(org.springframework.boot.web.servlet.FilterRegistrationBean) FilterRegistrationBean(org.springframework.boot.web.servlet.FilterRegistrationBean) Bean(org.springframework.context.annotation.Bean)

Example 2 with ServletContainer

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);
}
Also used : ServletContainer(com.sun.jersey.spi.container.servlet.ServletContainer) Resources(com.google.appengine.samples.angularjs_guestbook.config.Resources) Before(org.junit.Before)

Example 3 with ServletContainer

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;
}
Also used : ServletContainer(com.sun.jersey.spi.container.servlet.ServletContainer) FilterRegistrationBean(org.springframework.boot.web.servlet.FilterRegistrationBean) FilterRegistrationBean(org.springframework.boot.web.servlet.FilterRegistrationBean) ConditionalOnBean(org.springframework.boot.autoconfigure.condition.ConditionalOnBean) ConditionalOnMissingBean(org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean) Bean(org.springframework.context.annotation.Bean)

Example 4 with ServletContainer

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();
}
Also used : Context(org.apache.catalina.Context) AbstractEndpoint(org.apache.tomcat.util.net.AbstractEndpoint) Tomcat(org.apache.catalina.startup.Tomcat) RequestContextFilter(org.nuxeo.ecm.webengine.jaxrs.context.RequestContextFilter) SessionCleanupFilter(org.nuxeo.ecm.webengine.jaxrs.session.SessionCleanupFilter) WebEngineFilter(org.nuxeo.ecm.webengine.app.WebEngineFilter) ProtocolHandler(org.apache.coyote.ProtocolHandler) ServletContainer(com.sun.jersey.spi.container.servlet.ServletContainer) Servlet(javax.servlet.Servlet) ApplicationAdapter(com.sun.jersey.api.core.ApplicationAdapter) NuxeoAuthenticationFilter(org.nuxeo.ecm.platform.ui.web.auth.NuxeoAuthenticationFilter) File(java.io.File) Application(javax.ws.rs.core.Application)

Example 5 with ServletContainer

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;
}
Also used : ServletAdapter(com.sun.grizzly.http.servlet.ServletAdapter) ServletContainer(com.sun.jersey.spi.container.servlet.ServletContainer) HTTPBasicAuth(org.apache.zookeeper.server.jersey.filters.HTTPBasicAuth) Credentials(org.apache.zookeeper.server.jersey.cfg.Credentials)

Aggregations

ServletContainer (com.sun.jersey.spi.container.servlet.ServletContainer)14 ServletHolder (org.eclipse.jetty.servlet.ServletHolder)9 Server (org.eclipse.jetty.server.Server)7 ServletContextHandler (org.eclipse.jetty.servlet.ServletContextHandler)7 ResourceConfig (com.sun.jersey.api.core.ResourceConfig)6 DefaultResourceConfig (com.sun.jersey.api.core.DefaultResourceConfig)4 DispatcherType (javax.servlet.DispatcherType)3 MediaType (javax.ws.rs.core.MediaType)3 AbstractSessionManager (org.eclipse.jetty.server.session.AbstractSessionManager)3 FilterHolder (org.eclipse.jetty.servlet.FilterHolder)3 ApplicationAdapter (com.sun.jersey.api.core.ApplicationAdapter)2 File (java.io.File)2 EnvironmentLoaderListener (org.apache.shiro.web.env.EnvironmentLoaderListener)2 FilterRegistrationBean (org.springframework.boot.web.servlet.FilterRegistrationBean)2 Bean (org.springframework.context.annotation.Bean)2 DelegatingFilterProxy (org.springframework.web.filter.DelegatingFilterProxy)2 AnnisRunnerException (annis.AnnisRunnerException)1 MultipleIniWebEnvironment (annis.security.MultipleIniWebEnvironment)1 StorageApplication (com.emc.storageos.api.service.impl.resource.StorageApplication)1 DataObject (com.emc.storageos.db.client.model.DataObject)1