code: private static HashMap<String, String> getValuesByHeaderPrefix(final HttpURLConnection request, final String prefix) {
          final HashMap<String, String> retVals = new HashMap<String, String>();
          final Map<String, List<String>> headerMap = request.getHeaderFields();
          final int prefixLength = prefix.length();
  
          for (final Entry<String, List<String>> entry : headerMap.entrySet()) {
              if (entry.getKey() != null && entry.getKey().startsWith(prefix)) {
                  final List<String> currHeaderValues = entry.getValue();
                  retVals.put(entry.getKey().substring(prefixLength), currHeaderValues.get(0));
              }
          }
  
          return retVals;
      }
docs: Returns all the header/value pairs with the given prefix.
  
  @param request
  the request object containing headers to parse.
  @param prefix
  the prefix for headers to be returned.
  @return all the header/value pairs with the given prefix.