예제 #1
0
 @Override
 public Map<String, List<String>> getRequestProperties() {
   if (connected) {
     throw new IllegalStateException(Msg.getString("K0091")); // $NON-NLS-1$
   }
   return reqHeader.getFieldMap();
 }
예제 #2
0
 /**
  * Provides an unmodifiable map of the connection header values. The map keys are the String
  * header field names. Each map value is a list of the header field values associated with that
  * key name.
  *
  * @return the mapping of header field names to values
  * @since 1.4
  */
 @Override
 public Map<String, List<String>> getHeaderFields() {
   try {
     // ensure that resHeader exists
     getInputStream();
   } catch (IOException e) {
     // ignore
   }
   if (null == resHeader) {
     return null;
   }
   return resHeader.getFieldMap();
 }
예제 #3
0
 // Tries to get head and body from cache, return true if has got this time
 // or
 // already got before
 private boolean getFromCache() throws IOException {
   if (useCaches && null != responseCache && !hasTriedCache) {
     hasTriedCache = true;
     if (null == resHeader) {
       resHeader = new Header();
     }
     cacheResponse = responseCache.get(uri, method, resHeader.getFieldMap());
     if (null != cacheResponse) {
       Map<String, List<String>> headMap = cacheResponse.getHeaders();
       if (null != headMap) {
         resHeader = new Header(headMap);
       }
       is = cacheResponse.getBody();
       if (null != is) {
         return true;
       }
     }
   }
   if (hasTriedCache && null != is) {
     return true;
   }
   return false;
 }