提交 487c54f8 作者: cbd

1、网络加载dae文件

上级 f9e6587c
...@@ -409,7 +409,7 @@ public class SceneLoader implements LoadListener, EventListener { ...@@ -409,7 +409,7 @@ public class SceneLoader implements LoadListener, EventListener {
public final void toggleLighting() { public final void toggleLighting() {
if (this.drawLighting && this.rotatingLight) { if (this.drawLighting && this.rotatingLight) {
this.rotatingLight = false; this.rotatingLight = false;
makeToastText("Light stopped", Toast.LENGTH_SHORT); //+ makeToastText("Light stopped", Toast.LENGTH_SHORT);
} else if (this.drawLighting && !this.rotatingLight) { } else if (this.drawLighting && !this.rotatingLight) {
this.drawLighting = false; this.drawLighting = false;
makeToastText("Lights off", Toast.LENGTH_SHORT); makeToastText("Lights off", Toast.LENGTH_SHORT);
......
...@@ -198,10 +198,11 @@ public class ModelRenderer implements GLSurfaceView.Renderer { ...@@ -198,10 +198,11 @@ public class ModelRenderer implements GLSurfaceView.Renderer {
} }
public ModelRenderer(Activity parent, ModelSurfaceView modelSurfaceView){ public ModelRenderer(Activity parent, ModelSurfaceView modelSurfaceView, float[] backgroundColor){
this.main = modelSurfaceView; this.main = modelSurfaceView;
try { try {
this.drawer = new RendererFactory(parent); this.drawer = new RendererFactory(parent);
this.backgroundColor = backgroundColor;
} catch (IllegalAccessException e) { } catch (IllegalAccessException e) {
e.printStackTrace(); e.printStackTrace();
} catch (IOException e) { } catch (IOException e) {
......
...@@ -58,7 +58,7 @@ public class ModelSurfaceView extends GLSurfaceView implements EventListener { ...@@ -58,7 +58,7 @@ public class ModelSurfaceView extends GLSurfaceView implements EventListener {
super(context, attrs); super(context, attrs);
Log.i("ModelSurfaceView","Loading [OpenGL 2] ModelSurfaceView..........."); Log.i("ModelSurfaceView","Loading [OpenGL 2] ModelSurfaceView...........");
setEGLContextClientVersion(2); setEGLContextClientVersion(2);
mRenderer = new ModelRenderer((Activity) context, this); mRenderer = new ModelRenderer((Activity) context, this,backgroundColor);
mRenderer.addListener(this); mRenderer.addListener(this);
setRenderer(mRenderer); setRenderer(mRenderer);
} }
......
...@@ -77,4 +77,7 @@ dependencies { ...@@ -77,4 +77,7 @@ dependencies {
api 'com.github.SherlockGougou:BigImageViewPager:androidx-7.1.4' api 'com.github.SherlockGougou:BigImageViewPager:androidx-7.1.4'
api 'com.github.CymChad:BaseRecyclerViewAdapterHelper:3.0.10' api 'com.github.CymChad:BaseRecyclerViewAdapterHelper:3.0.10'
//文件downloader
api 'com.liulishuo.filedownloader:library:1.7.5'
} }
\ No newline at end of file
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
package="com.orange.widget"> package="com.orange.widget">
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.INTERNET"/> <uses-permission android:name="android.permission.INTERNET"/>
<application <application
...@@ -14,6 +14,7 @@ ...@@ -14,6 +14,7 @@
android:supportsRtl="true" android:supportsRtl="true"
android:theme="@style/Theme.Look" android:theme="@style/Theme.Look"
android:usesCleartextTraffic="true" android:usesCleartextTraffic="true"
android:requestLegacyExternalStorage="true"
android:name="com.orange.widget.app.App"> android:name="com.orange.widget.app.App">
<!-- <activity--> <!-- <activity-->
<!-- android:name="com.orange.widget.MainActivity"--> <!-- android:name="com.orange.widget.MainActivity"-->
......
package com.orange.widget.app package com.orange.widget.app
import android.app.Application import android.app.Application
import android.util.Log
import com.alibaba.android.arouter.launcher.ARouter import com.alibaba.android.arouter.launcher.ARouter
import com.liulishuo.filedownloader.FileDownloader
import com.liulishuo.filedownloader.connection.FileDownloadConnection
import com.liulishuo.filedownloader.connection.FileDownloadUrlConnection
import com.orange.net.net.NetHelper import com.orange.net.net.NetHelper
import com.orange.tool.app.AppUrl import com.orange.tool.app.AppUrl
import com.orange.tool.app.IApp import com.orange.tool.app.IApp
import com.orange.widget.util.NoEtagFileDownloadUrlConnection
import xyz.doikki.videoplayer.util.PlayerUtils.getApplication
import java.io.IOException
class App : IApp(){ class App : IApp(){
...@@ -28,6 +34,19 @@ class App : IApp(){ ...@@ -28,6 +34,19 @@ class App : IApp(){
ARouter.openLog() ARouter.openLog()
ARouter.openDebug() ARouter.openDebug()
ARouter.init(app) ARouter.init(app)
// FileDownloader.setupOnApplicationOnCreate(getApplication())
FileDownloader.setupOnApplicationOnCreate(getApplication())
.connectionCreator(object : FileDownloadUrlConnection.Creator(
FileDownloadUrlConnection.Configuration()
.connectTimeout(15000) // set connection timeout.
.readTimeout(15000) // set read timeout.
) {
@Throws(IOException::class)
override fun create(originUrl: String): FileDownloadConnection {
return NoEtagFileDownloadUrlConnection(originUrl)
}
})
.commit()
} }
override fun init(app: Application, applicationFlag: Boolean) { override fun init(app: Application, applicationFlag: Boolean) {
......
...@@ -11,6 +11,7 @@ import android.hardware.SensorManager; ...@@ -11,6 +11,7 @@ import android.hardware.SensorManager;
import android.net.Uri; import android.net.Uri;
import android.os.Build; import android.os.Build;
import android.os.Bundle; import android.os.Bundle;
import android.os.Environment;
import android.os.Handler; import android.os.Handler;
import android.util.Log; import android.util.Log;
import android.view.MotionEvent; import android.view.MotionEvent;
...@@ -25,6 +26,9 @@ import com.bumptech.glide.load.DataSource; ...@@ -25,6 +26,9 @@ import com.bumptech.glide.load.DataSource;
import com.bumptech.glide.load.engine.GlideException; import com.bumptech.glide.load.engine.GlideException;
import com.bumptech.glide.request.RequestListener; import com.bumptech.glide.request.RequestListener;
import com.bumptech.glide.request.target.Target; import com.bumptech.glide.request.target.Target;
import com.liulishuo.filedownloader.BaseDownloadTask;
import com.liulishuo.filedownloader.FileDownloadListener;
import com.liulishuo.filedownloader.FileDownloader;
import com.orange.widget.R; import com.orange.widget.R;
import com.orange.widget.util.ModelViewerGUI; import com.orange.widget.util.ModelViewerGUI;
import org.the3deer.android_3d_model_engine.camera.CameraController; import org.the3deer.android_3d_model_engine.camera.CameraController;
...@@ -118,12 +122,22 @@ public class ModelActivity extends AppCompatActivity implements EventListener { ...@@ -118,12 +122,22 @@ public class ModelActivity extends AppCompatActivity implements EventListener {
} }
} }
setContentView(R.layout.activity_model);
glView= findViewById(R.id.surfaceView);
handler = new Handler(getMainLooper()); handler = new Handler(getMainLooper());
// Create our 3D scenario // Create our 3D scenario
datas.add("https://appmanage.youcai168.cn/villain/villain_obj.obj"); /* datas.add("https://appmanage.youcai168.cn/villain/villain_obj.obj");
datas.add("https://appmanage.youcai168.cn/villain/villain_mtl"); datas.add("https://appmanage.youcai168.cn/villain/villain_mtl");
datas.add("https://appmanage.youcai168.cn/villain/villain_d.png"); datas.add("https://appmanage.youcai168.cn/villain/villain_d.png");
datas.add("https://appmanage.youcai168.cn/villain/villain_n.png"); datas.add("https://appmanage.youcai168.cn/villain/villain_n.png");*/
datas.add("https://appmanage.youcai168.cn/androidtest/sj.dae");
datas.add("https://appmanage.youcai168.cn/androidtest/sj01.jpg");
datas.add("https://appmanage.youcai168.cn/androidtest/sj02.jpg");
// datas.add("https://appmanage.youcai168.cn/androidtest/33.dae");
//datas.add("https://appmanage.youcai168.cn/androidtest/cgaxis_models_77_19_01.jpg");
// datas.add("https://appmanage.youcai168.cn/androidtest/cgaxis_models_77_19_02.jpg");
// datas.add("https://appmanage.youcai168.cn/androidtest/cgaxis_models_77_19_02_bump.jpg");
load3dModel(); load3dModel();
} }
...@@ -219,10 +233,14 @@ public class ModelActivity extends AppCompatActivity implements EventListener { ...@@ -219,10 +233,14 @@ public class ModelActivity extends AppCompatActivity implements EventListener {
@Override @Override
public boolean onEvent(EventObject event) { public boolean onEvent(EventObject event) {
if (event instanceof FPSEvent){ if (event instanceof FPSEvent){
gui.onEvent(event); if (gui != null) {
gui.onEvent(event);
}
} }
else if (event instanceof SelectedObjectEvent){ else if (event instanceof SelectedObjectEvent){
gui.onEvent(event); if (gui != null) {
gui.onEvent(event);
}
} }
else if (event.getSource() instanceof MotionEvent){ else if (event.getSource() instanceof MotionEvent){
// event coming from glview // event coming from glview
...@@ -281,6 +299,7 @@ public class ModelActivity extends AppCompatActivity implements EventListener { ...@@ -281,6 +299,7 @@ public class ModelActivity extends AppCompatActivity implements EventListener {
for (String url : datas) { for (String url : datas) {
String fileName = url.substring(url.lastIndexOf('/') + 1); String fileName = url.substring(url.lastIndexOf('/') + 1);
File destFile = new File(this.getExternalFilesDir("3dModel").toString(), fileName); File destFile = new File(this.getExternalFilesDir("3dModel").toString(), fileName);
// File destFile = new File(Environment.getExternalStorageDirectory()+File.separator+"3dModel",fileName);
if(url.contains("obj")){ if(url.contains("obj")){
objName = url.substring(url.lastIndexOf('/') + 1); objName = url.substring(url.lastIndexOf('/') + 1);
}else if(url.contains("mtl")){ }else if(url.contains("mtl")){
...@@ -292,14 +311,23 @@ public class ModelActivity extends AppCompatActivity implements EventListener { ...@@ -292,14 +311,23 @@ public class ModelActivity extends AppCompatActivity implements EventListener {
downloadCount +=1; downloadCount +=1;
} }
} }
Log.e("downloaded file= ", "objName= "+objName+" mtlName= " + mtlName +" downloadCount= "+downloadCount); Log.i("ModelActivity file= ", "objName= "+objName+" mtlName= " + mtlName +" downloadCount= "+downloadCount);
if(downloadCount == datas.size()){ if(downloadCount == datas.size()){
//已经存在了,直接加载 //已经存在了,直接加载
// parseMtlmappic(0x0000ff,objName,mtlName); // parseMtlmappic(0x0000ff,objName,mtlName);
File objFile = new File(this.getExternalFilesDir("3dModel").toString(),objName); File destFile = new File(this.getExternalFilesDir("3dModel").toString(),objName);
if(objFile.isFile() && objFile.exists()){ // File destFile = new File(Environment.getExternalStorageDirectory()+File.separator+"3dModel",objName);
Uri uri = Uri.parse("file://" + objFile.getAbsolutePath()); if(destFile.isFile() && destFile.exists()){
initScene(uri); // 0 = obj, 1 = stl, 2 = dae,3 = gtlf
int type = 0;
if(destFile.getAbsolutePath().contains(".obj")){
type = 0;
}else if(destFile.getAbsolutePath().contains(".dae")){
type = 2;
}
ContentUtils.setCurrentDir(destFile.getParentFile());
Uri uri = Uri.parse("file://" + destFile.getAbsolutePath());
initScene(uri,type);
} }
}else{ }else{
//下载并保存 //下载并保存
...@@ -307,7 +335,7 @@ public class ModelActivity extends AppCompatActivity implements EventListener { ...@@ -307,7 +335,7 @@ public class ModelActivity extends AppCompatActivity implements EventListener {
} }
} }
private void initScene(Uri uri) { private void initScene(Uri uri,int type) {
Log.i("ModelActivity", "Loading Scene..."); Log.i("ModelActivity", "Loading Scene...");
try { try {
this.paramUri = URI.create(uri.toString()); this.paramUri = URI.create(uri.toString());
...@@ -320,30 +348,29 @@ public class ModelActivity extends AppCompatActivity implements EventListener { ...@@ -320,30 +348,29 @@ public class ModelActivity extends AppCompatActivity implements EventListener {
return; return;
} }
} }
paramType =type;
scene = new SceneLoader(this, this.paramUri, paramType); scene = new SceneLoader(this, this.paramUri, paramType);
scene.addListener(this); scene.addListener(this);
//默认正常光
scene.toggleLighting();
if (paramUri == null) { if (paramUri == null) {
// final LoaderTask task = new DemoLoaderTask(this, null, scene); // final LoaderTask task = new DemoLoaderTask(this, null, scene);
// task.execute(); // task.execute();
} }
try { try {
Log.i("ModelActivity", "Loading GLSurfaceView..."); Log.i("ModelActivity", "Loading GLSurfaceView...");
setContentView(R.layout.activity_model); // setContentView(R.layout.activity_model);
glView= findViewById(R.id.surfaceView); // glView= findViewById(R.id.surfaceView);
glView.setBackgroundColor(backgroundColor); glView.setBackgroundColor(backgroundColor);
glView.setScene(scene); glView.setScene(scene);
glView.addListener(this); glView.addListener(this);
glView.setCanTouch(canTouch); glView.setCanTouch(canTouch);
// mRenderer = new ModelRenderer(this, glView, backgroundColor, this.scene);
// mRenderer.addListener(this); // glView = new ModelSurfaceView(this, backgroundColor, this.scene);
// glView.setRenderer(mRenderer); // glView.addListener(this);
// setContentView(glView);
// glView = new ModelSurfaceView(this, backgroundColor, this.scene);
// glView.addListener(this);
// setContentView(glView);
// scene.setView(glView);
} catch (Exception e) { } catch (Exception e) {
Log.e("ModelActivity", e.getMessage(), e); Log.i("ModelActivity", e.getMessage(), e);
Toast.makeText(this, "Error loading OpenGL view:\n" + e.getMessage(), Toast.LENGTH_LONG).show(); Toast.makeText(this, "Error loading OpenGL view:\n" + e.getMessage(), Toast.LENGTH_LONG).show();
} }
try { try {
...@@ -355,7 +382,7 @@ public class ModelActivity extends AppCompatActivity implements EventListener { ...@@ -355,7 +382,7 @@ public class ModelActivity extends AppCompatActivity implements EventListener {
} }
//touchController.addListener(glView); //touchController.addListener(glView);
} catch (Exception e) { } catch (Exception e) {
Log.e("ModelActivity", e.getMessage(), e); Log.i("ModelActivity", e.getMessage(), e);
Toast.makeText(this, "Error loading TouchController:\n" + e.getMessage(), Toast.LENGTH_LONG).show(); Toast.makeText(this, "Error loading TouchController:\n" + e.getMessage(), Toast.LENGTH_LONG).show();
} }
try { try {
...@@ -365,7 +392,7 @@ public class ModelActivity extends AppCompatActivity implements EventListener { ...@@ -365,7 +392,7 @@ public class ModelActivity extends AppCompatActivity implements EventListener {
//touchController.addListener(collisionController); //touchController.addListener(collisionController);
//touchController.addListener(scene); //touchController.addListener(scene);
} catch (Exception e) { } catch (Exception e) {
Log.e("ModelActivity", e.getMessage(), e); Log.i("ModelActivity", e.getMessage(), e);
Toast.makeText(this, "Error loading CollisionController\n" + e.getMessage(), Toast.LENGTH_LONG).show(); Toast.makeText(this, "Error loading CollisionController\n" + e.getMessage(), Toast.LENGTH_LONG).show();
} }
...@@ -375,30 +402,31 @@ public class ModelActivity extends AppCompatActivity implements EventListener { ...@@ -375,30 +402,31 @@ public class ModelActivity extends AppCompatActivity implements EventListener {
//glView.getModelRenderer().addListener(cameraController); //glView.getModelRenderer().addListener(cameraController);
//touchController.addListener(cameraController); //touchController.addListener(cameraController);
} catch (Exception e) { } catch (Exception e) {
Log.e("ModelActivity", e.getMessage(), e); Log.i("ModelActivity", e.getMessage(), e);
Toast.makeText(this, "Error loading CameraController" + e.getMessage(), Toast.LENGTH_LONG).show(); Toast.makeText(this, "Error loading CameraController" + e.getMessage(), Toast.LENGTH_LONG).show();
} }
try { try {
// TODO: finish UI implementation // TODO: finish UI implementation
Log.i("ModelActivity", "Loading GUI..."); Log.i("ModelActivity", "Loading GUI...");
gui = new ModelViewerGUI(glView, scene); // gui = new ModelViewerGUI(glView, scene);
touchController.addListener(gui); // touchController.addListener(gui);
glView.addListener(gui); // glView.addListener(gui);
//去调sufaceview表面添加的东西 //去调sufaceview表面添加的东西
// scene.addGUIObject(gui); // scene.addGUIObject(gui);
} catch (Exception e) { } catch (Exception e) {
Log.e("ModelActivity", e.getMessage(), e); Log.i("ModelActivity", e.getMessage(), e);
Toast.makeText(this, "Error loading GUI" + e.getMessage(), Toast.LENGTH_LONG).show(); Toast.makeText(this, "Error loading GUI" + e.getMessage(), Toast.LENGTH_LONG).show();
} }
scene.init(); scene.init();
Log.i("ModelActivity", "Finished loading"); Log.i("ModelActivity", "Finished loading");
} }
private void save3dModelResourceToLocal(List<String> datas) { /*private void save3dModelResourceToLocal(List<String> datas) {
//// 发起多个请求 //// 发起多个请求
for (String url : datas) { for (String url : datas) {
String fileName = url.substring(url.lastIndexOf('/') + 1); String fileName = url.substring(url.lastIndexOf('/') + 1);
File destFile = new File(this.getExternalFilesDir("3dModel").toString(), fileName); // File destFile = new File(this.getExternalFilesDir("3dModel").toString(), fileName);
File destFile = new File(Environment.getExternalStorageDirectory()+File.separator+"3dModel",fileName);
if(destFile.exists()){ if(destFile.exists()){
continue; continue;
} }
...@@ -417,7 +445,8 @@ public class ModelActivity extends AppCompatActivity implements EventListener { ...@@ -417,7 +445,8 @@ public class ModelActivity extends AppCompatActivity implements EventListener {
public boolean onResourceReady(File resource, Object model, Target<File> target, DataSource dataSource, boolean isFirstResource) { public boolean onResourceReady(File resource, Object model, Target<File> target, DataSource dataSource, boolean isFirstResource) {
// Toast.makeText(context, "下载成功", Toast.LENGTH_SHORT).show(); // Toast.makeText(context, "下载成功", Toast.LENGTH_SHORT).show();
String fileName = url.substring(url.lastIndexOf('/') + 1); String fileName = url.substring(url.lastIndexOf('/') + 1);
File destFile = new File(ModelActivity.this.getExternalFilesDir("3dModel").toString(), fileName); // File destFile = new File(ModelActivity.this.getExternalFilesDir("3dModel").toString(), fileName);
File destFile = new File(Environment.getExternalStorageDirectory()+File.separator+"3dModel",fileName);
FileUtils.copy(resource, destFile); FileUtils.copy(resource, destFile);
// 这里可以执行某些逻辑,如记录日志等 // 这里可以执行某些逻辑,如记录日志等
counter++; counter++;
...@@ -429,14 +458,22 @@ public class ModelActivity extends AppCompatActivity implements EventListener { ...@@ -429,14 +458,22 @@ public class ModelActivity extends AppCompatActivity implements EventListener {
}else if(url.contains(".dae")){ }else if(url.contains(".dae")){
objName = url.substring(url.lastIndexOf('/') + 1); objName = url.substring(url.lastIndexOf('/') + 1);
} }
Log.e("file= ", "objName= "+objName+" mtlName= " + mtlName +" counter= "+counter); Log.i("file= ", "objName= "+objName+" mtlName= " + mtlName +" counter= "+counter);
if (counter == datas.size()) { // 所有请求都完成了 if (counter == datas.size()) { // 所有请求都完成了
// 在这里执行处理逻辑 // 在这里执行处理逻辑
// parseMtlmappic(0x0000ff,objName,mtlName); // parseMtlmappic(0x0000ff,objName,mtlName);
File objFile = new File(ModelActivity.this.getExternalFilesDir("3dModel").toString(),objName); // File objFile =
File objFile = new File(Environment.getExternalStorageDirectory(),objName);
if(objFile.isFile() && objFile.exists()){ if(objFile.isFile() && objFile.exists()){
// 0 = obj, 1 = stl, 2 = dae,3 = gtlf
int type = 0;
if(objFile.getAbsolutePath().contains(".obj")){
type = 0;
}else if(objFile.getAbsolutePath().contains(".dae")){
type = 2;
}
Uri uri = Uri.parse("file://" + objFile.getAbsolutePath()); Uri uri = Uri.parse("file://" + objFile.getAbsolutePath());
initScene(uri); initScene(uri,type);
} }
} }
return false; return false;
...@@ -444,5 +481,85 @@ public class ModelActivity extends AppCompatActivity implements EventListener { ...@@ -444,5 +481,85 @@ public class ModelActivity extends AppCompatActivity implements EventListener {
}) })
.preload(); .preload();
} }
}*/
private void save3dModelResourceToLocal(List<String> datas) {
//// 发起多个请求
for (String url : datas) {
String fileName = url.substring(url.lastIndexOf('/') + 1);
File destFile = new File(this.getExternalFilesDir("3dModel").toString(), fileName);
//File destFile = new File(Environment.getExternalStorageDirectory()+File.separator+"3dModel",fileName);
if(destFile.exists()){
continue;
}
FileDownloader.getImpl().create(url)
.setPath(destFile.getAbsolutePath())
.setForceReDownload(true)
.setListener(new FileDownloadListener() {
@Override
protected void pending(BaseDownloadTask task, int soFarBytes, int totalBytes) {
}
@Override
protected void progress(BaseDownloadTask task, int soFarytes, int totalytes) {
Log.e("progress"," progress= "+(int) ((long) soFarytes * 100/ (long) totalytes));
}
@Override
protected void started(BaseDownloadTask task) {
super.started(task);
Log.e("started"," started ");
}
@Override
protected void paused(BaseDownloadTask task, int soFarBytes, int totalBytes) {
}
@Override
protected void completed(BaseDownloadTask task) {
// 这里可以执行某些逻辑,如记录日志等
counter++;
Log.e("completed file= ", "url= "+url+" fileName= " + fileName );
if(url.contains(".obj")){
objName = url.substring(url.lastIndexOf('/') + 1);
}else if(url.contains(".mtl")){
mtlName = url.substring(url.lastIndexOf('/') + 1);
}else if(url.contains(".dae")){
objName = url.substring(url.lastIndexOf('/') + 1);
}
Log.i("file= ", "objName= "+objName+" mtlName= " + mtlName +" counter= "+counter);
if (counter == datas.size()) { // 所有请求都完成了
// 在这里执行处理逻辑
// parseMtlmappic(0x0000ff,objName,mtlName);
File objFile = new File(ModelActivity.this.getExternalFilesDir("3dModel").toString(), objName);
// File objFile = new File(Environment.getExternalStorageDirectory()+File.separator+"3dModel",objName);
if(objFile.isFile() && objFile.exists()){
// 0 = obj, 1 = stl, 2 = dae,3 = gtlf
int type = 0;
if(objFile.getAbsolutePath().contains(".obj")){
type = 0;
}else if(objFile.getAbsolutePath().contains(".dae")){
type = 2;
}
ContentUtils.setCurrentDir(objFile.getParentFile());
Uri uri = Uri.parse("file://" + objFile.getAbsolutePath());
initScene(uri,type);
}
}
}
@Override
protected void error(BaseDownloadTask task, Throwable e) {
Log.e("error download file ",e.toString());
}
@Override
protected void warn(BaseDownloadTask task) {
}
}).start();
}
} }
} }
\ No newline at end of file
package com.orange.widget.util;
import com.liulishuo.filedownloader.connection.FileDownloadUrlConnection;
import java.io.IOException;
import java.net.URL;
public class NoEtagFileDownloadUrlConnection extends FileDownloadUrlConnection {
public NoEtagFileDownloadUrlConnection(String originUrl, Configuration configuration) throws IOException {
super(originUrl, configuration);
}
public NoEtagFileDownloadUrlConnection(URL url, Configuration configuration) throws IOException {
super(url, configuration);
}
public NoEtagFileDownloadUrlConnection(String originUrl) throws IOException {
super(originUrl);
}
@Override
public void addHeader(String name, String value) {
if ("If-Match".equals(name)) {
return;
}
super.addHeader(name, value);
}
}
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论