Java tutorial
//package com.java2s; //License from project: Open Source License public class Main { /** * Returns true if the content type string indicates textual content. Currently these are any Content-Types that start with one of the * following: * <pre> * text/ * application/x-javascript * application/javascript * application/json * application/xml * application/xhtml+xml * </pre> * * @param contentType contentType string to parse * @return true if the content type is textual */ public static boolean hasTextualContent(String contentType) { return contentType != null && (contentType.startsWith("text/") || contentType.startsWith("application/x-javascript") || contentType.startsWith("application/javascript") || contentType.startsWith("application/json") || contentType.startsWith("application/xml") || contentType.startsWith("application/xhtml+xml")); } }