View Javadoc

1   package org.eclipse.jetty.spdy;
2   //========================================================================
3   //Copyright 2011-2012 Mort Bay Consulting Pty. Ltd.
4   //------------------------------------------------------------------------
5   //All rights reserved. This program and the accompanying materials
6   //are made available under the terms of the Eclipse Public License v1.0
7   //and Apache License v2.0 which accompanies this distribution.
8   //The Eclipse Public License is available at
9   //http://www.eclipse.org/legal/epl-v10.html
10  //The Apache License v2.0 is available at
11  //http://www.opensource.org/licenses/apache2.0.php
12  //You may elect to redistribute this code under either of these licenses.
13  //========================================================================
14  
15  import org.eclipse.jetty.spdy.api.SynInfo;
16  
17  /* ------------------------------------------------------------ */
18  /**
19   * <p>A subclass container of {@link SynInfo} for unidirectional streams</p>
20   */
21  public class PushSynInfo extends SynInfo
22  {
23      public static final byte FLAG_UNIDIRECTIONAL = 2;
24      
25      private int associatedStreamId;
26      
27      public PushSynInfo(int associatedStreamId, SynInfo synInfo){
28          super(synInfo.getHeaders(), synInfo.isClose(), synInfo.getPriority());
29          this.associatedStreamId = associatedStreamId;
30      }
31      
32      /**
33       * @return the close and unidirectional flags as integer
34       * @see #FLAG_CLOSE
35       * @see #FLAG_UNIDIRECTIONAL
36       */
37      @Override
38      public byte getFlags()
39      {
40          byte flags = super.getFlags();
41          flags += FLAG_UNIDIRECTIONAL;
42          return flags;
43      }
44      
45      /**
46       * @return the id of the associated stream
47       */
48      public int getAssociatedStreamId()
49      {
50          return associatedStreamId;
51      }
52  
53  }