Package org.glassfish.grizzly.http

Examples of org.glassfish.grizzly.http.HttpContext


            // us a different FilterChain to use. If so, we need
            // use a different FilterChainContext when invoking sendRequest().
            sendingCtx = checkAndHandleFilterChainUpdate(ctx, sendingCtx);
        }
        final Connection c = ctx.getConnection();
        final HttpContext httpCtx;
        if (!Utils.isSpdyConnection(c)) {
            httpCtx = HttpContext.newInstance(c, c, c, requestPacketLocal);
        } else {
            SpdySession session = SpdySession.get(c);
            final Lock lock = session.getNewClientStreamLock();
            try {
                lock.lock();
                SpdyStream stream = session.openStream(requestPacketLocal, session.getNextLocalStreamId(), 0, 0, 0, false,
                        !requestPacketLocal.isExpectContent());
                httpCtx = HttpContext.newInstance(stream, stream, stream, requestPacketLocal);
            } finally {
                lock.unlock();
            }
        }
        httpCtx.attach(ctx);
        HttpTxContext.set(ctx, httpTxContext);
        requestPacketLocal.getProcessingState().setHttpContext(httpCtx);
        requestPacketLocal.setConnection(c);
       
        return sendRequest(sendingCtx, request, requestPacketLocal,
View Full Code Here


    }

    // ---------------------------------------------------------- Public Methods

    public static void set(final FilterChainContext ctx, final HttpTxContext httpTxContext) {
        HttpContext httpContext = HttpContext.get(ctx);
        httpContext.getCloseable().addCloseListener(httpTxContext.listener);
        REQUEST_STATE_ATTR.set(httpContext, httpTxContext);
    }
View Full Code Here

        httpContext.getCloseable().addCloseListener(httpTxContext.listener);
        REQUEST_STATE_ATTR.set(httpContext, httpTxContext);
    }

    public static HttpTxContext remove(final FilterChainContext ctx) {
        final HttpContext httpContext = HttpContext.get(ctx);
        final HttpTxContext httpTxContext = REQUEST_STATE_ATTR.remove(httpContext);
        if (httpTxContext != null) {
            httpContext.getCloseable().removeCloseListener(httpTxContext.listener);
        }
       
        return httpTxContext;
    }
View Full Code Here

       
        return httpTxContext;
    }

    public static HttpTxContext get(FilterChainContext ctx) {
        HttpContext httpContext = HttpContext.get(ctx);
        return ((httpContext != null) ? REQUEST_STATE_ATTR.get(httpContext) : null);
    }
View Full Code Here

         * than the configured maximum.  The amount of time that this method
         * will block is dependent on the write timeout of the transport
         * associated with the specified connection.
         */
        private static void blockUntilQueueFree(final FilterChainContext ctx) {
            HttpContext httpContext = HttpContext.get(ctx);
            final OutputSink outputSink = httpContext.getOutputSink();
            if (!outputSink.canWrite()) {
                final FutureImpl<Boolean> future = Futures.createSafeFuture();
                outputSink.notifyCanWrite(new WriteHandler() {

                    @Override
View Full Code Here

        /**
         * {@inheritDoc}
         */
        @Override
        public synchronized void flush() throws IOException {
            final HttpContext httpContext = HttpContext.get(feedableBodyGenerator.context);
            final OutputSink outputSink = httpContext.getOutputSink();
            if (isReady()) {
                final boolean notReady = writeUntilFullOrDone(outputSink);
                if (!isDone()) {
                    if (notReady) {
                        notifyReadyToFeed(new ReadyToFeedListenerImpl());
View Full Code Here

TOP

Related Classes of org.glassfish.grizzly.http.HttpContext

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.