Package org.glassfish.jersey.servlet

Examples of org.glassfish.jersey.servlet.ServletContainer


  }

  private void unregisterServletWhenNoresourcePresents() {
    if( !getRootApplication().hasResources() ) {
      httpService.unregister( rootPath );
      servletContainer = new ServletContainer( ResourceConfig.forApplication( application ) );
      isApplicationRegistered = false;
    }
  }
View Full Code Here


    this.httpService = httpService;
    this.rootPath = rootPath == null ? "/services" : rootPath;
    this.application = new RootApplication();
    disableAutoDiscovery();
    disableWadl( isWadlDisabled );
    this.servletContainer = new ServletContainer( ResourceConfig.forApplication( application ) );
  }
View Full Code Here

  }

  private void unregisterServletWhenNoresourcePresents() {
    if( !getRootApplication().hasResources() ) {
      httpService.unregister( rootPath );
      servletContainer = new ServletContainer( ResourceConfig.forApplication( application ) );
      isApplicationRegistered = false;
    }
  }
View Full Code Here

    private void addServletWithDefaultConfiguration(ServletContext sc, Set<Class<?>> classes) throws ServletException {
        ServletRegistration appReg = sc.getServletRegistration(Application.class.getName());
        if (appReg != null && appReg.getClassName() == null) {
            final Set<Class<?>> appClasses = getRootResourceAndProviderClasses(classes);
            final ServletContainer s = new ServletContainer(
                    ResourceConfig.forApplicationClass(ResourceConfig.class, appClasses).addProperties(getInitParams(appReg))
                    .addProperties(WebComponent.getContextParams(sc))
            );
            appReg = sc.addServlet(appReg.getName(), s);
View Full Code Here

            final Class<? extends Application> a, final Set<Class<?>> classes) throws ServletException {
        final ApplicationPath ap = a.getAnnotation(ApplicationPath.class);
        if (ap != null) {
            // App is annotated with ApplicationPath
            final ResourceConfig rc = ResourceConfig.forApplicationClass(a, classes);
            final ServletContainer s = new ServletContainer(rc);

            final ServletRegistration.Dynamic dsr = sc.addServlet(a.getName(), s);
            dsr.setAsyncSupported(true);

            final String mapping = createMappingPath(ap);
View Full Code Here

            final Class<? extends Application> a, final Set<Class<?>> classes) throws ServletException {
        if (sr.getClassName() == null) {
            // create a new servlet container for a given app.
            final ResourceConfig rc = ResourceConfig.forApplicationClass(a, classes).addProperties(getInitParams(sr))
                    .addProperties(WebComponent.getContextParams(sc));
            final ServletContainer s = new ServletContainer(rc);

            ServletRegistration.Dynamic dsr = sc.addServlet(a.getName(), s);
            dsr.setAsyncSupported(true);

            if (dsr.getMappings().isEmpty()) {
View Full Code Here

  @Bean
  @ConditionalOnMissingBean(name = "jerseyServletRegistration")
  public ServletRegistrationBean jerseyServletRegistration() {
    Class<? extends ResourceConfig> configType = this.config.getClass();
    ServletRegistrationBean registration = new ServletRegistrationBean(
        new ServletContainer(), this.path);
    registration.addInitParameter(ServletProperties.JAXRS_APPLICATION_CLASS,
        configType.getName());
    registration.setName("jerseyServlet");
    return registration;
  }
View Full Code Here

  public JerseyContext( HttpService httpService, String rootPath ) {
    this.httpService = httpService;
    this.rootPath = rootPath == null ? "/services" : rootPath;
    this.application = new RootApplication();
    this.servletContainer = new ServletContainer( ResourceConfig.forApplication( application ) );
  }
View Full Code Here

  }

  private void unregisterServletWhenNoresourcePresents() {
    if( !getRootApplication().hasResources() ) {
      httpService.unregister( rootPath );
      servletContainer = new ServletContainer( ResourceConfig.forApplication( application ) );
      isApplicationRegistered = false;
    }
  }
View Full Code Here

  public EmbeddedServletContainerFactory servletContainerFactory() {
    JettyEmbeddedServletContainerFactory factory = new JettyEmbeddedServletContainerFactory();
    factory.setPort(8080);
    factory.addServerCustomizers(new JettyServerCustomizer() {
      public void customize(Server server) {
        ServletContainer servletContainer = new ServletContainer(new Api1());
        ServletHolder sh = new ServletHolder(servletContainer);

        ServletContextHandler context = new ServletContextHandler(ServletContextHandler.NO_SESSIONS);
        context.setContextPath("/");
        context.addServlet(sh, Api1.PATH + "*");
 
View Full Code Here

TOP

Related Classes of org.glassfish.jersey.servlet.ServletContainer

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.