import
java.io.IOException;
import
java.net.*;
import
java.util.HashMap;
import
java.util.LinkedList;
import
java.util.List;
import
java.util.Map;
public
class
JavaResponseCacheExample1 {
public
static
void
main(String args[])
throws
Exception
{
URI uri1 =
new
URI(uri);
URLConnection urlcon = url.openConnection();
ResponseCache responseCache =
new
ResponseCache() {
@Override
public
CacheResponse get(
URI uri, String rqstMethod,
Map<String, List<String> > rqstHeaders)
throws
IOException
{
return
null
;
}
@Override
public
CacheRequest put(URI uri,
URLConnection conn)
throws
IOException
{
return
null
;
}
};
ResponseCache.setDefault(responseCache);
System.out.println(
"Default value: "
+ ResponseCache.getDefault());
Map<String, List<String> > maps
=
new
HashMap<String, List<String> >();
List<String> list =
new
LinkedList<String>();
list.add(
"REema"
);
maps.put(
"1"
, list);
System.out.println(
"The put() method has been called..."
);
System.out.println(
"The put() method returns: "
+ responseCache.put(uri1, urlcon));
System.out.println(
"The get() method has been called..."
);
System.out.println(
"The get() method returns: "
+ responseCache.get(uri1, uri, maps));
}
}