Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
  /*
   * JBoss, Home of Professional Open Source.
   * Copyright 2014 Red Hat, Inc., and individual contributors
   * as indicated by the @author tags.
   *
   * Licensed under the Apache License, Version 2.0 (the "License");
   * you may not use this file except in compliance with the License.
   * You may obtain a copy of the License at
   *
  *     http://www.apache.org/licenses/LICENSE-2.0
  *
  *  Unless required by applicable law or agreed to in writing, software
  *  distributed under the License is distributed on an "AS IS" BASIS,
  *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  *  See the License for the specific language governing permissions and
  *  limitations under the License.
  */
 
 package io.undertow.server.protocol.spdy;
 
 import org.xnio.Pool;
 
 import java.util.List;

A server connection. There is one connection per request TODO: how are we going to deal with attachments?

Author(s):
Stuart Douglas
 
 public class SpdyServerConnection extends ServerConnection {
 
     private static final HttpString STATUS = new HttpString(":status");
     private static final HttpString VERSION = new HttpString(":version");
 
     private final SpdyChannel channel;
     private final StreamSinkConduit originalSinkConduit;
     private final StreamSourceConduit originalSourceConduit;
     private final OptionMap undertowOptions;
     private final int bufferSize;
     private SSLSessionInfo sessionInfo;
 
     public SpdyServerConnection(SpdyChannel channelSpdySynStreamStreamSourceChannel requestChannelOptionMap undertowOptionsint bufferSize) {
         this. = channel;
         this. = requestChannel;
         this. = undertowOptions;
         this. = bufferSize;
          = requestChannel.getResponseChannel();
          = new StreamSourceChannelWrappingConduit(requestChannel);
         this. = new ConduitStreamSourceChannel(requestChannel);
     }
 
     @Override
     public Pool<ByteBuffergetBufferPool() {
         return .getBufferPool();
     }
 
     @Override
     public XnioWorker getWorker() {
         return .getWorker();
     }
 
    @Override
    public XnioIoThread getIoThread() {
        return .getIoThread();
    }
    @Override
        //SPDY does not really seem to support HTTP 100-continue
        throw new RuntimeException("Not yet implemented");
    }
    @Override
    public void terminateRequestChannel(HttpServerExchange exchange) {
        //todo: should we RST_STREAM in this case
        //channel.sendRstStream(responseChannel.getStreamId(), SpdyChannel.RST_STATUS_CANCEL);
    }
    @Override
    public boolean isOpen() {
        return .isOpen();
    }
    @Override
    public boolean supportsOption(Option<?> option) {
        return false;
    }
    @Override
    public <T> T getOption(Option<T> optionthrows IOException {
        return null;
    }
    @Override
    public <T> T setOption(Option<T> option, T valuethrows IllegalArgumentExceptionIOException {
        return null;
    }
    @Override
    public void close() throws IOException {
        .close();
    }
    @Override
    public SocketAddress getPeerAddress() {
        return .getPeerAddress();
    }
    @Override
    public <A extends SocketAddress> A getPeerAddress(Class<A> type) {
        return .getPeerAddress(type);
    }
    @Override
    public ChannelListener.Setter<? extends ConnectedChannelgetCloseSetter() {
        return .getCloseSetter();
    }
    @Override
    public SocketAddress getLocalAddress() {
        return .getLocalAddress();
    }
    @Override
    public <A extends SocketAddress> A getLocalAddress(Class<A> type) {
        return .getLocalAddress(type);
    }
    @Override
    public OptionMap getUndertowOptions() {
        return ;
    }
    @Override
    public int getBufferSize() {
        return ;
    }
    @Override
    public SSLSessionInfo getSslSessionInfo() {
        return ;
    }
    @Override
    public void setSslSessionInfo(SSLSessionInfo sessionInfo) {
        this. = sessionInfo;
    }
    @Override
    public void addCloseListener(final CloseListener listener) {
            @Override
            public void handleEvent(SpdyChannel channel) {
                listener.closed(SpdyServerConnection.this);
            }
        });
    }
    @Override
    protected StreamConnection upgradeChannel() {
    }
    @Override
        return ;
    }
    @Override
        return ;
    }
    @Override
    protected StreamSinkConduit getSinkConduit(HttpServerExchange exchangeStreamSinkConduit conduit) {
        HeaderMap headers = .getHeaders();
        headers.add(exchange.getResponseCode() + " " + StatusCodes.getReason(exchange.getResponseCode()));
        headers.add(exchange.getProtocol().toString());
        Connectors.flattenCookies(exchange);
        return ;
    }
    @Override
    protected boolean isUpgradeSupported() {
        return false;
    }
    @Override
    protected void exchangeComplete(HttpServerExchange exchange) {
    }
    @Override
    protected void setUpgradeListener(HttpUpgradeListener upgradeListener) {
    }
    @Override
    protected void maxEntitySizeUpdated(HttpServerExchange exchange) {
    }
    @Override
    public <T> void addToAttachmentList(AttachmentKey<AttachmentList<T>> key, T value) {
        .addToAttachmentList(keyvalue);
    }
    @Override
    public <T> T removeAttachment(AttachmentKey<T> key) {
        return .removeAttachment(key);
    }
    @Override
    public <T> T putAttachment(AttachmentKey<T> key, T value) {
        return .putAttachment(keyvalue);
    }
    @Override
    public <T> List<T> getAttachmentList(AttachmentKey<? extends List<T>> key) {
        return .getAttachmentList(key);
    }
    @Override
    public <T> T getAttachment(AttachmentKey<T> key) {
        return .getAttachment(key);
    }
New to GrepCode? Check out our FAQ X