org.vertx.java.core.http.impl

## Class SwitchingHttpResponseDecoder

- java.lang.Object
- - org.jboss.netty.channel.SimpleChannelUpstreamHandler
  - - org.jboss.netty.handler.codec.frame.FrameDecoder
    - - org.jboss.netty.handler.codec.replay.ReplayingDecoder<org.jboss.netty.handler.codec.http.HttpMessageDecoder.State>
      - - org.jboss.netty.handler.codec.http.HttpMessageDecoder
        - - org.jboss.netty.handler.codec.http.HttpResponseDecoder
          - - org.vertx.java.core.http.impl.SwitchingHttpResponseDecoder

All Implemented Interfaces:
  org.jboss.netty.channel.ChannelHandler, org.jboss.netty.channel.ChannelUpstreamHandler, org.jboss.netty.channel.LifeCycleAwareChannelHandler

    public class SwitchingHttpResponseDecoder
    extends org.jboss.netty.handler.codec.http.HttpResponseDecoder

These shenanigans are necessary so we can switch out the response decoder to the websocket decoder as soon as the websocket handshake response has been decoded. Its complicated by the fact that the buffer which contained the websocket handshake response may also have the first write received from the server side websocket tacked on to the end, normally a ReplayingDecoder would discard that so we have to catch the last bytes (if any), and resubmit.

### Nested Class Summary

### Nested classes/interfaces inherited from class org.jboss.netty.handler.codec.http.HttpMessageDecoder

`org.jboss.netty.handler.codec.http.HttpMessageDecoder.State`

### Nested classes/interfaces inherited from interface org.jboss.netty.channel.ChannelHandler

`org.jboss.netty.channel.ChannelHandler.Sharable`

### Field Summary

### Fields inherited from class org.jboss.netty.handler.codec.frame.FrameDecoder

`cumulation`

### Constructor Summary

Constructors
Constructor and Description
`SwitchingHttpResponseDecoder()`

### Method Summary

Methods
`protected java.lang.Object` `decode(org.jboss.netty.channel.ChannelHandlerContext ctx, org.jboss.netty.channel.Channel ch, org.jboss.netty.buffer.ChannelBuffer buf, org.jboss.netty.handler.codec.http.HttpMessageDecoder.State state)`
`void` `setSwitch(java.lang.String name, org.jboss.netty.channel.ChannelHandler switchTo)`

### Methods inherited from class org.jboss.netty.handler.codec.http.HttpResponseDecoder

`createMessage, isDecodingRequest`

### Methods inherited from class org.jboss.netty.handler.codec.http.HttpMessageDecoder

`isContentAlwaysEmpty`

### Methods inherited from class org.jboss.netty.handler.codec.replay.ReplayingDecoder

`checkpoint, checkpoint, cleanup, decode, decodeLast, decodeLast, getState, messageReceived, setState`

### Methods inherited from class org.jboss.netty.handler.codec.frame.FrameDecoder

`actualReadableBytes, afterAdd, afterRemove, beforeAdd, beforeRemove, channelClosed, channelDisconnected, exceptionCaught, internalBuffer, newCumulationBuffer, replace, unfoldAndFireMessageReceived`

### Methods inherited from class org.jboss.netty.channel.SimpleChannelUpstreamHandler

`channelBound, channelConnected, channelInterestChanged, channelOpen, channelUnbound, childChannelClosed, childChannelOpen, handleUpstream, writeComplete`

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

### Constructor Detail

#### SwitchingHttpResponseDecoder

    public SwitchingHttpResponseDecoder()

### Method Detail

#### setSwitch

    public void setSwitch(java.lang.String name,
                 org.jboss.netty.channel.ChannelHandler switchTo)

#### decode

    protected java.lang.Object decode(org.jboss.netty.channel.ChannelHandlerContext ctx,
                          org.jboss.netty.channel.Channel ch,
                          org.jboss.netty.buffer.ChannelBuffer buf,
                          org.jboss.netty.handler.codec.http.HttpMessageDecoder.State state)
                               throws java.lang.Exception

Overrides:
  `decode` in class `org.jboss.netty.handler.codec.http.HttpMessageDecoder`
Throws:
  `java.lang.Exception`