×

Welcome to TagMyCode

Please login or create account to add a snippet.
0
0
 
0
Language: Java
Posted by: Karthick Bala
Added: Jul 25, 2014 10:04 AM
Modified: Jul 25, 2014 10:08 AM
Views: 6
Tags: no tags
  1.     public static String getMimeType(HttpServletRequest request) {
  2.         String acceptHdr = request.getHeader("Accept");
  3.  
  4.         String mimeType = "application/json;charset=utf-8";
  5.  
  6.         if (acceptHdr != null && acceptHdr.indexOf("application/xml") != -1) {
  7.             mimeType = "application/xml;charset=utf-8";
  8.             //mimeType = "application/json;charset=utf-8";
  9.         }
  10.  
  11.         return mimeType;
  12.     }