@ThreadSafe public final class HTTPHelper extends Object
| Modifier and Type | Field and Description |
|---|---|
static String |
MA_HTTP_ORIGINAL_CONTENT_LENGTH
The original content length before any eventual decoding (only if
Content-Transfer-Encoding is provided)
|
static String |
MA_HTTP_ORIGINAL_CONTENT_TRANSFER_ENCODING
The value of the Content-Transfer-Encoding header (if provided)
|
static String |
MA_HTTP_REQ_TYPE
The request method used (POST or GET)
|
static String |
MA_HTTP_REQ_URL
The request URL used - defaults to "/"
|
static String |
MA_HTTP_REQ_VERSION
The HTTP version used.
|
| Modifier and Type | Method and Description |
|---|---|
static com.helger.commons.collection.impl.ICommonsList<String> |
getAllHTTPHeaderLines(com.helger.commons.http.HttpHeaderMap aHeaders) |
static IHTTPIncomingDumper |
getHTTPIncomingDumper() |
static Supplier<? extends IHTTPIncomingDumper> |
getHTTPIncomingDumperFactory() |
static DataSource |
readAndDecodeHttpRequest(IAS2HttpRequestDataProvider aRDP,
IAS2HttpResponseHandler aResponseHandler,
IMessage aMsg,
IHTTPIncomingDumper aIncomingDumper) |
static int |
readChunkLen(InputStream aIS)
Read chunk size (including the newline ending it).
|
static com.helger.mail.datasource.IExtendedDataSource |
readHttpRequest(IAS2HttpRequestDataProvider aRDP,
IAS2HttpResponseHandler aResponseHandler,
IMessage aMsg,
IHTTPIncomingDumper aIncomingDumper)
Read headers and payload from the passed input stream provider.
|
static void |
readTillNexLine(InputStream aIS)
Read up to (and including )CRLF.
|
static void |
sendSimpleHTTPResponse(IAS2HttpResponseHandler aResponseHandler,
int nResponseCode)
Send a simple HTTP response that only contains the HTTP status code and the
respective descriptive text.
|
static void |
setHTTPIncomingDumperFactory(Supplier<? extends IHTTPIncomingDumper> aHttpDumperFactory)
Set the global factory for creating dumper for incoming HTTP requests.
|
public static final String MA_HTTP_REQ_TYPE
public static final String MA_HTTP_REQ_URL
public static final String MA_HTTP_REQ_VERSION
public static final String MA_HTTP_ORIGINAL_CONTENT_TRANSFER_ENCODING
public static final String MA_HTTP_ORIGINAL_CONTENT_LENGTH
@Nonnull @ReturnsMutableCopy public static com.helger.commons.collection.impl.ICommonsList<String> getAllHTTPHeaderLines(@Nonnull com.helger.commons.http.HttpHeaderMap aHeaders)
@Nullable public static IHTTPIncomingDumper getHTTPIncomingDumper()
null
if none is present@Nonnull public static Supplier<? extends IHTTPIncomingDumper> getHTTPIncomingDumperFactory()
null.public static void setHTTPIncomingDumperFactory(@Nonnull Supplier<? extends IHTTPIncomingDumper> aHttpDumperFactory)
aHttpDumperFactory - The dumper factory to be used. May not be null.@Nonnull public static com.helger.mail.datasource.IExtendedDataSource readHttpRequest(@Nonnull IAS2HttpRequestDataProvider aRDP, @Nonnull IAS2HttpResponseHandler aResponseHandler, @Nonnull IMessage aMsg, @Nullable IHTTPIncomingDumper aIncomingDumper) throws IOException, javax.mail.MessagingException
DataSource. If is on, data is not read.aRDP - The abstract input stream provider to use. May not be
null.aResponseHandler - The HTTP response handler to be used. May not be null.aMsg - The Message to be filled. May not be null.aIncomingDumper - Optional incoming HTTP dumper. May be null.IExtendedDataSource that holds/refers to the body.IOException - In case of error reading from the InputStreamjavax.mail.MessagingException - In case header line parsing fails@Nonnull public static DataSource readAndDecodeHttpRequest(@Nonnull IAS2HttpRequestDataProvider aRDP, @Nonnull IAS2HttpResponseHandler aResponseHandler, @Nonnull IMessage aMsg, @Nullable IHTTPIncomingDumper aIncomingDumper) throws IOException, javax.mail.MessagingException
IOExceptionjavax.mail.MessagingExceptionpublic static void sendSimpleHTTPResponse(@Nonnull IAS2HttpResponseHandler aResponseHandler, @Nonnegative int nResponseCode) throws IOException
aResponseHandler - The response handler to be used.nResponseCode - The HTTP response code to use.IOException - In case sending fails for whatever reasonpublic static int readChunkLen(@Nonnull @WillNotClose InputStream aIS) throws IOException
aIS - - input stream to read fromIOException - if stream ends during chunk length readpublic static void readTillNexLine(@Nonnull @WillNotClose InputStream aIS) throws IOException
aIS - - input stream to read fromIOException - if stream ends during chunk length readCopyright © 2013–2022 Philip Helger. All rights reserved.