滑行无法从重定向链接加载图像

时间:2018-08-06 14:25:02

标签: java android image android-glide

我使用Glide加载效果很好的图像,直到使用重定向到另一个URL的URL。请问我该如何解决?谢谢。

原始链接:https://images.copart.com/website/data/pix/20061226/41288898_1X

重定向的链接:http://cs.copart.com/v1/AUTH_svc.pdoc00001/PIX133/a74f8b3d-9c6b-4af9-8975-393e648dab8c.JPG

下载图像的代码:

Glide.with(context).load(img_end_point + car.get(position).getImageName()).
                override(Target.SIZE_ORIGINAL, 200).fitCenter()
                .listener(new RequestListener<String, GlideDrawable>() {
                    @Override
                    public boolean onException(Exception e, String model, Target<GlideDrawable> target, boolean isFirstResource) {
                        loader.setVisibility(View.GONE);
                        e.printStackTrace();
                        return false;
                    }

                    @Override
                    public boolean onResourceReady(GlideDrawable resource, String model, Target<GlideDrawable> target, boolean isFromMemoryCache, boolean isFirstResource) {
                        loader.setVisibility(View.GONE);
                        return false;
                    }
                })
                .into(imageView);

错误:

BasicNetwork.performRequest: Unexpected response code 301 for https://images.copart.com/website/data/pix/20061226/39879168_1X
 java.util.concurrent.ExecutionException: com.android.volley.ServerError
    com.bumptech.glide.integration.volley.VolleyRequestFuture.doGet(VolleyRequestFuture.java:125)
    com.bumptech.glide.integration.volley.VolleyRequestFuture.get(VolleyRequestFuture.java:92)
    com.bumptech.glide.integration.volley.VolleyStreamFetcher.loadData(VolleyStreamFetcher.java:68)
    com.bumptech.glide.integration.volley.VolleyStreamFetcher.loadData(VolleyStreamFetcher.java:21)
    com.bumptech.glide.load.model.ImageVideoModelLoader$ImageVideoFetcher.loadData(ImageVideoModelLoader.java:70)
    com.bumptech.glide.load.model.ImageVideoModelLoader$ImageVideoFetcher.loadData(ImageVideoModelLoader.java:53)
com.bumptech.glide.load.engine.DecodeJob.decodeSource(DecodeJob.java:170)
com.bumptech.glide.load.engine.DecodeJob.decodeFromSource(DecodeJob.java:128)
com.bumptech.glide.load.engine.EngineRunnable.decode(EngineRunnable.java:106)
com.bumptech.glide.load.engine.EngineRunnable.run(EngineRunnable.java:58)
java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:428)
java.util.concurrent.FutureTask.run(FutureTask.java:237)
    java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1133)
    java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:607)
java.lang.Thread.run(Thread.java:761)
    com.bumptech.glide.load.engine.executor.FifoPriorityThreadPoolExecutor$DefaultThr eadFactory$1.run(FifoPriorityThreadPoolExecutor.java:118)
com.android.volley.ServerError
com.android.volley.toolbox.BasicNetwork.performRequest(BasicNetwork.java:163)
com.android.volley.NetworkDispatcher.run(NetworkDispatcher.java:112)

0 个答案:

没有答案