put() in ResponseCache invoked with a wrong URI?

Put your problem here if it does not fit any of the other categories.

put() in ResponseCache invoked with a wrong URI?

Postby Drummkit » Mon Aug 03, 2009 8:32 am

Hi,
I extended ResponseCache as follow :

Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting
  1.  
  2. public class DataLoader extends ResponseCache {
  3.  
  4.         @Override
  5.  
  6.         public CacheResponse get(URI uri, String arg1,
  7.  
  8.                         Map<String, List<String>> arg2) throws IOException {
  9.  
  10.                 // TODO Auto-generated method stub
  11.  
  12.                 Log.i("DataLoader", "Get()" + uri);
  13.  
  14.                 return null;
  15.  
  16.         }
  17.  
  18.         @Override
  19.  
  20.         public CacheRequest put(URI uri, URLConnection conn) throws
  21.  
  22. IOException {
  23.  
  24.                 // TODO Auto-generated method stub
  25.  
  26.                 Log.i("DataLoader", "Put()" + uri);
  27.  
  28.                 return null;
  29.  
  30.         }
  31.  
  32. }
  33.  
  34.  
Parsed in 0.032 seconds, using GeSHi 1.0.8.4

Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting
  1.  
  2. I use this code to retrieve datas :
  3.  
  4.                 ResponseCache.setDefault(new DataLoader());
  5.  
  6.                 URI uri;
  7.  
  8.                 HttpURLConnection conn;
  9.  
  10.                 try {
  11.  
  12.                         uri = new URI("http://www.google.com/intl/en_ALL/images/logo.gif");
  13.  
  14.                         conn = (HttpURLConnection)uri.toURL().openConnection();
  15.  
  16.                         InputStream inputStream;
  17.  
  18.                         inputStream = conn.getInputStream();
  19.  
  20.                         inputStream.close();
  21.  
  22.                 } catch (MalformedURLException e1) {
  23.  
  24.                         // TODO Auto-generated catch block
  25.  
  26.                         e1.printStackTrace();
  27.  
  28.                 } catch (IOException e1) {
  29.  
  30.                         // TODO Auto-generated catch block
  31.  
  32.                         e1.printStackTrace();
  33.  
  34.                 } catch (URISyntaxException e1) {
  35.  
  36.                         // TODO Auto-generated catch block
  37.  
  38.                         e1.printStackTrace();
  39.  
  40.                 }
  41.  
  42.  
Parsed in 0.034 seconds, using GeSHi 1.0.8.4

But when I look to my logs, the URI sent to the get() method is good
(http://www.google.com/intl/en_ALL/images/logo.gif) but in the put()
it does not give me the same URI but only http://www.google.com
Is that normal?
How to get the full url in put() ?
Thanks for your help!
Drummkit
Freshman
Freshman
 
Posts: 3
Joined: Wed Jul 15, 2009 2:43 pm

Top

Return to Other Coding-Problems

Who is online

Users browsing this forum: No registered users and 17 guests