public class MimeMessage extends Object
| Modifier and Type | Field and Description |
|---|---|
static String |
CONNECTION |
static String |
CONTENT_DISPOSITION |
static String |
CONTENT_ENCODING |
static String |
CONTENT_LENGTH |
static String |
CONTENT_TRANSFER_ENCODING |
static String |
CONTENT_TYPE |
static String |
TRANSFER_ENCODING |
| Constructor and Description |
|---|
MimeMessage()
Constructor.
|
MimeMessage(List<MimeHeader> headers)
Constructor.
|
MimeMessage(MimeHeader... headers)
Constructor.
|
| Modifier and Type | Method and Description |
|---|---|
void |
addHeader(MimeHeader header)
Append a header.
|
void |
addHeader(String name,
HeaderValueFormat value)
Append a header.
|
void |
addHeaderRaw(String name,
String rawValue)
Append a header.
|
void |
appendHeadersTo(net.lecousin.framework.util.IString s)
Generate headers into the given string.
|
void |
appendHeadersTo(StringBuilder s)
Generate headers into the given string.
|
net.lecousin.framework.io.IO.Readable |
getBodyReceivedAsInput()
Return the body previously set by
setBodyReceived(net.lecousin.framework.io.IO.Writable). |
net.lecousin.framework.io.IO.Writable |
getBodyReceivedAsOutput()
Return the body previously set by
setBodyReceived(net.lecousin.framework.io.IO.Writable). |
net.lecousin.framework.io.IO.Readable |
getBodyToSend()
Return the body to send, previoulsy set by setBodyToSend.
|
Long |
getContentLength() |
ParameterizedHeaderValue |
getContentType()
Parse the Content-Type header and return it, or null if it is not present.
|
String |
getContentTypeValue()
Parse the Content-Type header and return its main value, or null if it is not present.
|
MimeHeader |
getFirstHeader(String name)
Return the first header with the given name (case insensitive) or null.
|
Long |
getFirstHeaderLongValue(String name)
Return the value of the first header with the given name (case insensitive) parsed into a Long, or null.
|
String |
getFirstHeaderRawValue(String name)
Return the value of the first header with the given name (case insensitive), or null.
|
<T extends HeaderValueFormat> |
getFirstHeaderValue(String name,
Class<T> format)
Return the value of the first header with the given name (case insensitive) parsed into the requested format, or null.
|
List<MimeHeader> |
getHeaders() |
List<MimeHeader> |
getHeaders(String name)
Return the list of headers with the given name (case insensitive).
|
<T extends HeaderValueFormat> |
getHeadersValues(String name,
Class<T> format)
Return the list of headers values with the given name (case insensitive), parsed into the requested format.
|
net.lecousin.framework.log.Logger |
getLogger() |
net.lecousin.framework.io.IO.Readable |
getReadableStream()
Generate this MimeMessage into a Readable IO.
|
boolean |
hasHeader(String name)
Return true if thie message contains at least one header with the given name (case insensitive).
|
net.lecousin.framework.concurrent.synch.SynchronizationPoint<IOException> |
readHeader(net.lecousin.framework.network.client.TCPClient client,
int timeout)
Receive header lines from the given client.
|
void |
removeHeaders(String name)
Remove any header with the given name.
|
net.lecousin.framework.concurrent.synch.ISynchronizationPoint<IOException> |
send(net.lecousin.framework.network.TCPRemote remote)
Send this MIME to the given TCP connection.
|
<T extends net.lecousin.framework.io.IO.Writable & net.lecousin.framework.io.IO.Readable> |
setBodyReceived(T output)
Set the IO that receive the body and can be read later on.
|
void |
setBodyToSend(net.lecousin.framework.io.IO.Readable body)
Set the body to send.
|
void |
setContentLength(long size)
Set the Content-Length header.
|
void |
setHeader(MimeHeader header)
Remove any header with the same name, and append this new header.
|
void |
setHeader(String name,
HeaderValueFormat value)
Remove any header with the same name, and append this new header.
|
void |
setHeaderRaw(String name,
String rawValue)
Remove any header with the same name, and append this new header.
|
public static final String CONTENT_TYPE
public static final String CONTENT_LENGTH
public static final String CONTENT_DISPOSITION
public static final String TRANSFER_ENCODING
public static final String CONTENT_TRANSFER_ENCODING
public static final String CONTENT_ENCODING
public static final String CONNECTION
public MimeMessage()
public MimeMessage(List<MimeHeader> headers)
public MimeMessage(MimeHeader... headers)
public net.lecousin.framework.log.Logger getLogger()
public List<MimeHeader> getHeaders()
public List<MimeHeader> getHeaders(String name)
public <T extends HeaderValueFormat> List<T> getHeadersValues(String name, Class<T> format) throws Exception
Exceptionpublic MimeHeader getFirstHeader(String name)
public <T extends HeaderValueFormat> T getFirstHeaderValue(String name, Class<T> format) throws Exception
Exceptionpublic String getFirstHeaderRawValue(String name)
public Long getFirstHeaderLongValue(String name)
public boolean hasHeader(String name)
public void addHeader(String name, HeaderValueFormat value)
public void addHeader(MimeHeader header)
public void setHeaderRaw(String name, String rawValue)
public void setHeader(String name, HeaderValueFormat value)
public void setHeader(MimeHeader header)
public void removeHeaders(String name)
public void appendHeadersTo(StringBuilder s)
public void appendHeadersTo(net.lecousin.framework.util.IString s)
public Long getContentLength()
public void setContentLength(long size)
public ParameterizedHeaderValue getContentType() throws Exception
Exceptionpublic String getContentTypeValue()
public <T extends net.lecousin.framework.io.IO.Writable & net.lecousin.framework.io.IO.Readable> void setBodyReceived(T output)
public net.lecousin.framework.io.IO.Writable getBodyReceivedAsOutput()
setBodyReceived(net.lecousin.framework.io.IO.Writable).public net.lecousin.framework.io.IO.Readable getBodyReceivedAsInput()
setBodyReceived(net.lecousin.framework.io.IO.Writable).public net.lecousin.framework.io.IO.Readable getBodyToSend()
public void setBodyToSend(net.lecousin.framework.io.IO.Readable body)
public net.lecousin.framework.io.IO.Readable getReadableStream()
public net.lecousin.framework.concurrent.synch.SynchronizationPoint<IOException> readHeader(net.lecousin.framework.network.client.TCPClient client, int timeout)
public net.lecousin.framework.concurrent.synch.ISynchronizationPoint<IOException> send(net.lecousin.framework.network.TCPRemote remote)
Copyright © 2018. All rights reserved.