jdk/test/java/net/ResponseCache/ResponseCacheTest.java
changeset 28242 0cbef7c46996
parent 7668 d4a77089c587
equal deleted inserted replaced
28241:b7b95c178b76 28242:0cbef7c46996
     1 /*
     1 /*
     2  * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
     2  * Copyright (c) 2003, 2014, Oracle and/or its affiliates. All rights reserved.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     4  *
     4  *
     5  * This code is free software; you can redistribute it and/or modify it
     5  * This code is free software; you can redistribute it and/or modify it
     6  * under the terms of the GNU General Public License version 2 only, as
     6  * under the terms of the GNU General Public License version 2 only, as
     7  * published by the Free Software Foundation.
     7  * published by the Free Software Foundation.
    28  */
    28  */
    29 
    29 
    30 import java.net.*;
    30 import java.net.*;
    31 import java.util.*;
    31 import java.util.*;
    32 import java.io.*;
    32 import java.io.*;
    33 import sun.net.www.ParseUtil;
       
    34 import javax.net.ssl.*;
    33 import javax.net.ssl.*;
    35 
    34 
    36 /**
    35 /**
    37  * Request should get serviced by the cache handler. Response get
    36  * Request should get serviced by the cache handler. Response get
    38  * saved through the cache handler.
    37  * saved through the cache handler.
   176             }
   175             }
   177         }
   176         }
   178     }
   177     }
   179 
   178 
   180     static class MyResponseCache extends ResponseCache {
   179     static class MyResponseCache extends ResponseCache {
   181         public CacheResponse
   180         public CacheResponse get(URI uri, String rqstMethod,
   182         get(URI uri, String rqstMethod, Map<String,List<String>> rqstHeaders)
   181                                  Map<String,List<String>> rqstHeaders)
   183             throws IOException {
   182             throws IOException
   184             if (uri.equals(ParseUtil.toURI(url1))) {
   183         {
   185                 return new MyCacheResponse(FNPrefix+"file1.cache");
   184             try {
       
   185                 if (uri.equals(url1.toURI())) {
       
   186                     return new MyCacheResponse(FNPrefix+"file1.cache");
       
   187                 }
       
   188             } catch (URISyntaxException ex) {
       
   189                 throw new RuntimeException (ex);
   186             }
   190             }
   187             return null;
   191             return null;
   188         }
   192         }
   189 
   193 
   190         public CacheRequest put(URI uri, URLConnection conn)  throws IOException {
   194         public CacheRequest put(URI uri, URLConnection conn)  throws IOException {