Package com.braintreegateway.util
Class Http
- java.lang.Object
-
- com.braintreegateway.util.Http
-
- Direct Known Subclasses:
GraphQLClient
public class Http extends Object
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classHttp.RequestMethod
-
Field Summary
Fields Modifier and Type Field Description private Configurationconfigurationprivate static PatternCVV_PATTERNprivate static PatternENCRYPTED_CARD_DATA_PATTERNstatic StringLINE_FEEDprivate static PatternNUMBER_PATTERNprivate SSLSocketFactorysslSocketFactoryprivate static PatternSTART_GROUP_PATTERN
-
Constructor Summary
Constructors Constructor Description Http(Configuration configuration)
-
Method Summary
-
-
-
Field Detail
-
LINE_FEED
public static final String LINE_FEED
- See Also:
- Constant Field Values
-
NUMBER_PATTERN
private static final Pattern NUMBER_PATTERN
-
START_GROUP_PATTERN
private static final Pattern START_GROUP_PATTERN
-
CVV_PATTERN
private static final Pattern CVV_PATTERN
-
ENCRYPTED_CARD_DATA_PATTERN
private static final Pattern ENCRYPTED_CARD_DATA_PATTERN
-
sslSocketFactory
private volatile SSLSocketFactory sslSocketFactory
-
configuration
private Configuration configuration
-
-
Constructor Detail
-
Http
public Http(Configuration configuration)
-
-
Method Detail
-
delete
public NodeWrapper delete(String url)
-
get
public NodeWrapper get(String url)
-
post
public NodeWrapper post(String url)
-
post
public NodeWrapper post(String url, Request request)
-
post
public NodeWrapper post(String url, String request)
-
postMultipart
public NodeWrapper postMultipart(String url, String request, File file)
-
put
public NodeWrapper put(String url)
-
put
public NodeWrapper put(String url, Request request)
-
xmlHttpRequest
private NodeWrapper xmlHttpRequest(Http.RequestMethod requestMethod, String url)
-
httpDo
protected String httpDo(Http.RequestMethod requestMethod, String url, String postBody, File file, HttpURLConnection connection, Map<String,String> headers, String boundary)
-
constructHeaders
protected Map<String,String> constructHeaders(String acceptType, String contentType)
-
xmlHttpRequest
private NodeWrapper xmlHttpRequest(Http.RequestMethod requestMethod, String url, String postBody, File file)
-
addFormField
private void addFormField(String key, String value, PrintWriter writer, String boundary)
-
addFilePart
private void addFilePart(String fieldName, File uploadFile, PrintWriter writer, OutputStream outputStream, String boundary) throws IOException
- Throws:
IOException
-
finish
private void finish(PrintWriter writer, String boundary)
-
getCurrentTime
protected String getCurrentTime()
-
getSSLSocketFactory
protected SSLSocketFactory getSSLSocketFactory()
-
buildConnection
protected HttpURLConnection buildConnection(Http.RequestMethod requestMethod, String urlString, Map<String,String> headers) throws IOException
- Throws:
IOException
-
throwExceptionIfErrorStatusCode
public static void throwExceptionIfErrorStatusCode(int statusCode, String message)
-
isErrorCode
private static boolean isErrorCode(int responseCode)
-
authorizationHeader
public String authorizationHeader()
-
-