Search in sources :

Example 26 with Headers

use of com.netflix.zuul.message.Headers in project zuul by Netflix.

the class HttpResponseMessageImpl method removeExistingSetCookie.

@Override
public boolean removeExistingSetCookie(String cookieName) {
    String cookieNamePrefix = cookieName + "=";
    boolean dirty = false;
    Headers filtered = new Headers();
    for (Header hdr : getHeaders().entries()) {
        if (HttpHeaderNames.SET_COOKIE.equals(hdr.getName())) {
            String value = hdr.getValue();
            // Strip out this set-cookie as requested.
            if (value.startsWith(cookieNamePrefix)) {
                // Don't copy it.
                dirty = true;
            } else {
                // Copy all other headers.
                filtered.add(hdr.getName(), hdr.getValue());
            }
        } else {
            // Copy all other headers.
            filtered.add(hdr.getName(), hdr.getValue());
        }
    }
    if (dirty) {
        setHeaders(filtered);
    }
    return dirty;
}
Also used : Header(com.netflix.zuul.message.Header) Headers(com.netflix.zuul.message.Headers)

Aggregations

Headers (com.netflix.zuul.message.Headers)26 SessionContext (com.netflix.zuul.context.SessionContext)17 Test (org.junit.Test)16 HttpResponseMessageImpl (com.netflix.zuul.message.http.HttpResponseMessageImpl)5 HttpQueryParams (com.netflix.zuul.message.http.HttpQueryParams)4 HttpResponseMessage (com.netflix.zuul.message.http.HttpResponseMessage)4 InetSocketAddress (java.net.InetSocketAddress)4 HttpRequestMessage (com.netflix.zuul.message.http.HttpRequestMessage)3 HttpRequestMessageImpl (com.netflix.zuul.message.http.HttpRequestMessageImpl)3 ZuulMessage (com.netflix.zuul.message.ZuulMessage)2 ZuulMessageImpl (com.netflix.zuul.message.ZuulMessageImpl)2 HttpRequestInfo (com.netflix.zuul.message.http.HttpRequestInfo)2 ByteBuf (io.netty.buffer.ByteBuf)2 DefaultFullHttpResponse (io.netty.handler.codec.http.DefaultFullHttpResponse)2 DefaultLastHttpContent (io.netty.handler.codec.http.DefaultLastHttpContent)2 SocketAddress (java.net.SocketAddress)2 Map (java.util.Map)2 Before (org.junit.Before)2 ClientException (com.netflix.client.ClientException)1 CompleteEvent (com.netflix.netty.common.HttpLifecycleChannelHandler.CompleteEvent)1