Package org.glassfish.grizzly.http.io

Examples of org.glassfish.grizzly.http.io.OutputBuffer


    }

    private static void sendZeroCopy(final Response response, final File file)
            throws IOException {
        final OutputBuffer outputBuffer = response.getOutputBuffer();
        outputBuffer.sendfile(file, null);
    }
View Full Code Here


                // Use the non-localized String version of the status
                serverVersion = AdapterState.WELCOME_TO.toString() + " " + serverVersion + ".";
            }
            status += "\n" + serverVersion;
            try {
                OutputBuffer ob = getOutputBuffer(res);

                byte[] bytes = (":::" + status).getBytes("UTF-8");
                res.setContentLength(bytes.length);
                ob.write(bytes, 0, bytes.length);
                ob.flush();

            } catch (IOException ex) {
                logger.log(Level.SEVERE, KernelLoggerInfo.consoleResourceError, ex);
            }
View Full Code Here

     *
     */
    private void sendStatusPage(Request req, Response res) {
        byte[] bytes;
        try {
            OutputBuffer ob = getOutputBuffer(res);
            // Replace locale specific Strings
            String localHtml = replaceTokens(statusHtml, bundle);

            // Replace state token
            String status = getStateMsg().getI18NKey();
            try {
                // Try to get a localized version of this key
                status = bundle.getString(status);
            } catch (MissingResourceException ex) {
                // Use the non-localized String version of the status
                status = getStateMsg().toString();
            }
            String locationUrl = req.getScheme()
                    + "://" + req.getServerName()
                    + ':' + req.getServerPort() + "/login.jsf";
            localHtml = localHtml.replace(REDIRECT_TOKEN, locationUrl);
            bytes = localHtml.replace(STATUS_TOKEN, status).getBytes("UTF-8");
            res.setContentLength(bytes.length);
            ob.write(bytes, 0, bytes.length);
            ob.flush();
        } catch (IOException ex) {
            throw new RuntimeException(ex);
        }
    }
View Full Code Here

     */
    private void sendStatusNotDAS(Request req, Response res) {
        byte[] bytes;
        try {
            String html = Utils.packageResource2String("statusNotDAS.html");
            OutputBuffer ob = getOutputBuffer(res);
            // Replace locale specific Strings
            String localHtml = replaceTokens(html, bundle);

            bytes = localHtml.getBytes("UTF-8");
            res.setContentLength(bytes.length);
            ob.write(bytes, 0, bytes.length);
            ob.flush();
        } catch (IOException ex) {
            throw new RuntimeException(ex);
        }
    }
View Full Code Here

                // Use the non-localized String version of the status
                serverVersion = AdapterState.WELCOME_TO.toString() + " " + serverVersion + ".";
            }
            status += "\n" + serverVersion;
            try {
                OutputBuffer ob = getOutputBuffer(res);

                byte[] bytes = (":::" + status).getBytes("UTF-8");
                res.setContentLength(bytes.length);
                ob.write(bytes, 0, bytes.length);
                ob.flush();

            } catch (IOException ex) {
                logger.log(Level.SEVERE, KernelLoggerInfo.consoleResourceError, ex);
            }
View Full Code Here

     *
     */
    private void sendStatusPage(Request req, Response res) {
        byte[] bytes;
        try {
            OutputBuffer ob = getOutputBuffer(res);
            // Replace locale specific Strings
            String localHtml = replaceTokens(statusHtml, bundle);

            // Replace state token
            String status = getStateMsg().getI18NKey();
            try {
                // Try to get a localized version of this key
                status = bundle.getString(status);
            } catch (MissingResourceException ex) {
                // Use the non-localized String version of the status
                status = getStateMsg().toString();
            }
            String locationUrl = req.getScheme()
                    + "://" + req.getServerName()
                    + ':' + req.getServerPort() + "/login.jsf";
            localHtml = localHtml.replace(REDIRECT_TOKEN, locationUrl);
            bytes = localHtml.replace(STATUS_TOKEN, status).getBytes("UTF-8");
            res.setContentLength(bytes.length);
            ob.write(bytes, 0, bytes.length);
            ob.flush();
        } catch (IOException ex) {
            throw new RuntimeException(ex);
        }
    }
View Full Code Here

     */
    private void sendStatusNotDAS(Request req, Response res) {
        byte[] bytes;
        try {
            String html = Utils.packageResource2String("statusNotDAS.html");
            OutputBuffer ob = getOutputBuffer(res);
            // Replace locale specific Strings
            String localHtml = replaceTokens(html, bundle);

            bytes = localHtml.getBytes("UTF-8");
            res.setContentLength(bytes.length);
            ob.write(bytes, 0, bytes.length);
            ob.flush();
        } catch (IOException ex) {
            throw new RuntimeException(ex);
        }
    }
View Full Code Here

TOP

Related Classes of org.glassfish.grizzly.http.io.OutputBuffer

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.