public class HTTPUtil extends Object
Modifier and Type | Class and Description |
---|---|
static class |
HTTPUtil.Method |
Modifier and Type | Field and Description |
---|---|
static String |
HEADER_CONNECTION |
static String |
HEADER_CONTENT_TYPE |
static String |
HEADER_USER_AGENT |
static String |
HTTP_PROP_OVERRIDE_SSL_CHECKS |
static String |
HTTP_PROP_REMOVE_HEADER_FOLDING |
static String |
HTTP_PROP_SSL_PROTOCOLS |
static String |
MA_HTTP_REQ_TYPE |
static String |
MA_HTTP_REQ_URL |
static String |
PARAM_CONNECT_TIMEOUT |
static String |
PARAM_READ_TIMEOUT |
static String |
PARAM_SOCKET_TIMEOUT |
Constructor and Description |
---|
HTTPUtil() |
Modifier and Type | Method and Description |
---|---|
static void |
cleanIdHeaders(javax.mail.internet.InternetHeaders hdrs)
Cleans specific headers to ensure AS2 compatibility
|
static void |
copyHttpHeaders(HttpURLConnection conn,
javax.mail.internet.InternetHeaders headers) |
static ResponseWrapper |
execRequest(String method,
String url,
Enumeration<javax.mail.Header> headers,
org.apache.http.NameValuePair[] params,
InputStream inputStream,
Map<String,String> options,
long noChunkMaxSize)
Execute a request via HTTP
|
static HttpURLConnection |
getConnection(String url,
boolean output,
boolean input,
boolean useCaches,
String requestMethod)
Deprecated.
Use post method to send messages
|
static String |
getHTTPResponseMessage(int responseCode) |
static String |
getParamsString(Map<String,String> params) |
static File |
getTrustedCertsKeystore() |
static boolean |
isLocalhostBound(InetAddress addr) |
static String |
printHeaders(Enumeration<javax.mail.Header> hdrs,
String nameValueSeparator,
String valuePairSeparator) |
static byte[] |
readData(InputStream inStream,
OutputStream outStream,
Message msg) |
static byte[] |
readHTTP(InputStream inStream,
OutputStream outStream,
javax.mail.internet.InternetHeaders headerCache,
List<String> httpRequest) |
static String[] |
readRequest(InputStream in) |
static void |
sendHTTPResponse(OutputStream out,
int responseCode,
ByteArrayOutputStream data,
Enumeration<String> headers) |
static void |
sendHTTPResponse(OutputStream out,
int responseCode,
String data) |
public static final String MA_HTTP_REQ_TYPE
public static final String MA_HTTP_REQ_URL
public static final String HTTP_PROP_REMOVE_HEADER_FOLDING
public static final String HTTP_PROP_SSL_PROTOCOLS
public static final String HTTP_PROP_OVERRIDE_SSL_CHECKS
public static final String PARAM_READ_TIMEOUT
public static final String PARAM_CONNECT_TIMEOUT
public static final String PARAM_SOCKET_TIMEOUT
public static final String HEADER_CONTENT_TYPE
public static final String HEADER_USER_AGENT
public static final String HEADER_CONNECTION
public static String getHTTPResponseMessage(int responseCode)
public static byte[] readHTTP(InputStream inStream, OutputStream outStream, javax.mail.internet.InternetHeaders headerCache, List<String> httpRequest) throws IOException, javax.mail.MessagingException
IOException
javax.mail.MessagingException
public static byte[] readData(InputStream inStream, OutputStream outStream, Message msg) throws IOException, javax.mail.MessagingException
IOException
javax.mail.MessagingException
public static void cleanIdHeaders(javax.mail.internet.InternetHeaders hdrs)
hdrs
- Headers to be cleanedpublic static String[] readRequest(InputStream in) throws IOException
IOException
public static ResponseWrapper execRequest(String method, String url, Enumeration<javax.mail.Header> headers, org.apache.http.NameValuePair[] params, InputStream inputStream, Map<String,String> options, long noChunkMaxSize) throws Exception
method
- GET, PUT, POST, DELETE, etcurl
- The remote connection stringheaders
- HTTP headers to be sentparams
- Parameters for the get. Can be null.inputStream
- Source stream for retrieving request dataoptions
- Any additional options for affecting request behaviour. Can be null.noChunkMaxSize
- The maximum size before chunking would need to be utilised. 0 disables check for chunkingException
public static void sendHTTPResponse(OutputStream out, int responseCode, ByteArrayOutputStream data, Enumeration<String> headers) throws IOException
IOException
public static void sendHTTPResponse(OutputStream out, int responseCode, String data) throws IOException
IOException
public static String printHeaders(Enumeration<javax.mail.Header> hdrs, String nameValueSeparator, String valuePairSeparator)
public static File getTrustedCertsKeystore() throws OpenAS2Exception
OpenAS2Exception
public static String getParamsString(Map<String,String> params) throws UnsupportedEncodingException
UnsupportedEncodingException
public static boolean isLocalhostBound(InetAddress addr)
public static HttpURLConnection getConnection(String url, boolean output, boolean input, boolean useCaches, String requestMethod) throws OpenAS2Exception
url
- output
- input
- useCaches
- requestMethod
- OpenAS2Exception
public static void copyHttpHeaders(HttpURLConnection conn, javax.mail.internet.InternetHeaders headers)
Copyright © 2018. All rights reserved.