View Javadoc

1   /*******************************************************************************
2    * Copyright (c) 2011 Michael Mimo Moratti.
3    *
4    * Michael Mimo Moratti licenses this file to you under the Apache License, version 2.0
5    * (the "License"); you may not use this file except in compliance with the License.
6    * You may obtain a copy of the License at:
7    *     http://www.apache.org/licenses/LICENSE-2.0
8    * Unless required by applicable law or agreed to in writing, software
9    * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
10   * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  See the
11   * License for the specific language governing permissions and limitations
12   * under the License.
13   *******************************************************************************/
14  package ch.mimo.netty.handler.codec.icap;
15  
16  import org.jboss.netty.handler.codec.http.DefaultHttpChunkTrailer;
17  
18  /**
19   * This class is used to indicate the end of a chunked data stream and to hold 
20   * trailing headers.
21   * 
22   * @author Michael Mimo Moratti (mimo@mimo.ch)
23   *
24   * @see IcapChunkTrailer implementation.
25   *
26   */
27  public class DefaultIcapChunkTrailer extends DefaultHttpChunkTrailer implements IcapChunkTrailer {
28  	
29  	private boolean preview;
30  	private boolean earlyTerminated;
31  	
32  	public DefaultIcapChunkTrailer() {
33  		this.preview = false;
34  		this.earlyTerminated = false;
35  	}
36  	
37  	public DefaultIcapChunkTrailer(boolean isPreview, boolean isEarlyTerminated) {
38  		this();
39  		this.preview = isPreview;
40  		this.earlyTerminated = isEarlyTerminated;
41  	}
42  	
43  	@Override
44  	public void setPreviewChunk(boolean preview) {
45  		this.preview = preview;
46  	}
47  
48  	@Override
49  	public boolean isPreviewChunk() {
50  		return preview;
51  	}
52  
53  	@Override
54  	public void setEarlyTermination(boolean earlyTermination) {
55  		this.earlyTerminated = earlyTermination;
56  	}
57  
58  	@Override
59  	public boolean isEarlyTerminated() {
60  		return earlyTerminated;
61  	}
62  	
63  	public String toString() {
64  		return "DeafultIcapChunkTrailer: [isPreviewChunk=" + preview + "] [wasEarlyTerminated=" + earlyTerminated + "]";
65  	}
66  }