Package com.sun.jersey.spi.container

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


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

        if (resourceConfig instanceof ReloadListener)
            ((ReloadListener) resourceConfig).onReload();
View Full Code Here


                       final HttpServletResponse response)
            throws ServletException, IOException {
        // Copy the application field to local instance to ensure that the
        // currently loaded web application is used to process
        // request
        final WebApplication _application = application;

        final ContainerRequest cRequest = createRequest(
                _application,
                request,
                baseUri,
                requestUri);

        cRequest.setSecurityContext(new SecurityContext() {
            public Principal getUserPrincipal() {
                return request.getUserPrincipal();
            }

            public boolean isUserInRole(String role) {
                return request.isUserInRole(role);
            }

            public boolean isSecure() {
                return request.isSecure();
            }

            public String getAuthenticationScheme() {
                return request.getAuthType();
            }
        });

        // Check if any servlet filters have consumed a request entity
        // of the media type application/x-www-form-urlencoded
        // This can happen if a filter calls request.getParameter(...)
        filterFormParameters(request, cRequest);

        try {
            UriRuleProbeProvider.requestStart(requestUri);

            requestInvoker.set(request);
            responseInvoker.set(response);

            final Writer w = new Writer(useSetStatusOn404, response);
            _application.handleRequest(cRequest, w);
            return w.cResponse.getStatus();
        } catch (MappableContainerException ex) {
            traceOnException(cRequest, response);
            throw new ServletException(ex.getCause());
        } catch (ContainerException ex) {
View Full Code Here

    /**
     * Load the Web application. This will create, configure and initiate
     * the web application.
     */
    public void load() {
        WebApplication _application = create();
        configure(config, resourceConfig, _application);
        initiate(resourceConfig, _application);
        application = _application;
    }
View Full Code Here

     * <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 onReload() {
        WebApplication oldApplication = application;
        WebApplication newApplication = create();
        initiate(resourceConfig, newApplication);
        application = newApplication;

        if (resourceConfig instanceof ReloadListener)
            ((ReloadListener) resourceConfig).onReload();
View Full Code Here

    this.resourceConfig = rc;
  }

  @Override
  protected WebApplication create() {
    WebApplication wa = super.create();
    this.wa = wa;
    return wa;
  }
View Full Code Here

            responseInvoker.set(null);
        }
    }

    private void _service(GrizzlyRequest request, GrizzlyResponse response) {
        WebApplication _application = application;
       
        final URI baseUri = getBaseUri(request);
        /*
         * request.unparsedURI() is a URI in encoded form that contains
         * the URI path and URI query components.
         */
        final URI requestUri = baseUri.resolve(
                request.getRequest().unparsedURI().toString());

        /**
         * Check if the request URI path starts with the base URI path
         */
        if (!requestUri.getRawPath().startsWith(basePath)) {
            response.setStatus(404);
            return;
        }

        try {
            final ContainerRequest cRequest = new ContainerRequest(
                    _application,
                    request.getMethod(),
                    baseUri,
                    requestUri,
                    getHeaders(request),
                    request.getInputStream());
           
            _application.handleRequest(cRequest, new Writer(response));
        } catch (IOException ex) {
            throw new RuntimeException(ex);
        }
    }
View Full Code Here

   
    // ContainerListener
   
    @Override
    public void onReload() {
        WebApplication oldApplication = application;
        application = application.clone();

        if (application.getFeaturesAndProperties() instanceof ReloadListener)
            ((ReloadListener) application.getFeaturesAndProperties()).onReload();

        oldApplication.destroy();
    }   
View Full Code Here

    protected void service(URI baseUri, URI requestUri, final HttpServletRequest request, HttpServletResponse response)
            throws ServletException, IOException {
        // Copy the application field to local instance to ensure that the
        // currently loaded web application is used to process
        // request
        final WebApplication _application = application;

        final ContainerRequest cRequest = new ContainerRequest(
                _application,
                request.getMethod(),
                baseUri,
                requestUri,
                getHeaders(request),
                request.getInputStream());
        cRequest.setSecurityContext(new SecurityContext() {
            public Principal getUserPrincipal() {
                return request.getUserPrincipal();
            }

            public boolean isUserInRole(String role) {
                return request.isUserInRole(role);
            }

            public boolean isSecure() {
                return request.isSecure();
            }

            public String getAuthenticationScheme() {
                return request.getAuthType();
            }
        });

        // Check if any servlet filters have consumed a request entity
        // of the media type application/x-www-form-urlencoded
        // This can happen if a filter calls request.getParameter(...)
        filterFormParameters(request, cRequest);

        try {
            requestInvoker.set(request);
            responseInvoker.set(response);

            _application.handleRequest(cRequest, new Writer(response));
        } catch (ContainerException e) {
            throw new ServletException(e);
        } finally {
            requestInvoker.set(null);
            responseInvoker.set(null);
View Full Code Here

    /**
     * Load the Web application. This will create, configure and initiate
     * the web application.
     */
    public final void load() {
        WebApplication _application = create();
        configure(config, resourceConfig, _application);
        initiate(resourceConfig, _application);
        application = _application;
    }
View Full Code Here

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

        application = newApplication;
        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.