1 /*
   2  * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.  Oracle designates this
   8  * particular file as subject to the "Classpath" exception as provided
   9  * by Oracle in the LICENSE file that accompanied this code.
  10  *
  11  * This code is distributed in the hope that it will be useful, but WITHOUT
  12  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  13  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  14  * version 2 for more details (a copy is included in the LICENSE file that
  15  * accompanied this code).
  16  *
  17  * You should have received a copy of the GNU General Public License version
  18  * 2 along with this work; if not, write to the Free Software Foundation,
  19  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  20  *
  21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  22  * or visit www.oracle.com if you need additional information or have any
  23  */
  24 
  25 package java.net.http;
  26 
  27 import java.io.IOException;
  28 
  29 /**
  30  * Contains all parameters for outgoing headers. Is converted to
  31  * HeadersFrame and ContinuationFrames by Http2Connection.
  32  */
  33 class OutgoingHeaders extends Http2Frame {
  34 
  35     int streamDependency;
  36     int weight;
  37     boolean exclusive;
  38     Stream stream;
  39 
  40     public static final int PRIORITY = 0x20;
  41 
  42     HttpHeaders user, system;
  43 
  44     OutgoingHeaders(HttpHeaders hdrs1, HttpHeaders hdrs2, Stream stream) {
  45         this.user = hdrs2;
  46         this.system = hdrs1;
  47         this.stream = stream;
  48     }
  49 
  50     public void setPriority(int streamDependency, boolean exclusive, int weight) {
  51         this.streamDependency = streamDependency;
  52         this.exclusive = exclusive;
  53         this.weight = weight;
  54         this.flags |= PRIORITY;
  55     }
  56 
  57     public int getStreamDependency() {
  58         return streamDependency;
  59     }
  60 
  61     public int getWeight() {
  62         return weight;
  63     }
  64 
  65     public boolean getExclusive() {
  66         return exclusive;
  67     }
  68 
  69     public Stream getStream() {
  70         return stream;
  71     }
  72 
  73     public HttpHeaders getUserHeaders() {
  74         return user;
  75     }
  76 
  77     public HttpHeaders getSystemHeaders() {
  78         return system;
  79     }
  80 
  81     @Override
  82     void readIncomingImpl(ByteBufferConsumer bc) throws IOException {
  83         throw new UnsupportedOperationException("Not supported.");
  84     }
  85 
  86     @Override
  87     void computeLength() {
  88         //To change body of generated methods, choose Tools | Templates.
  89         throw new UnsupportedOperationException("Not supported yet.");
  90     }
  91 }