public class MimeHeaders extends Object
Modifier and Type | Class and Description |
---|---|
class |
MimeHeaders.MaxHeaderCountExceededException |
Modifier and Type | Field and Description |
---|---|
static int |
DEFAULT_HEADER_SIZE
Initial size - should be == average number of headers per request
XXX make it configurable ( fine-tuning of web-apps )
|
static int |
MAX_NUM_HEADERS_DEFAULT |
static int |
MAX_NUM_HEADERS_UNBOUNDED |
Constructor and Description |
---|
MimeHeaders()
Creates a new MimeHeaders object using a default buffer size.
|
Modifier and Type | Method and Description |
---|---|
DataChunk |
addValue(Buffer buffer,
int startN,
int len)
Create a new named header using un-translated Buffer.
|
DataChunk |
addValue(byte[] buffer,
int startN,
int len)
Create a new named header using un-translated byte[].
|
DataChunk |
addValue(Header header)
Create a new named header , return the MessageBytes
container for the new value
|
DataChunk |
addValue(String name)
Create a new named header , return the MessageBytes
container for the new value
|
void |
clear()
Clears all header fields.
|
boolean |
contains(Header header) |
boolean |
contains(String header) |
void |
copyFrom(MimeHeaders source) |
String |
getHeader(Header header) |
String |
getHeader(String name) |
int |
getMaxNumHeaders() |
DataChunk |
getName(int n)
Returns the Nth header name, or null if there is no such header.
|
DataChunk |
getValue(Header header)
Finds and returns a header field with the given name.
|
DataChunk |
getValue(int n)
Returns the Nth header value, or null if there is no such header.
|
DataChunk |
getValue(String name)
Finds and returns a header field with the given name.
|
int |
indexOf(Header header,
int fromIndex)
Find the index of a header with the given name.
|
int |
indexOf(String name,
int fromIndex)
Find the index of a header with the given name.
|
boolean |
isSerialized(int n)
Get the header's "serialized" flag.
|
Iterable<String> |
names()
Returns an enumeration of strings representing the header field names.
|
void |
recycle()
Clears all header fields.
|
void |
removeHeader(Header header) |
void |
removeHeader(String name)
Removes a header field with the specified name.
|
void |
removeHeader(String name,
String str)
Removes the headers with the given name whose values contain the
given string.
|
void |
removeHeaderMatches(Header header,
String regex)
Removes the headers with the given name whose values contain the
given string.
|
void |
removeHeaderMatches(String name,
String regex)
Removes the headers with the given name whose values contain the
given string.
|
void |
setMaxNumHeaders(int maxNumHeaders) |
boolean |
setSerialized(int n,
boolean newValue)
Set the header's "serialized" flag.
|
DataChunk |
setValue(Header header)
Allow "set" operations -
return a DataChunk container for the
header value ( existing header or new
if this .
|
DataChunk |
setValue(String name)
Allow "set" operations -
return a DataChunk container for the
header value ( existing header or new
if this .
|
int |
size()
Returns the current number of header fields.
|
String |
toString()
EXPENSIVE!!! only for debugging.
|
Iterable<String> |
values(Header name) |
Iterable<String> |
values(String name) |
public static final int MAX_NUM_HEADERS_UNBOUNDED
public static final int MAX_NUM_HEADERS_DEFAULT
public static final int DEFAULT_HEADER_SIZE
public MimeHeaders()
public void recycle()
public void clear()
public String toString()
public void copyFrom(MimeHeaders source)
public int size()
public DataChunk getName(int n)
public DataChunk getValue(int n)
public boolean isSerialized(int n)
n
- the header indexpublic boolean setSerialized(int n, boolean newValue)
n
- the header indexnewValue
- the new valuepublic int indexOf(String name, int fromIndex)
public int indexOf(Header header, int fromIndex)
public boolean contains(Header header)
public boolean contains(String header)
public Iterable<String> names()
public DataChunk addValue(String name)
public DataChunk addValue(Header header)
public DataChunk addValue(byte[] buffer, int startN, int len)
public DataChunk addValue(Buffer buffer, int startN, int len)
public DataChunk setValue(String name)
public DataChunk setValue(Header header)
public DataChunk getValue(String name)
public DataChunk getValue(Header header)
public void removeHeader(String name)
name
- the name of the header field to be removedpublic void removeHeader(Header header)
public void removeHeader(String name, String str)
name
- The name of the headers to be removedstr
- The string to check the header values againstpublic void removeHeaderMatches(String name, String regex)
name
- The name of the headers to be removedregex
- The regex string to check the header values againstpublic void removeHeaderMatches(Header header, String regex)
header
- The name of the Header
s to be removedregex
- The regex string to check the header values againstpublic void setMaxNumHeaders(int maxNumHeaders)
public int getMaxNumHeaders()
Copyright © 2015 Oracle Corporation. All rights reserved.