title: Http response through service sends content (mime) type in text/html but not application/json
body: <p>My application using <code>Oauth</code> for <code>basecam</code> api. I am trying to get <code>Httpresponse</code> into <code>json</code> format but it revert into plain html (text/html) content-type. so there is no method to parse HTML content and get the token from <code>basecamp</code>. This is not homework but a small R&amp;D to quick start <code>Oauth</code> protocol. as am new to <code>oauth</code>.</p>
  
  <pre><code>//HERE -&gt; final String JSON_CONTENT = "application/json"
  String contentType = OAuthConstants.JSON_CONTENT;
  
      if (response.getEntity().getContentType() != null) {
          contentType = response.getEntity().getContentType().getValue();
          //BELOW -&gt; getting contentType is in "text/html; utf-8
          System.out.println(response.getEntity().getContentType().getValue()); //text/html; charset=utf-8
      }
  
      if (contentType.contains(OAuthConstants.JSON_CONTENT)) {
          return handleJsonResponse(response);
      } else 
          if (contentType.contains(OAuthConstants.URL_ENCODED_CONTENT)) {
            return handleURLEncodedResponse(response);
          } else 
              if (contentType.contains(OAuthConstants.XML_CONTENT)) {
                return handleXMLResponse(response);
              }   
              else {
                  // Unsupported Content type
                  throw new RuntimeException(
                          "Cannot handle "
                                  + contentType
                                  + " content type. Supported content types include JSON, XML and URLEncoded");
              }
  </code></pre>
  
  <p>So above lines explain very well that control won't come is json, xml or <code>url_encoded</code> if-else. Si either i need to parse text/html into json or xml response or i have to create another method name <code>handleHtmlResponse()</code>. what way it would be continent to get <code>contentType</code>. </p>