Package org.glassfish.appclient.server.core.jws.servedcontent

Examples of org.glassfish.appclient.server.core.jws.servedcontent.DynamicContent$InstanceAdapter


    }

    private void processDynamicContent(final Properties tokens,
            final String relativeURIString,
            final Request gReq, final Response gResp) throws IOException {
        final DynamicContent dc = dynamicContent.get(relativeURIString);
        if (dc == null) {
            respondNotFound(gResp);
            logger.log(Level.FINE, "{0} Could not find dynamic content requested using {1}",
                    new Object[]{logPrefix(), relativeURIString});
            return;
        }
        if ( ! dc.isAvailable()) {
            finishErrorResponse(gResp, contentStateToResponseStatus(dc));
            logger.log(Level.FINE, "{0}Found dynamic content ({1} but is is not marked as available",
                    new Object[]{logPrefix(), relativeURIString});
            return;
        }

        /*
         * Assign values for all the properties which we must compute
         * at request time, such as the scheme, host, port, and
         * items from the query string.  This merges the request-time
         * tokens with those that were known when this adapter was created.
         */
        Properties allTokens = null;
        try {
            allTokens = prepareRequestPlaceholders(tokens, gReq);
        } catch (Exception e) {
            logger.log(Level.SEVERE, "prepareRequestPlaceholder", e);
            finishErrorResponse(gResp, HttpServletResponse.SC_INTERNAL_SERVER_ERROR);
        }

        /*
         * Create an instance of the dynamic content using the dynamic
         * content's template and the just-prepared properties.
         */
        final DynamicContent.Instance instance = dc.getOrCreateInstance(allTokens);
        final Date instanceTimestamp = instance.getTimestamp();

        if (returnIfClientCacheIsCurrent(relativeURIString, gReq,
                instanceTimestamp.getTime())) {
            return;
        }

        gResp.setDateHeader(LAST_MODIFIED_HEADER_NAME, instanceTimestamp.getTime());
        gResp.setDateHeader(DATE_HEADER_NAME, System.currentTimeMillis());
        gResp.setContentType(dc.getMimeType());
        gResp.setStatus(HttpServletResponse.SC_OK);

        /*
         * Only for GET should the response actually contain the content.
         * Java Web Start uses HEAD to find out when the target was last
View Full Code Here


    }

    private void processDynamicContent(final Properties tokens,
            final String relativeURIString,
            final GrizzlyRequest gReq, final GrizzlyResponse gResp) throws IOException {
        final DynamicContent dc = dynamicContent.get(relativeURIString);
        if (dc == null) {
            respondNotFound(gResp);
            logger.log(Level.FINE, "{0} Could not find dynamic content requested using {1}",
                    new Object[]{logPrefix(), relativeURIString});
            return;
        }
        if ( ! dc.isAvailable()) {
            finishErrorResponse(gResp, contentStateToResponseStatus(dc));
            logger.log(Level.FINE, "{0}Found dynamic content ({1} but is is not marked as available",
                    new Object[]{logPrefix(), relativeURIString});
            return;
        }

        /*
         * Assign values for all the properties which we must compute
         * at request time, such as the scheme, host, port, and
         * items from the query string.  This merges the request-time
         * tokens with those that were known when this adapter was created.
         */
        Properties allTokens = null;
        try {
            allTokens = prepareRequestPlaceholders(tokens, gReq);
        } catch (Exception e) {
            logger.log(Level.SEVERE, "prepareRequestPlaceholder", e);
            finishErrorResponse(gResp, HttpServletResponse.SC_INTERNAL_SERVER_ERROR);
        }

        /*
         * Create an instance of the dynamic content using the dynamic
         * content's template and the just-prepared properties.
         */
        final DynamicContent.Instance instance = dc.getOrCreateInstance(allTokens);
        final Date instanceTimestamp = instance.getTimestamp();

        if (returnIfClientCacheIsCurrent(relativeURIString, gReq,
                instanceTimestamp.getTime())) {
            return;
        }

        gResp.setDateHeader(LAST_MODIFIED_HEADER_NAME, instanceTimestamp.getTime());
        gResp.setDateHeader(DATE_HEADER_NAME, System.currentTimeMillis());
        gResp.setContentType(dc.getMimeType());
        gResp.setStatus(HttpServletResponse.SC_OK);

        /*
         * Only for GET should the response actually contain the content.
         * Java Web Start uses HEAD to find out when the target was last
View Full Code Here

    }

    private void processDynamicContent(final Properties tokens,
            final String relativeURIString,
            final Request gReq, final Response gResp) throws IOException, URISyntaxException {
        final DynamicContent dc = dynamicContent.get(relativeURIString);
        if (dc == null) {
            respondNotFound(gResp);
            logger.log(Level.FINE, "{0} Could not find dynamic content requested using {1}",
                    new Object[]{logPrefix(), relativeURIString});
            return;
        }
        final URI requestURI = requestURI(gReq);
        if ( ! dc.isAvailable(requestURI)) {
            finishErrorResponse(gResp, contentStateToResponseStatus(dc, requestURI));
            logger.log(Level.FINE, "{0} Found dynamic content ({1} but is is not marked as available",
                    new Object[]{logPrefix(), relativeURIString});
            return;
        }

        /*
         * Assign values for all the properties which we must compute
         * at request time, such as the scheme, host, port, and
         * items from the query string.  This merges the request-time
         * tokens with those that were known when this adapter was created.
         */
        Properties allTokens = null;
        try {
            allTokens = prepareRequestPlaceholders(tokens, gReq);
        } catch (Exception e) {
            logger.log(Level.SEVERE, "prepareRequestPlaceholder", e);
            finishErrorResponse(gResp, HttpServletResponse.SC_INTERNAL_SERVER_ERROR);
        }

        /*
         * Create an instance of the dynamic content using the dynamic
         * content's template and the just-prepared properties.
         */
        final DynamicContent.Instance instance = dc.getOrCreateInstance(allTokens);
        final Date instanceTimestamp = instance.getTimestamp();

        if (returnIfClientCacheIsCurrent(relativeURIString, gReq,
                instanceTimestamp.getTime())) {
            return;
        }

        gResp.setDateHeader(LAST_MODIFIED_HEADER_NAME, instanceTimestamp.getTime());
        gResp.setDateHeader(DATE_HEADER_NAME, System.currentTimeMillis());
        gResp.setContentType(dc.getMimeType());
        gResp.setStatus(HttpServletResponse.SC_OK);
        String text = instance.getText();
       
        if (dc.isMain()) {
            saveJNLPWithSession(gReq, text, requestURI);
        }
       
        /*
         * Only for GET should the response actually contain the content.
View Full Code Here

    }

    private void processDynamicContent(final Properties tokens,
            final String relativeURIString,
            final Request gReq, final Response gResp) throws IOException {
        final DynamicContent dc = dynamicContent.get(relativeURIString);
        if (dc == null) {
            respondNotFound(gResp);
            logger.log(Level.FINE, "{0} Could not find dynamic content requested using {1}",
                    new Object[]{logPrefix(), relativeURIString});
            return;
        }
        if ( ! dc.isAvailable()) {
            finishErrorResponse(gResp, contentStateToResponseStatus(dc));
            logger.log(Level.FINE, "{0}Found dynamic content ({1} but is is not marked as available",
                    new Object[]{logPrefix(), relativeURIString});
            return;
        }

        /*
         * Assign values for all the properties which we must compute
         * at request time, such as the scheme, host, port, and
         * items from the query string.  This merges the request-time
         * tokens with those that were known when this adapter was created.
         */
        Properties allTokens = null;
        try {
            allTokens = prepareRequestPlaceholders(tokens, gReq);
        } catch (Exception e) {
            logger.log(Level.SEVERE, "prepareRequestPlaceholder", e);
            finishErrorResponse(gResp, HttpServletResponse.SC_INTERNAL_SERVER_ERROR);
        }

        /*
         * Create an instance of the dynamic content using the dynamic
         * content's template and the just-prepared properties.
         */
        final DynamicContent.Instance instance = dc.getOrCreateInstance(allTokens);
        final Date instanceTimestamp = instance.getTimestamp();

        if (returnIfClientCacheIsCurrent(relativeURIString, gReq,
                instanceTimestamp.getTime())) {
            return;
        }

        gResp.setDateHeader(LAST_MODIFIED_HEADER_NAME, instanceTimestamp.getTime());
        gResp.setDateHeader(DATE_HEADER_NAME, System.currentTimeMillis());
        gResp.setContentType(dc.getMimeType());
        gResp.setStatus(HttpServletResponse.SC_OK);

        /*
         * Only for GET should the response actually contain the content.
         * Java Web Start uses HEAD to find out when the target was last
View Full Code Here

TOP

Related Classes of org.glassfish.appclient.server.core.jws.servedcontent.DynamicContent$InstanceAdapter

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.