/** * Format request HTTP headers. * * @param request The HTTP request. */ public static String formatHttpRequestHeaders(HttpWebRequest request) throws URISyntaxException, EWSHttpException { final String method = request.getRequestMethod().toUpperCase(); final String path = request.getUrl().toURI().getPath(); final Map<String, String> property = request.getRequestProperty(); final String headers = EwsUtilities.formatHttpHeaders(property); return String.format("%s %s HTTP/%s\n", method, path, "1.1") + headers + "\n"; }
/** * Format http response headers. * * @param response the response * @return the string * @throws EWSHttpException the EWS http exception */ public static String formatHttpResponseHeaders(HttpWebRequest response) throws EWSHttpException { final int code = response.getResponseCode(); final String contentType = response.getResponseContentType(); final Map<String, String> headers = response.getResponseHeaders(); return code + " " + contentType + "\n" + EwsUtilities.formatHttpHeaders(headers) + "\n"; }
/** * Format request HTTP headers. * * @param request The HTTP request. */ public static String formatHttpRequestHeaders(HttpWebRequest request) throws URISyntaxException, EWSHttpException { final String method = request.getRequestMethod().toUpperCase(); final String path = request.getUrl().toURI().getPath(); final Map<String, String> property = request.getRequestProperty(); final String headers = EwsUtilities.formatHttpHeaders(property); return String.format("%s %s HTTP/%s\n", method, path, "1.1") + headers + "\n"; }
/** * Format http response headers. * * @param response the response * @return the string * @throws EWSHttpException the EWS http exception */ public static String formatHttpResponseHeaders(HttpWebRequest response) throws EWSHttpException { final int code = response.getResponseCode(); final String contentType = response.getResponseContentType(); final Map<String, String> headers = response.getResponseHeaders(); return code + " " + contentType + "\n" + EwsUtilities.formatHttpHeaders(headers) + "\n"; }