Package com.sun.jersey.spi.container

Examples of com.sun.jersey.spi.container.WebApplication


     * <p>
     * If this method is called when there are pending requests then such
     * requests will be processed using the previously loaded web application.
     */
    public void reload() {
        WebApplication oldApplication = application;
        WebApplication newApplication = create();
        initiate(resourceConfig, newApplication);

        application = newApplication;
        oldApplication.destroy();
    }
View Full Code Here


     */
    @SuppressWarnings("unchecked")
    public static <A> A createContainer(Class<A> type, ResourceConfig resourceConfig,
            IoCComponentProviderFactory factory)
    throws ContainerException, IllegalArgumentException {
        WebApplication wa = WebApplicationFactory.createWebApplication();
       
        // Reverse the order so that applications may override
        LinkedList<ContainerProvider> cps = new LinkedList<ContainerProvider>();
        for (ContainerProvider cp : ServiceFinder.find(ContainerProvider.class, true))
            cps.addFirst(cp);
       
        for (ContainerProvider<A> cp : cps) {
            A c = cp.createContainer(type, resourceConfig, wa);
            if (c != null) {
                // Initiate the web application
                if (!wa.isInitiated()) {
                    wa.initiate(resourceConfig, factory);
                }

                // Register a container listener
                Object o = resourceConfig.getProperties().get(
                        ResourceConfig.PROPERTY_CONTAINER_NOTIFIER);
View Full Code Here

  @Nullable
  private transient WebApplication webApplicationReference;

  @Provides
  public WebApplication webApp( @NotNull GuiceContainer guiceContainer ) {
    WebApplication copy = webApplicationReference;
    if ( copy == null ) {
      WebComponent component = Reflection.field( "webComponent" ).ofType( WebComponent.class ).in( guiceContainer ).get();
      copy = Reflection.field( "application" ).ofType( WebApplication.class ).in( component ).get();
      webApplicationReference = copy;
    }
View Full Code Here

     */
    @SuppressWarnings("unchecked")
    public static <A> A createContainer(Class<A> type, ResourceConfig resourceConfig,
            IoCComponentProviderFactory factory)
    throws ContainerException, IllegalArgumentException {
        WebApplication wa = WebApplicationFactory.createWebApplication();
       
        // Reverse the order so that applications may override
        LinkedList<ContainerProvider> cps = new LinkedList<ContainerProvider>();
        for (ContainerProvider cp : ServiceFinder.find(ContainerProvider.class, true))
            cps.addFirst(cp);
       
        for (ContainerProvider<A> cp : cps) {
            A c = cp.createContainer(type, resourceConfig, wa);
            if (c != null) {
                // Initiate the web application
                if (!wa.isInitiated()) {
                    wa.initiate(resourceConfig, factory);
                }

                // Register a container listener
                Object o = resourceConfig.getProperties().get(
                        ResourceConfig.PROPERTY_CONTAINER_NOTIFIER);
View Full Code Here

                webApp.destroy();
            }
        }

        private WebApplication initiateWebApplication(ResourceConfig rc) {
            WebApplication webapp = WebApplicationFactory.createWebApplication();
            return webapp;
        }
View Full Code Here

            response.close();
        }
    }

    public void handle(Request request, Response response) {
        WebApplication target = application;

        final URI baseUri = getBaseUri(request);
        final URI requestUri = baseUri.resolve(request.getTarget());

        try {
            final ContainerRequest cRequest = new ContainerRequest(
                    target,
                    request.getMethod(),
                    baseUri,
                    requestUri,
                    getHeaders(request),
                    request.getInputStream());

            target.handleRequest(cRequest, new Writer(request, response));
        } catch (Exception ex) {
            throw new RuntimeException(ex);
        } finally {
            close(response);
        }
View Full Code Here

        return header;
    }

    public void onReload() {
        WebApplication oldApplication = application;
        application = application.clone();
        oldApplication.destroy();
    }
View Full Code Here

           response.close();
        }
    }
   
    public void handle(Request request, Response response) {
        WebApplication target = application;
       
        final URI baseUri = getBaseUri(request);
        final URI requestUri = baseUri.resolve(request.getTarget());
       
        try {
            final ContainerRequest cRequest = new ContainerRequest(
                    target,
                    request.getMethod(),
                    baseUri,
                    requestUri,
                    getHeaders(request),
                    request.getInputStream());
          
                target.handleRequest(cRequest, new Writer(request, response));
        } catch (Exception ex) {
            throw new RuntimeException(ex);
        } finally {
           close(response);
        }
View Full Code Here

       
        return header;
    }
   
    public void onReload() {
        WebApplication oldApplication = application;
        application = application.clone();
        oldApplication.destroy();
    }   
View Full Code Here

TOP

Related Classes of com.sun.jersey.spi.container.WebApplication

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.