From fbc3c068fa25e22d0729c3366cffe7d149e64bb7 Mon Sep 17 00:00:00 2001 From: Zhenjie Yan Date: Sat, 28 Jan 2023 16:30:55 +0800 Subject: [PATCH 1/8] Remove jcenter(). --- build.gradle | 1 - 1 file changed, 1 deletion(-) diff --git a/build.gradle b/build.gradle index ad9135f..054fafa 100644 --- a/build.gradle +++ b/build.gradle @@ -17,7 +17,6 @@ allprojects { repositories { mavenLocal() google() - jcenter() mavenCentral() } } From 687587c954f691f5c0341ad1ed7f5ed480a34851 Mon Sep 17 00:00:00 2001 From: Zhenjie Yan Date: Sat, 28 Jan 2023 16:31:19 +0800 Subject: [PATCH 2/8] Support #473. --- .../andserver/framework/body/FileBody.java | 5 +++++ .../andserver/framework/body/StreamBody.java | 13 ++++++++++++- .../andserver/framework/body/StringBody.java | 5 +++++ .../com/yanzhenjie/andserver/http/ResponseBody.java | 10 ++++++++++ .../yanzhenjie/andserver/http/StandardResponse.java | 4 ++-- 5 files changed, 34 insertions(+), 3 deletions(-) diff --git a/api/src/main/java/com/yanzhenjie/andserver/framework/body/FileBody.java b/api/src/main/java/com/yanzhenjie/andserver/framework/body/FileBody.java index 8ab6158..82b0bbc 100644 --- a/api/src/main/java/com/yanzhenjie/andserver/framework/body/FileBody.java +++ b/api/src/main/java/com/yanzhenjie/andserver/framework/body/FileBody.java @@ -47,6 +47,11 @@ public boolean isRepeatable() { return true; } + @Override + public boolean isChunked() { + return false; + } + @Override public long contentLength() { return mBody.length(); diff --git a/api/src/main/java/com/yanzhenjie/andserver/framework/body/StreamBody.java b/api/src/main/java/com/yanzhenjie/andserver/framework/body/StreamBody.java index 5bf4fc6..5edea6f 100644 --- a/api/src/main/java/com/yanzhenjie/andserver/framework/body/StreamBody.java +++ b/api/src/main/java/com/yanzhenjie/andserver/framework/body/StreamBody.java @@ -33,6 +33,7 @@ public class StreamBody implements ResponseBody { private InputStream mStream; + private boolean mChunked; private long mLength; private MediaType mMediaType; @@ -45,11 +46,16 @@ public StreamBody(InputStream stream, long length) { } public StreamBody(InputStream stream, MediaType mediaType) { - this(stream, 0, mediaType); + this(stream, true, 0, mediaType); } public StreamBody(InputStream stream, long length, MediaType mediaType) { + this(stream, false, length, mediaType); + } + + public StreamBody(InputStream stream, boolean chunked, long length, MediaType mediaType) { this.mStream = stream; + this.mChunked = chunked; this.mLength = length; this.mMediaType = mediaType; } @@ -59,6 +65,11 @@ public boolean isRepeatable() { return false; } + @Override + public boolean isChunked() { + return mChunked; + } + @Override public long contentLength() { if (mLength == 0 && mStream instanceof FileInputStream) { diff --git a/api/src/main/java/com/yanzhenjie/andserver/framework/body/StringBody.java b/api/src/main/java/com/yanzhenjie/andserver/framework/body/StringBody.java index 2654b87..58b8e91 100644 --- a/api/src/main/java/com/yanzhenjie/andserver/framework/body/StringBody.java +++ b/api/src/main/java/com/yanzhenjie/andserver/framework/body/StringBody.java @@ -62,6 +62,11 @@ public boolean isRepeatable() { return true; } + @Override + public boolean isChunked() { + return false; + } + @Override public long contentLength() { return mBody.length; diff --git a/api/src/main/java/com/yanzhenjie/andserver/http/ResponseBody.java b/api/src/main/java/com/yanzhenjie/andserver/http/ResponseBody.java index f28b21c..e4577b8 100644 --- a/api/src/main/java/com/yanzhenjie/andserver/http/ResponseBody.java +++ b/api/src/main/java/com/yanzhenjie/andserver/http/ResponseBody.java @@ -35,6 +35,16 @@ public interface ResponseBody { */ boolean isRepeatable(); + /** + * Tells about chunked encoding for this entity. + *

+ * The behavior of wrapping entities is implementation dependent, but should respect the primary purpose. + *

+ * + * @return {@code true} if chunked encoding is preferred for this entity, or {@code false} if it is not + */ + boolean isChunked(); + /** * Get the content-length of the message body, if the length is unknown, return a negative value. * diff --git a/api/src/main/java/com/yanzhenjie/andserver/http/StandardResponse.java b/api/src/main/java/com/yanzhenjie/andserver/http/StandardResponse.java index 4b85945..b8ccdd8 100644 --- a/api/src/main/java/com/yanzhenjie/andserver/http/StandardResponse.java +++ b/api/src/main/java/com/yanzhenjie/andserver/http/StandardResponse.java @@ -156,12 +156,12 @@ private BodyToEntity(ResponseBody body) { @Override public boolean isRepeatable() { - return false; + return mBody.isRepeatable(); } @Override public boolean isChunked() { - return false; + return mBody.isChunked(); } @Override From 7a7f11fa2df9c6f503a33f3c7becaf107488721b Mon Sep 17 00:00:00 2001 From: Zhenjie Yan Date: Sun, 29 Jan 2023 16:13:02 +0800 Subject: [PATCH 3/8] #387, #425, #446, #447, #448. --- .../andserver/server/BasicServer.java | 8 ++++---- .../andserver/server/ProxyServer.java | 19 ++++++++++--------- 2 files changed, 14 insertions(+), 13 deletions(-) diff --git a/api/src/main/java/com/yanzhenjie/andserver/server/BasicServer.java b/api/src/main/java/com/yanzhenjie/andserver/server/BasicServer.java index 0b90406..4b6f729 100644 --- a/api/src/main/java/com/yanzhenjie/andserver/server/BasicServer.java +++ b/api/src/main/java/com/yanzhenjie/andserver/server/BasicServer.java @@ -42,7 +42,7 @@ */ public abstract class BasicServer implements Server { - static final int BUFFER = 8 * 1024; +// static final int BUFFER = 8 * 1024; protected final InetAddress mInetAddress; protected final int mPort; @@ -88,9 +88,9 @@ public void run() { .setSoReuseAddress(true) .setTcpNoDelay(true) .setSoTimeout(mTimeout) - .setBacklogSize(BUFFER) - .setRcvBufSize(BUFFER) - .setSndBufSize(BUFFER) +// .setBacklogSize(BUFFER) +// .setRcvBufSize(BUFFER) +// .setSndBufSize(BUFFER) .setSoLinger(0) .build() ) diff --git a/api/src/main/java/com/yanzhenjie/andserver/server/ProxyServer.java b/api/src/main/java/com/yanzhenjie/andserver/server/ProxyServer.java index a6ac902..c5bbf32 100644 --- a/api/src/main/java/com/yanzhenjie/andserver/server/ProxyServer.java +++ b/api/src/main/java/com/yanzhenjie/andserver/server/ProxyServer.java @@ -232,7 +232,7 @@ protected void afterExecute(Runnable r, Throwable t) { private ServerSocket mServerSocket; public HttpServer(InetAddress inetAddress, int port, int timeout, ServerSocketFactory socketFactory, - SSLSocketInitializer sslSocketInitializer, HttpRequestHandler handler) { + SSLSocketInitializer sslSocketInitializer, HttpRequestHandler handler) { this.mInetAddress = inetAddress; this.mPort = port; this.mTimeout = timeout; @@ -255,8 +255,9 @@ public HttpServer(InetAddress inetAddress, int port, int timeout, ServerSocketFa public void startServer() throws IOException { mServerSocket = mSocketFactory.createServerSocket(); mServerSocket.setReuseAddress(true); - mServerSocket.bind(new InetSocketAddress(mInetAddress, mPort), BUFFER); - mServerSocket.setReceiveBufferSize(BUFFER); +// mServerSocket.bind(new InetSocketAddress(mInetAddress, mPort), BUFFER); +// mServerSocket.setReceiveBufferSize(BUFFER); + mServerSocket.bind(new InetSocketAddress(mInetAddress, mPort)); if (mSSLSocketInitializer != null && mServerSocket instanceof SSLServerSocket) { mSSLSocketInitializer.onCreated((SSLServerSocket) mServerSocket); } @@ -280,7 +281,7 @@ public void stopServer() { } Set workers = mWorkerSet.keySet(); - for (Worker worker : workers) { + for (Worker worker: workers) { HttpServerConnection conn = worker.getServerConn(); try { conn.shutdown(); @@ -297,14 +298,14 @@ public void run() { socket.setSoTimeout(mTimeout); socket.setKeepAlive(true); socket.setTcpNoDelay(true); - socket.setReceiveBufferSize(BUFFER); - socket.setSendBufferSize(BUFFER); +// socket.setReceiveBufferSize(BUFFER); +// socket.setSendBufferSize(BUFFER); socket.setSoLinger(true, 0); - DefaultBHttpServerConnection serverConn = new DefaultBHttpServerConnection(BUFFER); + DefaultBHttpServerConnection serverConn = new DefaultBHttpServerConnection(8192); serverConn.bind(socket); - DefaultBHttpClientConnection clientConn = new DefaultBHttpClientConnection(BUFFER); + DefaultBHttpClientConnection clientConn = new DefaultBHttpClientConnection(8192); Worker worker = new Worker(mHttpService, serverConn, clientConn); mWorkerExecutor.execute(worker); @@ -321,7 +322,7 @@ private static class Worker implements Runnable { private final DefaultBHttpClientConnection mClientConn; public Worker(HttpService httpservice, - DefaultBHttpServerConnection serverConn, DefaultBHttpClientConnection clientConn) { + DefaultBHttpServerConnection serverConn, DefaultBHttpClientConnection clientConn) { this.mHttpService = httpservice; this.mServerConn = serverConn; this.mClientConn = clientConn; From b7fe9d733883ccf8525200ddaefb5df7ae93556a Mon Sep 17 00:00:00 2001 From: Zhenjie Yan Date: Sun, 29 Jan 2023 20:36:50 +0800 Subject: [PATCH 4/8] Update publish script. --- annotation/build.gradle | 2 +- api/build.gradle | 3 +- config.gradle | 10 +-- plugin/build.gradle | 2 +- processor/build.gradle | 2 +- publish.gradle | 135 ---------------------------------------- sample/build.gradle | 5 +- 7 files changed, 9 insertions(+), 150 deletions(-) delete mode 100644 publish.gradle diff --git a/annotation/build.gradle b/annotation/build.gradle index bb00c89..662c009 100644 --- a/annotation/build.gradle +++ b/annotation/build.gradle @@ -5,4 +5,4 @@ compileJava { targetCompatibility = JavaVersion.VERSION_1_8 } -apply from: '../publish.gradle' \ No newline at end of file +apply from: publishScript \ No newline at end of file diff --git a/api/build.gradle b/api/build.gradle index 995be47..3397381 100644 --- a/api/build.gradle +++ b/api/build.gradle @@ -2,7 +2,6 @@ apply plugin: plugin.androidLibrary android { compileSdkVersion androidBuild.compileSdkVersion - buildToolsVersion androidBuild.buildToolsVersion defaultConfig { minSdkVersion androidBuild.libraryMinSdkVersion @@ -33,4 +32,4 @@ dependencies { compileOnly deps.android.annotation } -apply from: '../publish.gradle' \ No newline at end of file +apply from: publishScript \ No newline at end of file diff --git a/config.gradle b/config.gradle index 49f705d..51799a5 100644 --- a/config.gradle +++ b/config.gradle @@ -1,26 +1,22 @@ ext { + publishScript = 'https://raw.githubusercontent.com/yanzhenjie/GradleToMaven/master/publish.gradle' + plugin = [ - java : 'java', javaLibrary : 'java-library', javaPlugin : 'java-gradle-plugin', android : 'com.android.application', androidLibrary: 'com.android.library', - androidMaven : 'com.github.dcendents.android-maven', andServer : 'com.yanzhenjie.andserver' ] androidBuild = [ applicationId : 'com.yanzhenjie.andserver.sample', compileSdkVersion : 29, - buildToolsVersion : '29.0.3', libraryMinSdkVersion : 9, libraryTargetSdkVersion: 29, sampleMinSdkVersion : 14, - sampleTargetSdkVersion : 22, - - versionCode : 25, - versionName : '2.1.2' + sampleTargetSdkVersion : 22 ] deps = [ diff --git a/plugin/build.gradle b/plugin/build.gradle index 8ef1fc7..59a2e33 100644 --- a/plugin/build.gradle +++ b/plugin/build.gradle @@ -14,4 +14,4 @@ dependencies { implementation deps.poet } -apply from: '../publish.gradle' \ No newline at end of file +apply from: publishScript \ No newline at end of file diff --git a/processor/build.gradle b/processor/build.gradle index d1c7001..543a44b 100644 --- a/processor/build.gradle +++ b/processor/build.gradle @@ -13,4 +13,4 @@ dependencies { implementation deps.apache.collections } -apply from: '../publish.gradle' \ No newline at end of file +apply from: publishScript \ No newline at end of file diff --git a/publish.gradle b/publish.gradle deleted file mode 100644 index 45afb9f..0000000 --- a/publish.gradle +++ /dev/null @@ -1,135 +0,0 @@ -apply plugin: 'maven-publish' -apply plugin: 'signing' - -configurations.all { - resolutionStrategy.cacheDynamicVersionsFor 0, 'seconds' - resolutionStrategy.cacheChangingModulesFor 0, 'seconds' -} - -group = POM_GROUP_ID -version = POM_VERSION - -def getSonatypeUserName() { - return hasProperty('SONATYPE_USERNAME') ? SONATYPE_USERNAME : '' -} - -def getSonatypePassword() { - return hasProperty('SONATYPE_PASSWORD') ? SONATYPE_PASSWORD : '' -} - -def plugins = project.getPlugins() -if (plugins.hasPlugin('com.android.library')) { - task javadoc(type: Javadoc) { - source = android.sourceSets.main.java.source - classpath += project.files(android.getBootClasspath().join(File.pathSeparator)) - failOnError false - } - - task javadocJar(type: Jar, dependsOn: javadoc) { - archiveClassifier = 'javadoc' - from javadoc.destinationDir - } - - task sourcesJar(type: Jar) { - archiveClassifier = 'sources' - from android.sourceSets.main.java.source - } -} else if (plugins.hasPlugin('java-library')) { - task javadocJar(type: Jar, dependsOn: javadoc) { - archiveClassifier = 'javadoc' - from javadoc.destinationDir - } - - task sourcesJar(type: Jar, dependsOn: classes) { - archiveClassifier = 'sources' - from sourceSets.main.allSource - } -} - -if (JavaVersion.current().isJava8Compatible()) { - allprojects { - tasks.withType(Javadoc) { - options.addStringOption('Xdoclint:none', '-quiet') - } - } -} - -afterEvaluate { - def cleanTask = project.tasks.findByName('clean') - def assembleTask = project.tasks.findByName('assemble') - def publishTask = project.tasks.findByName('publish') - if (cleanTask && assembleTask && publishTask) { - assembleTask.dependsOn(cleanTask) - publishTask.dependsOn(assembleTask) - - def publishLocalTask = project.tasks.findByName('publishToMavenLocal') - if (publishLocalTask) { - publishLocalTask.dependsOn(assembleTask) - } - } - - publishing { - publications { - uploadArchives(MavenPublication) { - artifacts = [javadocJar, sourcesJar] - - if (components.hasWithName('java')) { - from components.java - } else if (components.hasWithName('release')) { - from components.release - } - - groupId = POM_GROUP_ID - artifactId = POM_ARTIFACT_ID - version = POM_VERSION - - pom { - name = POM_NAME - packaging = POM_PACKAGING - url = POM_URL - description = POM_PACKAGING - - scm { - url = POM_URL - connection = POM_GIT_URL - developerConnection = POM_GIT_URL - } - - licenses { - license { - name = POM_LICENCE_NAME - url = POM_LICENCE_URL - distribution = POM_LICENCE_DIST - } - } - - developers { - developer { - id = POM_DEVELOPER_ID - name = POM_DEVELOPER_NAME - email = POM_DEVELOPER_EMAIL - } - } - } - } - } - - repositories { - maven { - name 'MavenCentral' - def releasesRepoUrl = 'https://oss.sonatype.org/service/local/staging/deploy/maven2/' - def snapshotsRepoUrl = 'https://oss.sonatype.org/content/repositories/snapshots/' - url version.endsWith('SNAPSHOT') ? snapshotsRepoUrl : releasesRepoUrl - credentials { - username getSonatypeUserName() - password getSonatypePassword() - } - } - } - } - - signing { - required { gradle.taskGraph.hasTask("publish") } - sign publishing.publications.uploadArchives - } -} \ No newline at end of file diff --git a/sample/build.gradle b/sample/build.gradle index b514aee..b2d11a3 100644 --- a/sample/build.gradle +++ b/sample/build.gradle @@ -3,14 +3,13 @@ apply plugin: plugin.andServer android { compileSdkVersion androidBuild.compileSdkVersion - buildToolsVersion androidBuild.buildToolsVersion defaultConfig { applicationId androidBuild.applicationId minSdkVersion androidBuild.sampleMinSdkVersion targetSdkVersion androidBuild.sampleTargetSdkVersion - versionCode androidBuild.versionCode - versionName androidBuild.versionName + versionCode 1 + versionName POM_VERSION } compileOptions { From e11916f1a627b82e5f97c88f8f4a6f3acaaf833c Mon Sep 17 00:00:00 2001 From: Zhenjie Yan Date: Sun, 29 Jan 2023 20:37:34 +0800 Subject: [PATCH 5/8] Upgrade apache component. --- config.gradle | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/config.gradle b/config.gradle index 51799a5..3365f8e 100644 --- a/config.gradle +++ b/config.gradle @@ -28,9 +28,9 @@ ext { ], apache : [ - lang : 'org.apache.commons:commons-lang3:3.9', + lang : 'org.apache.commons:commons-lang3:3.12.0', collections: 'org.apache.commons:commons-collections4:4.4', - httpcore : "com.yanzhenjie.apache:httpcore:4.4.14.1", + httpcore : "com.yanzhenjie.apache:httpcore:4.4.16", fileupload : "com.yanzhenjie.apache:fileupload:1.4", ], From 510af2eb5072195e97ac47491d3828a7fd199105 Mon Sep 17 00:00:00 2001 From: Zhenjie Yan Date: Sun, 29 Jan 2023 20:40:38 +0800 Subject: [PATCH 6/8] Remove the size limit. --- .../yanzhenjie/andserver/sample/component/AppConfig.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/sample/src/main/java/com/yanzhenjie/andserver/sample/component/AppConfig.java b/sample/src/main/java/com/yanzhenjie/andserver/sample/component/AppConfig.java index 0e63c2d..2644420 100644 --- a/sample/src/main/java/com/yanzhenjie/andserver/sample/component/AppConfig.java +++ b/sample/src/main/java/com/yanzhenjie/andserver/sample/component/AppConfig.java @@ -35,9 +35,9 @@ public void onConfig(Context context, Delegate delegate) { delegate.addWebsite(new AssetsWebsite(context, "/web")); delegate.setMultipart(Multipart.newBuilder() - .allFileMaxSize(1024 * 1024 * 20) // 20M - .fileMaxSize(1024 * 1024 * 5) // 5M - .maxInMemorySize(1024 * 10) // 1024 * 10 bytes +// .allFileMaxSize(1024 * 1024 * 20) // 20M +// .fileMaxSize(1024 * 1024 * 5) // 5M +// .maxInMemorySize(1024 * 10) // 1024 * 10 bytes .uploadTempDir(new File(context.getCacheDir(), "_server_upload_cache_")) .build()); } From f6f37c9936beaa57e4feb27fd46a17845e519320 Mon Sep 17 00:00:00 2001 From: Zhenjie Yan Date: Sun, 29 Jan 2023 20:50:32 +0800 Subject: [PATCH 7/8] Update sample, upgrade the targetSdkVersion to 30. --- config.gradle | 6 +++--- .../com/yanzhenjie/andserver/sample/App.java | 14 +++---------- .../sample/controller/TestController.java | 21 ++++++++++++++++--- .../andserver/sample/util/FileUtils.java | 14 ------------- 4 files changed, 24 insertions(+), 31 deletions(-) diff --git a/config.gradle b/config.gradle index 3365f8e..0ed2fd5 100644 --- a/config.gradle +++ b/config.gradle @@ -11,12 +11,12 @@ ext { androidBuild = [ applicationId : 'com.yanzhenjie.andserver.sample', - compileSdkVersion : 29, + compileSdkVersion : 30, libraryMinSdkVersion : 9, - libraryTargetSdkVersion: 29, + libraryTargetSdkVersion: 30, sampleMinSdkVersion : 14, - sampleTargetSdkVersion : 22 + sampleTargetSdkVersion : 30 ] deps = [ diff --git a/sample/src/main/java/com/yanzhenjie/andserver/sample/App.java b/sample/src/main/java/com/yanzhenjie/andserver/sample/App.java index 8932f3f..f738054 100644 --- a/sample/src/main/java/com/yanzhenjie/andserver/sample/App.java +++ b/sample/src/main/java/com/yanzhenjie/andserver/sample/App.java @@ -16,12 +16,9 @@ package com.yanzhenjie.andserver.sample; import android.app.Application; -import android.content.Context; -import android.os.Environment; import androidx.annotation.NonNull; -import com.yanzhenjie.andserver.sample.util.FileUtils; import com.yanzhenjie.andserver.util.IOUtils; import java.io.File; @@ -41,7 +38,7 @@ public void onCreate() { if (mInstance == null) { mInstance = this; - initRootPath(this); + initRootPath(); } } @@ -55,17 +52,12 @@ public File getRootDir() { return mRootDir; } - private void initRootPath(Context context) { + private void initRootPath() { if (mRootDir != null) { return; } - if (FileUtils.storageAvailable()) { - mRootDir = Environment.getExternalStorageDirectory(); - } else { - mRootDir = context.getFilesDir(); - } - mRootDir = new File(mRootDir, "AndServer"); + mRootDir = new File(getFilesDir(), "AndServer"); IOUtils.createFolder(mRootDir); } } \ No newline at end of file diff --git a/sample/src/main/java/com/yanzhenjie/andserver/sample/controller/TestController.java b/sample/src/main/java/com/yanzhenjie/andserver/sample/controller/TestController.java index 9f4f2f7..dc012a1 100644 --- a/sample/src/main/java/com/yanzhenjie/andserver/sample/controller/TestController.java +++ b/sample/src/main/java/com/yanzhenjie/andserver/sample/controller/TestController.java @@ -38,6 +38,7 @@ import com.yanzhenjie.andserver.sample.model.UserInfo; import com.yanzhenjie.andserver.sample.util.FileUtils; import com.yanzhenjie.andserver.sample.util.Logger; +import com.yanzhenjie.andserver.util.Executors; import com.yanzhenjie.andserver.util.MediaType; import java.io.File; @@ -110,9 +111,23 @@ UserInfo userInfo(@CookieValue("account") String account) { } @PostMapping(path = "/upload", produces = MediaType.APPLICATION_JSON_UTF8_VALUE) - String upload(@RequestParam(name = "avatar") MultipartFile file) throws IOException { - File localFile = FileUtils.createRandomFile(file); - file.transferTo(localFile); + String upload(@RequestParam(name = "avatar") final MultipartFile file) { + final File localFile = FileUtils.createRandomFile(file); + + // We use a sub-thread to process files so that the api '/upload' can respond faster + Executors.getInstance().submit(new Runnable() { + @Override + public void run() { + try { + file.transferTo(localFile); + + // Do something ... + } catch (IOException e) { + e.printStackTrace(); + } + } + }); + return localFile.getAbsolutePath(); } diff --git a/sample/src/main/java/com/yanzhenjie/andserver/sample/util/FileUtils.java b/sample/src/main/java/com/yanzhenjie/andserver/sample/util/FileUtils.java index 94bae7a..d53f1ca 100644 --- a/sample/src/main/java/com/yanzhenjie/andserver/sample/util/FileUtils.java +++ b/sample/src/main/java/com/yanzhenjie/andserver/sample/util/FileUtils.java @@ -45,18 +45,4 @@ public static File createRandomFile(MultipartFile file) { String uuid = UUID.randomUUID().toString(); return new File(App.getInstance().getRootDir(), uuid + "." + extension); } - - /** - * SD is available. - * - * @return true, otherwise is false. - */ - public static boolean storageAvailable() { - if (Environment.getExternalStorageState().equals(Environment.MEDIA_MOUNTED)) { - File sd = new File(Environment.getExternalStorageDirectory().getAbsolutePath()); - return sd.canWrite(); - } else { - return false; - } - } } \ No newline at end of file From ca9cfaa45a8a3c40441f00c9303e64a19dd10629 Mon Sep 17 00:00:00 2001 From: Zhenjie Yan Date: Sun, 29 Jan 2023 21:01:20 +0800 Subject: [PATCH 8/8] Release v2.1.11. --- README.md | 8 ++++---- build.gradle | 2 +- gradle.properties | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index 2d79c90..31d4988 100644 --- a/README.md +++ b/README.md @@ -126,7 +126,7 @@ buildscript { } dependencies { - classpath 'com.yanzhenjie.andserver:plugin:2.1.10' + classpath 'com.yanzhenjie.andserver:plugin:2.1.11' ... } } @@ -148,8 +148,8 @@ apply plugin: 'com.yanzhenjie.andserver' ... dependencies { - implementation 'com.yanzhenjie.andserver:api:2.1.10' - annotationProcessor 'com.yanzhenjie.andserver:processor:2.1.10' + implementation 'com.yanzhenjie.andserver:api:2.1.11' + annotationProcessor 'com.yanzhenjie.andserver:processor:2.1.11' ... } ``` @@ -163,7 +163,7 @@ Before submitting pull requests, contributors must abide by the [agreement](./CO ## License ```text -Copyright 2021 Zhenjie Yan +Copyright Zhenjie Yan Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/build.gradle b/build.gradle index 054fafa..2a4631a 100644 --- a/build.gradle +++ b/build.gradle @@ -9,7 +9,7 @@ buildscript { dependencies { classpath 'com.android.tools.build:gradle:3.6.3' - classpath 'com.yanzhenjie.andserver:plugin:2.1.10' + classpath 'com.yanzhenjie.andserver:plugin:2.1.11' } } diff --git a/gradle.properties b/gradle.properties index 3ef1d24..8f14751 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,7 +1,7 @@ android.useAndroidX=true POM_GROUP_ID=com.yanzhenjie.andserver -POM_VERSION=2.1.10 +POM_VERSION=2.1.11 POM_DESCRIPTION=Android web server.