Skip to content

Commit e320eff

Browse files
committed
resolve merge conflict
2 parents 1482678 + c10d2b6 commit e320eff

25 files changed

Lines changed: 362 additions & 641 deletions

pom.xml

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,9 @@
1818
********************************************
1919
* version history
2020
********************************************
21+
1.4.9
22+
* catch up update to 1.3.12-LTS
23+
2124
1.4.8
2225
* catch up update to 1.3.11-LTS
2326
@@ -64,6 +67,19 @@
6467
* #191 Review and fix the use of `ConcurrentMap`
6568
* #17 Support WebSocket
6669
70+
1.3.12
71+
* #317 reopened: `@DbBind` not working with JSON format
72+
* #345 Support in memory cache of uploaded file when size not exceeds threshold
73+
* #344 Support `*` in integer value configuration
74+
* #343 Drop download upload file support
75+
* #341 Make upload file in memory threshold be configurable
76+
* #340 Upload file get saved twice to filesystem
77+
* #339 Make upload file stored in a hierarchical directory structure
78+
* #338 It shall report 400 Bad Request if required file upload is missing
79+
* #337 StaticResourceGetter.toString method output is confusing
80+
* #336 Act's asset static resource URL shall follow the built-in URL convention
81+
* #335 UploadFileStorageService shall add length attribute into SObject
82+
6783
1.3.11
6884
* #330 Error message could not display correctly
6985
* #328 ACT can't register ebean as default datasource when configuration both ebean and mongo datasource
@@ -338,7 +354,7 @@
338354
<cdi-api.version>1.2</cdi-api.version>
339355
<commons-fileupload.version>1.3.2</commons-fileupload.version>
340356
<ecj.version>4.6.1</ecj.version>
341-
<fastjson.version>1.2.35</fastjson.version>
357+
<fastjson.version>1.2.36</fastjson.version>
342358
<bval.version>1.1.2</bval.version>
343359
<image4j.version>0.7</image4j.version>
344360
<jansi.version>1.16</jansi.version>
@@ -351,7 +367,7 @@
351367
<osgl-genie.version>1.1.3</osgl-genie.version>
352368
<osgl-tool.version>1.4.1</osgl-tool.version>
353369
<osgl-mvc.version>1.2.0</osgl-mvc.version>
354-
<osgl-storage.version>1.3.0</osgl-storage.version>
370+
<osgl-storage.version>1.4.0</osgl-storage.version>
355371
<osgl-tool-ext.version>1.0.1</osgl-tool-ext.version>
356372
<reflectasm.version>1.11.3</reflectasm.version>
357373
<rythmengine.version>1.2.0</rythmengine.version>

src/main/java/act/app/App.java

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@
3737
import act.controller.bytecode.ControllerByteCodeScanner;
3838
import act.data.DataPropertyRepository;
3939
import act.data.JodaDateTimeCodec;
40+
import act.util.UploadFileStorageService;
4041
import act.data.util.ActPropertyHandlerFactory;
4142
import act.event.AppEventListenerBase;
4243
import act.event.EventBus;
@@ -76,7 +77,6 @@
7677
import org.osgl.logging.Logger;
7778
import org.osgl.mvc.MvcConfig;
7879
import org.osgl.mvc.result.Result;
79-
import org.osgl.storage.IStorageService;
8080
import org.osgl.util.*;
8181
import org.rythmengine.utils.I18N;
8282

@@ -136,7 +136,7 @@ public enum F {
136136
private BinderManager binderManager;
137137
private AppInterceptorManager interceptorManager;
138138
private DependencyInjector<?> dependencyInjector;
139-
private IStorageService uploadFileStorageService;
139+
private UploadFileStorageService uploadFileStorageService;
140140
private AppServiceRegistry appServiceRegistry;
141141
private Map<String, Daemon> daemonRegistry;
142142
private WebSocketConnectionManager webSocketConnectionManager;
@@ -810,7 +810,7 @@ public <DI extends DependencyInjector> DI injector() {
810810
return (DI) dependencyInjector;
811811
}
812812

813-
public IStorageService uploadFileStorageService() {
813+
public UploadFileStorageService uploadFileStorageService() {
814814
return uploadFileStorageService;
815815
}
816816

@@ -1242,10 +1242,10 @@ private void loadRoutes() {
12421242

12431243
private void loadBuiltInRoutes() {
12441244
router().addMapping(H.Method.GET, "/asset/", new StaticResourceGetter("asset"), RouteSource.BUILD_IN);
1245-
router().addMapping(H.Method.GET, "/asset/act/", new StaticResourceGetter("asset/act"), RouteSource.BUILD_IN);
1246-
if (config().allowDownloadUploadFile()) {
1247-
router().addMapping(H.Method.GET, "/~upload/{path}", new UploadFileStorageService.UploadFileGetter(), RouteSource.BUILD_IN);
1248-
}
1245+
StaticResourceGetter actAssets = new StaticResourceGetter("asset/~/act");
1246+
router().addMapping(H.Method.GET, "/~/asset/", actAssets, RouteSource.BUILD_IN);
1247+
// TODO drop the following routes in 2.0
1248+
router().addMapping(H.Method.GET, "/asset/act/", actAssets, RouteSource.BUILD_IN);
12491249
router().addContext("act.", "/~");
12501250
if (config.cliOverHttp()) {
12511251
Router router = router(AppConfig.PORT_CLI_OVER_HTTP);

src/main/java/act/conf/AppConfig.java

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -2474,23 +2474,23 @@ private void _mergeResourcePreloadSizeLimit(AppConfig conf) {
24742474
}
24752475
}
24762476

2477-
private Boolean uploadFileDownload;
2478-
protected T enableUploadFileDownload(boolean b) {
2479-
uploadFileDownload = b;
2477+
private Integer uploadInMemoryCacheThreshold;
2478+
protected T uploadInMemoryCacheThreshold(int l) {
2479+
uploadInMemoryCacheThreshold = l;
24802480
return me();
24812481
}
2482-
public boolean allowDownloadUploadFile() {
2483-
if (null == uploadFileDownload) {
2484-
uploadFileDownload = get(UPLOAD_FILE_DOWNLOAD);
2485-
if (null == uploadFileDownload) {
2486-
uploadFileDownload = false;
2482+
public int uploadInMemoryCacheThreshold() {
2483+
if (null == uploadInMemoryCacheThreshold) {
2484+
uploadInMemoryCacheThreshold = getInteger(UPLOAD_IN_MEMORY_CACHE_THRESHOLD);
2485+
if (null == uploadInMemoryCacheThreshold) {
2486+
uploadInMemoryCacheThreshold = 1024 * 10;
24872487
}
24882488
}
2489-
return uploadFileDownload;
2489+
return uploadInMemoryCacheThreshold;
24902490
}
2491-
private void _mergeUploadFileDownload(AppConfig config) {
2492-
if (!hasConfiguration(UPLOAD_FILE_DOWNLOAD)) {
2493-
uploadFileDownload = config.uploadFileDownload;
2491+
private void _mergeUploadInMemoryCacheThreshold(AppConfig config) {
2492+
if (!hasConfiguration(UPLOAD_IN_MEMORY_CACHE_THRESHOLD)) {
2493+
uploadInMemoryCacheThreshold = config.uploadInMemoryCacheThreshold;
24942494
}
24952495
}
24962496

@@ -2669,7 +2669,7 @@ public void _merge(AppConfigurator conf) {
26692669
_mergeSecureTicketCodec(conf);
26702670
_mergeCacheServiceProvider(conf);
26712671
_mergeUnknownHttpMethodHandler(conf);
2672-
_mergeUploadFileDownload(conf);
2672+
_mergeUploadInMemoryCacheThreshold(conf);
26732673
_mergeSslSupport(conf);
26742674
_mergeWsTicketKey(conf);
26752675

src/main/java/act/conf/AppConfigKey.java

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -821,13 +821,15 @@ public <T> T val(Map<String, ?> configuration) {
821821
TEMPLATE_HOME("template.home"),
822822

823823
/**
824-
* `upload.file.download.enabled`
824+
* `upload.in_memory.threshold`
825825
*
826-
* Turn on/off downloader for uploading files
826+
* If file upload content length is less than this configuration then
827+
* the file will not get written into disk, instead it will get cached
828+
* into a in memory byte array
827829
*
828-
* Default value: `false`
830+
* Default value: `1024 * 10`
829831
*/
830-
UPLOAD_FILE_DOWNLOAD("upload.file.download.enabled"),
832+
UPLOAD_IN_MEMORY_CACHE_THRESHOLD("upload.in_memory.threshold"),
831833

832834
/**
833835
* `act.url.context` specifies the app URL context.

src/main/java/act/conf/Config.java

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,16 @@ public Integer getInteger(ConfigKey key) {
9595
if (retVal instanceof Number) {
9696
return ((Number) retVal).intValue();
9797
}
98-
return Integer.parseInt(S.string(retVal));
98+
String s = S.string(retVal);
99+
if (s.contains("*")) {
100+
List<String> sl = S.fastSplit(s, "*");
101+
int n = 1;
102+
for (String sn : sl) {
103+
n *= Integer.parseInt(sn.trim());
104+
}
105+
return n;
106+
}
107+
return Integer.parseInt(s);
99108
}
100109

101110
boolean hasConfiguration(ConfigKey key) {

0 commit comments

Comments
 (0)