put() in ResponseCache invoked with a wrong URI?

by Guitou » Mon, 03 Aug 2009 15:27:29 GMT


Sponsored Links
 Hi,
I extended ResponseCache as follow :

public class DataLoader extends ResponseCache {

        @Override
        public CacheResponse get(URI uri, String arg1,
                        Map<String, List<String>> arg2) throws IOException {
                // TODO Auto-generated method stub
                Log.i("DataLoader", "Get()" + uri);
                return null;
        }

        @Override
        public CacheRequest put(URI uri, URLConnection conn) throws
IOException {
                // TODO Auto-generated method stub
                Log.i("DataLoader", "Put()" + uri);
                return null;
        }
}

I use this code to retrieve datas :

                ResponseCache.setDefault(new DataLoader());
                URI uri;
                HttpURLConnection conn;
                try {
                        uri = new 
URI(" http://www.google.com/intl/en_ALL/images/logo.gif" ;);
                        conn = (HttpURLConnection)uri.toURL().openConnection();
                        InputStream inputStream;
                        inputStream = conn.getInputStream();
                        inputStream.close();
                } catch (MalformedURLException e1) {
                        // TODO Auto-generated catch block
                        e1.printStackTrace();
                } catch (IOException e1) {
                        // TODO Auto-generated catch block
                        e1.printStackTrace();
                } catch (URISyntaxException e1) {
                        // TODO Auto-generated catch block
                        e1.printStackTrace();
                }

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!
--~--~---------~--~----~------------~-------~--~----~



put() in ResponseCache invoked with a wrong URI?

by Matt Kanninen » Sat, 19 Sep 2009 08:45:03 GMT


 I am seeing the same thing.



--~--~---------~--~----~------------~-------~--~----~


Sponsored Links


put() in ResponseCache invoked with a wrong URI?

by Matt Kanninen » Sat, 19 Sep 2009 11:13:24 GMT


 To answer the question of how to get the full url, my work around was
to use conn.getURL() instead of the passed URI.  So it would be:

        public CacheRequest put(URI uri, URLConnection conn) throws
IOException {
                // TODO Auto-generated method stub
                Log.i("DataLoader", "Put() " + conn.getURL);
                return null;
        }




--~--~---------~--~----~------------~-------~--~----~



put() in ResponseCache invoked with a wrong URI?

by Guitou » Wed, 30 Sep 2009 02:49:28 GMT


 I will give it a try! Thanks Matt





--~--~---------~--~----~------------~-------~--~----~



Other Threads

1. Android Developer Position for a NY Based Internet Company

Hi There,

SourcePad is a New York City based Internet company focusing on
outsourcing services for SME. Our company practices a groundbreaking
work environment where collaboration is exercised throughout all
levels of the company.

We are expanding rapidly and have now worked with 50+ clients!

We currently have more Mobile work than we can handle and need to grow
our team!

We have positions for both Mid-shift & Night-Shift, so, if you are
smart, e{*filter*}d about Mobile  development and want to potentially
double your salary...we want you to join our team!

If you are interested, please email Kim at k...@sourcepad.com or text
at 0916.496.83.46

Look forward to speaking with you!

Kim Abunado
Recruiting Manager
SourcePad LLC
0916.496.8346
www.sourcepad.com

-- 

2. (OOT) Share hasil foto

Wogh!!

Ikutan dong.. #delta
@jakontil
www.gopego.com

-----Original Message-----
From: dolly surya <robot...@wisaka.or.id>
Sender: id-android@googlegroups.com
Date: Wed, 26 Jan 2011 20:24:41 
To: <id-android@googlegroups.com>
Reply-To: id-android@googlegroups.com
Subject: Re: [id-android] (OOT) Share hasil foto

Gak pake efek apa2, lokasi depan delta gatsu :p



-- 
===============
"

-- 
===============
"

3. WTKHT : Cara Wipe All Data Di Motorola Droid 1

4. LocationManager.requestSingleUpdate() crashes device

5. Looking for 50-50 partner - Using unity3d

6. "Share app" button? Any direct way to send link to launch market to app location?

7. How to change the background color of ToggleButton?