@ThreadSafe public final class HTTPHelper extends Object
| Modifier and Type | Field and Description |
|---|---|
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(javax.mail.internet.InternetHeaders aHeaders) |
static IHTTPIncomingDumper |
getHTTPIncomingDumper() |
static IHTTPOutgoingDumper |
getHTTPOutgoingDumper(IBaseMessage aMsg) |
static int |
readChunkLen(InputStream aIS)
Read chunk size (including the newline ending it).
|
static byte[] |
readHttpPayload(InputStream aIS,
IAS2HttpResponseHandler aResponseHandler,
IMessage aMsg) |
static DataSource |
readHttpRequest(IAS2InputStreamProvider aISP,
IAS2HttpResponseHandler aResponseHandler,
IMessage aMsg)
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(com.helger.commons.functional.ISupplier<? extends IHTTPIncomingDumper> aHttpDumperFactory)
Set the factory for creating dumper for incoming HTTP requests.
|
static void |
setHTTPOutgoingDumperFactory(com.helger.commons.functional.IFunction<? super IBaseMessage,? extends IHTTPOutgoingDumper> aHttpDumperFactory)
Set the factory for creating dumper for outgoing 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
@Nonnull @ReturnsMutableCopy public static com.helger.commons.collection.impl.ICommonsList<String> getAllHTTPHeaderLines(@Nonnull javax.mail.internet.InternetHeaders aHeaders)
@Nonnull public static byte[] readHttpPayload(@Nonnull InputStream aIS, @Nonnull IAS2HttpResponseHandler aResponseHandler, @Nonnull IMessage aMsg) throws IOException
IOException@Nullable public static IHTTPIncomingDumper getHTTPIncomingDumper()
null if none
is presentpublic static void setHTTPIncomingDumperFactory(@Nonnull com.helger.commons.functional.ISupplier<? extends IHTTPIncomingDumper> aHttpDumperFactory)
aHttpDumperFactory - The dumper factory to be used. May not be null.@Nullable public static IHTTPOutgoingDumper getHTTPOutgoingDumper(@Nonnull IBaseMessage aMsg)
aMsg - The message for which a dumper should be created.null if none
is present. Must be closed afterwards!public static void setHTTPOutgoingDumperFactory(@Nullable com.helger.commons.functional.IFunction<? super IBaseMessage,? extends IHTTPOutgoingDumper> aHttpDumperFactory)
aHttpDumperFactory - The dumper factory to be used. May not be null.@Nonnull public static DataSource readHttpRequest(@Nonnull IAS2InputStreamProvider aISP, @Nonnull IAS2HttpResponseHandler aResponseHandler, @Nonnull IMessage aMsg) throws IOException, javax.mail.MessagingException
DataSource. If is on, data is not read.aISP - 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.DataSource that holds/refers to the body.IOException - In case of error reading from the InputStreamjavax.mail.MessagingException - In case header line parsing failspublic 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–2019 Philip Helger. All rights reserved.