de.mklinger.qetcher.client.jetty.http2.frames.HeadersFrame Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of qetcher-client-bundle Show documentation
Show all versions of qetcher-client-bundle Show documentation
Qetcher Java client, OSGi bundle, minimal dependencies
//
// ========================================================================
// Copyright (c) 1995-2018 Mort Bay Consulting Pty. Ltd.
// ------------------------------------------------------------------------
// All rights reserved. This program and the accompanying materials
// are made available under the terms of the Eclipse Public License v1.0
// and Apache License v2.0 which accompanies this distribution.
//
// The Eclipse Public License is available at
// http://www.eclipse.org/legal/epl-v10.html
//
// The Apache License v2.0 is available at
// http://www.opensource.org/licenses/apache2.0.php
//
// You may elect to redistribute this code under either of these licenses.
// ========================================================================
//
package org.eclipse.jetty.http2.frames;
import org.eclipse.jetty.http.MetaData;
public class HeadersFrame extends Frame
{
private final int streamId;
private final MetaData metaData;
private final PriorityFrame priority;
private final boolean endStream;
/**
* Creates a new {@code HEADERS} frame with an unspecified stream {@code id}.
* The stream {@code id} will be generated by the implementation while sending
* this frame to the other peer.
*
* @param metaData the metadata containing HTTP request information
* @param priority the PRIORITY frame associated with this HEADERS frame
* @param endStream whether this frame ends the stream
*/
public HeadersFrame(MetaData metaData, PriorityFrame priority, boolean endStream)
{
this(0, metaData, priority, endStream);
}
/**
* Creates a new {@code HEADERS} frame with the specified stream {@code id}.
* {@code HEADERS} frames with a specific stream {@code id} are typically used
* in responses to request {@code HEADERS} frames.
*
* @param streamId the stream id
* @param metaData the metadata containing HTTP request/response information
* @param priority the PRIORITY frame associated with this HEADERS frame
* @param endStream whether this frame ends the stream
*/
public HeadersFrame(int streamId, MetaData metaData, PriorityFrame priority, boolean endStream)
{
super(FrameType.HEADERS);
this.streamId = streamId;
this.metaData = metaData;
this.priority = priority;
this.endStream = endStream;
}
public int getStreamId()
{
return streamId;
}
public MetaData getMetaData()
{
return metaData;
}
public PriorityFrame getPriority()
{
return priority;
}
public boolean isEndStream()
{
return endStream;
}
@Override
public String toString()
{
return String.format("%s#%d{end=%b}", super.toString(), streamId, endStream);
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy