You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ofbiz.apache.org by ja...@apache.org on 2014/08/12 15:45:51 UTC
svn commit: r1617474 - in /ofbiz/branches/release13.07: ./
framework/webapp/src/org/ofbiz/webapp/event/ServiceEventHandler.java
Author: jacopoc
Date: Tue Aug 12 13:45:50 2014
New Revision: 1617474
URL: http://svn.apache.org/r1617474
Log:
Applied fix from trunk for revision: 1617473
===
Some optimization for service event handler to prevent unnecessary operations at every service invocation.
Modified:
ofbiz/branches/release13.07/ (props changed)
ofbiz/branches/release13.07/framework/webapp/src/org/ofbiz/webapp/event/ServiceEventHandler.java
Propchange: ofbiz/branches/release13.07/
------------------------------------------------------------------------------
Merged /ofbiz/trunk:r1617473
Modified: ofbiz/branches/release13.07/framework/webapp/src/org/ofbiz/webapp/event/ServiceEventHandler.java
URL: http://svn.apache.org/viewvc/ofbiz/branches/release13.07/framework/webapp/src/org/ofbiz/webapp/event/ServiceEventHandler.java?rev=1617474&r1=1617473&r2=1617474&view=diff
==============================================================================
--- ofbiz/branches/release13.07/framework/webapp/src/org/ofbiz/webapp/event/ServiceEventHandler.java (original)
+++ ofbiz/branches/release13.07/framework/webapp/src/org/ofbiz/webapp/event/ServiceEventHandler.java Tue Aug 12 13:45:50 2014
@@ -124,35 +124,38 @@ public class ServiceEventHandler impleme
throw new EventHandlerException("Problems getting the service model");
}
- if (Debug.verboseOn()) Debug.logVerbose("[Processing]: SERVICE Event", module);
- if (Debug.verboseOn()) Debug.logVerbose("[Using delegator]: " + dispatcher.getDelegator().getDelegatorName(), module);
+ if (Debug.verboseOn()) {
+ Debug.logVerbose("[Processing]: SERVICE Event", module);
+ Debug.logVerbose("[Using delegator]: " + dispatcher.getDelegator().getDelegatorName(), module);
+ }
- // get the http upload configuration
- String maxSizeStr = EntityUtilProperties.getPropertyValue("general.properties", "http.upload.max.size", "-1", dctx.getDelegator());
- long maxUploadSize = -1;
- try {
- maxUploadSize = Long.parseLong(maxSizeStr);
- } catch (NumberFormatException e) {
- Debug.logError(e, "Unable to obtain the max upload size from general.properties; using default -1", module);
- maxUploadSize = -1;
- }
- // get the http size threshold configuration - files bigger than this will be
- // temporarly stored on disk during upload
- String sizeThresholdStr = EntityUtilProperties.getPropertyValue("general.properties", "http.upload.max.sizethreshold", "10240", dctx.getDelegator());
- int sizeThreshold = 10240; // 10K
- try {
- sizeThreshold = Integer.parseInt(sizeThresholdStr);
- } catch (NumberFormatException e) {
- Debug.logError(e, "Unable to obtain the threshold size from general.properties; using default 10K", module);
- sizeThreshold = -1;
- }
- // directory used to temporarily store files that are larger than the configured size threshold
- String tmpUploadRepository = EntityUtilProperties.getPropertyValue("general.properties", "http.upload.tmprepository", "runtime/tmp", dctx.getDelegator());
- String encoding = request.getCharacterEncoding();
- // check for multipart content types which may have uploaded items
boolean isMultiPart = ServletFileUpload.isMultipartContent(request);
Map<String, Object> multiPartMap = FastMap.newInstance();
if (isMultiPart) {
+ // get the http upload configuration
+ String maxSizeStr = EntityUtilProperties.getPropertyValue("general.properties", "http.upload.max.size", "-1", dctx.getDelegator());
+ long maxUploadSize = -1;
+ try {
+ maxUploadSize = Long.parseLong(maxSizeStr);
+ } catch (NumberFormatException e) {
+ Debug.logError(e, "Unable to obtain the max upload size from general.properties; using default -1", module);
+ maxUploadSize = -1;
+ }
+ // get the http size threshold configuration - files bigger than this will be
+ // temporarly stored on disk during upload
+ String sizeThresholdStr = EntityUtilProperties.getPropertyValue("general.properties", "http.upload.max.sizethreshold", "10240", dctx.getDelegator());
+ int sizeThreshold = 10240; // 10K
+ try {
+ sizeThreshold = Integer.parseInt(sizeThresholdStr);
+ } catch (NumberFormatException e) {
+ Debug.logError(e, "Unable to obtain the threshold size from general.properties; using default 10K", module);
+ sizeThreshold = -1;
+ }
+ // directory used to temporarily store files that are larger than the configured size threshold
+ String tmpUploadRepository = EntityUtilProperties.getPropertyValue("general.properties", "http.upload.tmprepository", "runtime/tmp", dctx.getDelegator());
+ String encoding = request.getCharacterEncoding();
+ // check for multipart content types which may have uploaded items
+
ServletFileUpload upload = new ServletFileUpload(new DiskFileItemFactory(sizeThreshold, new File(tmpUploadRepository)));
// create the progress listener and add it to the session