@Override public ContentType getContentType() { if(headers != null) { return HttpUtil.getContentType(headers); } return null; }
@Override public KeyStore getKeyStore() throws KeyStoreException, IOException, InvalidKeySpecException, NoSuchAlgorithmException, CertificateException { return SSLUtil.getKeyStore(file, type, password); }
@Override public String toString() { return HttpUtil.getFormattedContentType(contentType, charset); } }
public static String getHexDataDumpAsString(byte[] buf) { return getHexDataDumpAsString(buf, buf.length); }
public static boolean isCssContentType(final String contentType) { final String ct = getContentTypeBeforeSemiColon(contentType); return ct.startsWith("text/css"); }
@Override public String getContentTypeString() { return HttpUtil.getMimeFromContentType(jtf_content_type_charset.getText()); }
public static String base64encode(String inStr) { return base64encode(inStr.getBytes(Charsets.UTF_8)); }
@Override public void showError(final Throwable ex){ messageDialog.showError(Util.getStackTrace(ex)); }
private ResponseBean getDefaultResponseBean(){ ResponseBean expResult = new ResponseBean(); expResult.setStatusLine("HTTP/1.1 200 OK"); expResult.setStatusCode(200); expResult.addHeader("Content-Type", "text/plain; charset=utf-8"); expResult.addHeader("Transfer-Encoding", "chunked"); expResult.addHeader("Server", "Jetty(6.1.25)"); expResult.setResponseBody(Util.base64decodeByteArray("KipSRVNUQ2xpZW50IFRyYWNlU2VydmxldCoqCgoqTWV0aG9kKgoJR0VUCgoqUGF0aCBJbmZvKgoJLwoKKkhlYWRlcnMqCglIb3N0OiBsb2NhbGhvc3Q6MTAxMDEKCUNvbm5lY3Rpb246IEtlZXAtQWxpdmUKCVVzZXItQWdlbnQ6IEFwYWNoZS1IdHRwQ2xpZW50LzQuMi4xIChqYXZhIDEuNSkKCipRdWVyeSBTdHJpbmcqCgludWxsCgoqUGFyYW1ldGVycyoKCipCb2R5IChGaXJzdCAxMDAgY2hhcmFjdGVycyBvbmx5KSoKCQoK")); return expResult; }
public static void dumpHexData(PrintStream out, byte[] buf) { dumpHexData(out, buf, buf.length); }
public void load(MultiValueMap<String, String> map) { String str = MultiEntryUtil.join(map); jta_in.setText(str); }
@Override public String getContentTypeCharsetFormatted() { return HttpUtil.getFormattedContentType(contentType); }
public static boolean isFormUrlEncodedContentType(final String contentType) { final String ct = getContentTypeBeforeSemiColon(contentType); return ct.startsWith("application/x-www-form-urlencoded"); }
@Override public void changed(String contentType, String charset) { final String formatted = HttpUtil.getFormattedContentType(contentType, charset); jtf_content_type_charset.setText(formatted); } });
public static boolean isJsonContentType(final String contentType) { final String ct = getContentTypeBeforeSemiColon(contentType); return ct.startsWith("application/json") || ct.endsWith("+json"); }
public static String getFormattedContentType(final String contentType, final Charset charset){ return getFormattedContentType(contentType, (charset!=null? charset.name(): null)); }
public static boolean isHTMLContentType(final String contentType) { final String ct = getContentTypeBeforeSemiColon(contentType); return ct.startsWith("text/html") || ct.endsWith("+html"); }
public static boolean isWebImageContentType(final String contentType) { final String ct = getContentTypeBeforeSemiColon(contentType); return ct.equals("image/jpeg") || ct.equals("image/png") || ct.equals("image/gif"); }
public static boolean isXmlContentType(final String contentType) { final String ct = getContentTypeBeforeSemiColon(contentType); return ct.startsWith("application/xml") || ct.startsWith("text/xml") || ct.endsWith("+xml"); }
public static boolean isJsContentType(final String contentType) { final String ct = getContentTypeBeforeSemiColon(contentType); return ct.startsWith("application/javascript") || ct.startsWith("application/x-javascript") || ct.startsWith("text/javascript"); }