Search in sources :

Example 1 with FilterChainContext

use of org.glassfish.grizzly.filterchain.FilterChainContext in project LinkAgent by shulieTech.

the class MuleHttpRequestDispatcherFilterInterceptor method doException.

@Override
public void doException(Advice advice) {
    Object[] args = advice.getParameterArray();
    if (args == null || args.length == 0) {
        return;
    }
    if (!(args[0] instanceof FilterChainContext)) {
        return;
    }
    HttpRequestPacket request = getRequest();
    // trace log end
    RequestTracer.doAfterTrace(request, null, advice.getThrowable());
    setRequest(null);
}
Also used : HttpRequestPacket(org.glassfish.grizzly.http.HttpRequestPacket) FilterChainContext(org.glassfish.grizzly.filterchain.FilterChainContext)

Example 2 with FilterChainContext

use of org.glassfish.grizzly.filterchain.FilterChainContext in project LinkAgent by shulieTech.

the class MuleHttpRequestDispatcherFilterInterceptor method doAfter.

@Override
public void doAfter(Advice advice) {
    Object[] args = advice.getParameterArray();
    if (args == null || args.length == 0) {
        return;
    }
    if (!(args[0] instanceof FilterChainContext)) {
        return;
    }
    HttpRequestPacket request = getRequest();
    // trace log end
    RequestTracer.doAfterTrace(request, null, null);
    setRequest(null);
}
Also used : HttpRequestPacket(org.glassfish.grizzly.http.HttpRequestPacket) FilterChainContext(org.glassfish.grizzly.filterchain.FilterChainContext)

Example 3 with FilterChainContext

use of org.glassfish.grizzly.filterchain.FilterChainContext in project Payara by payara.

the class HSTSFilterTest method processFilter.

private HttpHeader processFilter(Ssl config) throws IOException {
    HSTSFilter filter = new HSTSFilter();
    filter.configure(null, null, config);
    FilterChainContext context = new FilterChainContext();
    context.setMessage(HttpContent.create(new TestHttpHeader()));
    filter.handleRead(context);
    return ((HttpContent) context.getMessage()).getHttpHeader();
}
Also used : FilterChainContext(org.glassfish.grizzly.filterchain.FilterChainContext) HttpContent(org.glassfish.grizzly.http.HttpContent)

Example 4 with FilterChainContext

use of org.glassfish.grizzly.filterchain.FilterChainContext in project openmq by eclipse-ee4j.

the class StompMessageDispatchFilter method sendToClient.

@Override
public void sendToClient(final StompFrameMessage msg, StompProtocolHandler sph, final Object context) throws Exception {
    FilterChainContext ctx = (FilterChainContext) context;
    boolean closechannel = false;
    try {
        if (msg.getCommand() == StompFrameMessage.Command.ERROR) {
            if (msg.isFatalERROR()) {
                closechannel = true;
            }
        }
        ctx.write(msg, true);
    } catch (Exception e) {
        if (e instanceof java.nio.channels.ClosedChannelException || e.getCause() instanceof java.nio.channels.ClosedChannelException) {
            _logger.log(Level.WARNING, _sbr.getKString(_sbr.W_EXCEPTION_ON_SEND_MSG, msg.toString(), e.toString()));
            if (sph != null) {
                sph.close(false);
            }
        }
        throw e;
    } finally {
        if (closechannel) {
            GrizzlyFuture f = ctx.getConnection().close();
            try {
                f.get();
            } catch (Exception ee) {
                _logger.log(Level.WARNING, ee.getMessage(), ee);
            }
        }
    }
}
Also used : GrizzlyFuture(org.glassfish.grizzly.GrizzlyFuture) FilterChainContext(org.glassfish.grizzly.filterchain.FilterChainContext) IOException(java.io.IOException)

Example 5 with FilterChainContext

use of org.glassfish.grizzly.filterchain.FilterChainContext in project launcher by fujitsu.

the class Http2Session method sendMessageUpstream.

void sendMessageUpstream(final Http2Stream stream, final HttpPacket message) {
    final FilterChainContext upstreamContext = http2StreamChain.obtainFilterChainContext(connection, stream);
    final HttpContext httpContext = message.getHttpHeader().getProcessingState().getHttpContext();
    httpContext.attach(upstreamContext);
    sendMessageUpstream(stream, message, upstreamContext);
}
Also used : HttpContext(org.glassfish.grizzly.http.HttpContext) FilterChainContext(org.glassfish.grizzly.filterchain.FilterChainContext)

Aggregations

FilterChainContext (org.glassfish.grizzly.filterchain.FilterChainContext)11 HttpRequestPacket (org.glassfish.grizzly.http.HttpRequestPacket)4 HttpContent (org.glassfish.grizzly.http.HttpContent)3 HttpContext (org.glassfish.grizzly.http.HttpContext)3 IOException (java.io.IOException)2 HttpHeader (org.glassfish.grizzly.http.HttpHeader)2 HttpResponsePacket (org.glassfish.grizzly.http.HttpResponsePacket)2 MatchConfig (com.pamirs.pradar.internal.config.MatchConfig)1 URI (java.net.URI)1 ByteBuffer (java.nio.ByteBuffer)1 HashMap (java.util.HashMap)1 HashSet (java.util.HashSet)1 List (java.util.List)1 Map (java.util.Map)1 Set (java.util.Set)1 RejectedExecutionException (java.util.concurrent.RejectedExecutionException)1 CloseReason (javax.websocket.CloseReason)1 Buffer (org.glassfish.grizzly.Buffer)1 CloseListener (org.glassfish.grizzly.CloseListener)1 Connection (org.glassfish.grizzly.Connection)1