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

Examples of org.glassfish.appclient.server.core.jws.servedcontent.StaticContent


//        return userFriendlyContextRoot;
//    }

    public synchronized void addContentIfAbsent(final String relativeURIString,
            final StaticContent newContent) throws IOException {
        final StaticContent existingContent = content.get(relativeURIString);
        if (existingContent != null) {
            if ( ! existingContent.equals(newContent)) {
                logger.log(Level.FINE, "enterprise.deployment.appclient.jws.staticContentCollision",
                        new Object[] {relativeURIString, newContent.toString()});
            }
            return;
        }
View Full Code Here


         * then handle that separately.
         *
         * If the request is for a URI in neither the static nor dynamic
         * content this adapter should serve, then just return a 404.
         */
        final StaticContent sc = content.get(relativeURIString);
        if (sc != null && sc.isAvailable()) {
            processContent(relativeURIString, gReq, gResp);
            return true;
        } else {
            finishErrorResponse(gResp, contentStateToResponseStatus(sc));
            final String scString = (sc == null ? "null" : sc.toString());
            final String scStateString = (sc == null ? "null" : sc.state().toString());
            logger.fine(logPrefix() + "Found static content for " + gReq.getMethod() +
                    ": " + relativeURIString + " -> " + scString +
                    " but could not serve it; its state is " + scStateString);
            return true;
        }
View Full Code Here

    }

    private void processContent(final String relativeURIString,
            final GrizzlyRequest gReq, final GrizzlyResponse gResp) {
        try {
            final StaticContent sc = content.get(relativeURIString);

            /*
             * No need to actually send the file if the request contains a
             * If-Modified-Since date and the file is not more recent.
             */
            final File fileToSend = sc.file();
            if (fileToSend != null) {
                if (returnIfClientCacheIsCurrent(relativeURIString,
                        gReq, fileToSend.lastModified())) {
                    return;
                }

                /*
                 * The client's cache is obsolete.  Be sure to set the
                 * time header values.
                 */
                gResp.addDateHeader(LAST_MODIFIED_HEADER_NAME, fileToSend.lastModified());
                gResp.addDateHeader(DATE_HEADER_NAME, System.currentTimeMillis());
            }

            /*
             * Delegate to the Grizzly implementation.
             */
            super.service(relativeURIString, gReq.getRequest(), gResp.getResponse());
            final int status = gResp.getStatus();
            if (status != HttpServletResponse.SC_OK) {
                logger.fine(logPrefix() + "Could not serve content for " +
                        relativeURIString + " - status = " + status);
            } else {
                logger.fine(logPrefix() + "Served static content for " + gReq.getMethod() +
                        ":" + sc.toString());
            }
            finishResponse(gResp, status);
        } catch (Exception e) {
//            gResp.getResponse().setErrorException(e);
//            finishErrorResponse(gResp, HttpServletResponse.SC_INTERNAL_SERVER_ERROR);
View Full Code Here

        urisForAlias.add(relURI);
    }

    private Map.Entry<URI,StaticContent> developerSignedAppContentEntry(URI absURIToFile) {
        final URI jarURIRelativeToApp = EARDirectoryServerURI.relativize(absURIToFile);
        StaticContent content = relURIToContent.get(absURIToFile);
        if (content == null) {
            content = new FixedContent(new File(absURIToFile));
            relURIToContent.put(jarURIRelativeToApp, content);
        }
        return new AbstractMap.SimpleEntry<URI,StaticContent>(
View Full Code Here

     */
    private synchronized Map.Entry<URI,StaticContent> autoSignedAppContentEntry(
            final URI jarURIRelativeToApp,
            final URI absURIToFile) throws FileNotFoundException {

        StaticContent content = relURIToContent.get(jarURIRelativeToApp);
        if (content == null) {
            final File unsignedFile = new File(absURIToFile);
            final File signedFile = signedFileForLib(jarURIRelativeToApp, unsignedFile);
            content = new AutoSignedContent(unsignedFile, signedFile, autoSigningAlias, jarSigner);
            relURIToContent.put(jarURIRelativeToApp, content);
        } else {
            if (content instanceof AutoSignedContent) {
                content = AutoSignedContent.class.cast(content);
            } else {
                throw new RuntimeException(content.toString() + " != AutoSignedContent");
            }
        }
        return new AbstractMap.SimpleEntry(jarURIRelativeToApp, content);
    }
View Full Code Here

                //new File(helper.appClientServerURI(dc)).getParentFile(),
                dc.getSource().getManifest().getMainAttributes());
        tHelper.setProperty(APP_LIBRARY_EXTENSION_PROPERTY_NAME,
                jarElementsForExtensions(exts));
        for (Extension e : exts) {
            final StaticContent newSystemContent = createSignedStaticContent(
                    e.getFile(),
                    signedFileForDomainFile(e.getFile()));
            jwsAdapterManager.addStaticSystemContent(
                    URI.create(JWSAdapterManager.publicExtensionLookupURIText(e)).toString(),
                    newSystemContent);
View Full Code Here

            final File unsignedFile,
            final File signedFile,
            final URI uriForLookup,
            final String tokenName
            ) throws FileNotFoundException {
        final StaticContent signedJarContent = createSignedStaticContent(
                unsignedFile, signedFile);
        recordStaticContent(content, signedJarContent, uriForLookup, tokenName);
    }
View Full Code Here

    private StaticContent createSignedStaticContent(
            final File unsignedFile,
            final File signedFile) throws FileNotFoundException {
        signedFile.getParentFile().mkdirs();
        final StaticContent signedJarContent = new AutoSignedContent(
                unsignedFile,
                signedFile,
                signingAlias,
                jarSigner);
        return signedJarContent;
View Full Code Here

        urisForAlias.add(relURI);
    }

    private Map.Entry<URI,StaticContent> developerSignedAppContentEntry(URI absURIToFile) {
        final URI jarURIRelativeToApp = EARDirectoryServerURI.relativize(absURIToFile);
        StaticContent content = relURIToContent.get(absURIToFile);
        if (content == null) {
            content = new FixedContent(new File(absURIToFile));
            relURIToContent.put(jarURIRelativeToApp, content);
        }
        return new AbstractMap.SimpleEntry<URI,StaticContent>(
View Full Code Here

     */
    private synchronized Map.Entry<URI,StaticContent> autoSignedAppContentEntry(
            final URI jarURIRelativeToApp,
            final URI absURIToFile) throws FileNotFoundException {

        StaticContent content = relURIToContent.get(jarURIRelativeToApp);
        if (content == null) {
            final File unsignedFile = new File(absURIToFile);
            final File signedFile = signedFileForLib(jarURIRelativeToApp, unsignedFile);
            content = new AutoSignedContent(unsignedFile, signedFile, autoSigningAlias, jarSigner, jarURIRelativeToApp.toASCIIString(),
                    helper.appName());
            relURIToContent.put(jarURIRelativeToApp, content);
        } else {
            if (content instanceof AutoSignedContent) {
                content = AutoSignedContent.class.cast(content);
            } else {
                throw new RuntimeException(content.toString() + " != AutoSignedContent");
            }
        }
        return new AbstractMap.SimpleEntry(jarURIRelativeToApp, content);
    }
View Full Code Here

TOP

Related Classes of org.glassfish.appclient.server.core.jws.servedcontent.StaticContent

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.