< prev index next >

src/java.base/share/classes/java/net/ResponseCache.java

Print this page




  74      *
  75      * @throws  SecurityException
  76      *          If a security manager has been installed and it denies
  77      * {@link NetPermission}{@code ("getResponseCache")}
  78      *
  79      * @see #setDefault(ResponseCache)
  80      * @return the system-wide {@code ResponseCache}
  81      * @since 1.5
  82      */
  83     public static synchronized ResponseCache getDefault() {
  84         SecurityManager sm = System.getSecurityManager();
  85         if (sm != null) {
  86             sm.checkPermission(SecurityConstants.GET_RESPONSECACHE_PERMISSION);
  87         }
  88         return theResponseCache;
  89     }
  90 
  91     /**
  92      * Sets (or unsets) the system-wide cache.
  93      *
  94      * Note: non-standard procotol handlers may ignore this setting.
  95      *
  96      * @param responseCache The response cache, or
  97      *          {@code null} to unset the cache.
  98      *
  99      * @throws  SecurityException
 100      *          If a security manager has been installed and it denies
 101      * {@link NetPermission}{@code ("setResponseCache")}
 102      *
 103      * @see #getDefault()
 104      * @since 1.5
 105      */
 106     public static synchronized void setDefault(ResponseCache responseCache) {
 107         SecurityManager sm = System.getSecurityManager();
 108         if (sm != null) {
 109             sm.checkPermission(SecurityConstants.SET_RESPONSECACHE_PERMISSION);
 110         }
 111         theResponseCache = responseCache;
 112     }
 113 
 114     /**




  74      *
  75      * @throws  SecurityException
  76      *          If a security manager has been installed and it denies
  77      * {@link NetPermission}{@code ("getResponseCache")}
  78      *
  79      * @see #setDefault(ResponseCache)
  80      * @return the system-wide {@code ResponseCache}
  81      * @since 1.5
  82      */
  83     public static synchronized ResponseCache getDefault() {
  84         SecurityManager sm = System.getSecurityManager();
  85         if (sm != null) {
  86             sm.checkPermission(SecurityConstants.GET_RESPONSECACHE_PERMISSION);
  87         }
  88         return theResponseCache;
  89     }
  90 
  91     /**
  92      * Sets (or unsets) the system-wide cache.
  93      *
  94      * Note: non-standard protocol handlers may ignore this setting.
  95      *
  96      * @param responseCache The response cache, or
  97      *          {@code null} to unset the cache.
  98      *
  99      * @throws  SecurityException
 100      *          If a security manager has been installed and it denies
 101      * {@link NetPermission}{@code ("setResponseCache")}
 102      *
 103      * @see #getDefault()
 104      * @since 1.5
 105      */
 106     public static synchronized void setDefault(ResponseCache responseCache) {
 107         SecurityManager sm = System.getSecurityManager();
 108         if (sm != null) {
 109             sm.checkPermission(SecurityConstants.SET_RESPONSECACHE_PERMISSION);
 110         }
 111         theResponseCache = responseCache;
 112     }
 113 
 114     /**


< prev index next >