Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9038475
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T09:29:53+00:00 2026-06-16T09:29:53+00:00

I want to intercept a request to blobservice on my Android application to url

  • 0

I want to intercept a request to blobservice on my Android application

to url looks like that:
http://foo.appspot.com/simpleams/blobservice?blob-key=AMIfv94NAAoxn1oi_ySWYSiNF3MforFVI6SvDi_NeF0rjNr_QW

@Override
public WebResourceResponse shouldInterceptRequest(WebView view, String url) {
        if(url.contains("blobservice")) {
            return getAppWebResourceResponseFromBlobstore(view, url);
        } else {
            return super.shouldInterceptRequest(view, url);
        }

    }

private WebResourceResponse getAppWebResourceResponseFromBlobstore(WebView view, String url) {
    try {
        // TODO: 
                    return file from local data or download it from 
                    blob service, save it and return it...
    } catch (IOException e) {
        return null;
    }
}

How can i make the request to the server and save the file locally?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-16T09:29:54+00:00Added an answer on June 16, 2026 at 9:29 am

    I found the solution by my self and want to share it with you:

        private WebResourceResponse getAppWebResourceResponseFromBlobstore(WebView view, String url) {
    
    
            int slashIndex = url.lastIndexOf("blobservice?blob-key=");
    
            String key;
            key = url.substring(slashIndex + "blobservice?blob-key=".length());
    
            System.out.println(key);    
                    BlobstoreManager m = new BlobstoreManager(ctx, url);
    
    
            return m.getBlob(key);
    
    
        }
    
    
    public class BlobstoreManager{
    
    
        Context mContext;
        String url;
    
        public BlobstoreManager(Context c, String url) {
    
            this.url = url;
            this.mContext = c;
    
    
        }
    
    
        public WebResourceResponse getBlob(String key) {
    
            String path =  key;
            File file = mContext.getFileStreamPath(key);
            if(file.exists()) {
                 try {
                     System.out.println("Response from Blob");
                    return new WebResourceResponse("", "",mContext.openFileInput(path));
                } catch (FileNotFoundException e) {
                    e.printStackTrace();
                }
            } else {
                try {
    
                    HttpClient httpclient = new DefaultHttpClient();
                    HttpResponse response = httpclient.execute(new HttpGet(url));
                    StatusLine statusLine = response.getStatusLine();
                    if(statusLine.getStatusCode() == HttpStatus.SC_OK){
                        FileOutputStream output = mContext.openFileOutput(path, Context.MODE_PRIVATE);
    
                        response.getEntity().writeTo(output);
    
                        output.flush();
                        output.close();
    
                    } else{
                        //Closes the connection.
                        response.getEntity().getContent().close();
                        throw new IOException(statusLine.getReasonPhrase());
                    }
    
    
                 System.out.println("Save new Blob");
                    return new WebResourceResponse("", "",mContext.openFileInput(path));
                } catch (FileNotFoundException e) {
                    e.printStackTrace();
                } catch (MalformedURLException e) {
                    // TODO Auto-generated catch block
                    e.printStackTrace();
                } catch (IOException e) {
                    // TODO Auto-generated catch block
                    e.printStackTrace();
                }
            }
            return null;
        }
    
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I know how to setup a route to a url like http://siteurl.com/mycustomaccount/dashboard , but
I want to write a MobileSubstrate ( http://www.iphonedevwiki.net/index.php/MobileSubstrate ) addon that takes every HTTP
I want to intercept a request using the RequestDispatcher, and then I want to
Is it possible to modify users' HTTP request to www.example.com/options instead of www.example.com/options_and_params My
Here is my question I want to intercept request before any spring controller call,
I want to measure the time of the HTTP GET request of a RestTemplate.getForObject
I have a WEB Application deployed in Tomcat. I would like to intercept all
I have a WPF application with a WebBrowser control. I'd like to intercept and
In my custom Drupal module, I want to intercept the URL to show custom
I'm working with htaccess in a php application. I want some behavior like this:

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.