Commit 679dbc65 by gechengyang

log print

parent e5aaeba2
......@@ -2,8 +2,8 @@
<modelVersion>4.0.0</modelVersion>
<groupId>cn.com.brilliance</groupId>
<artifactId>business</artifactId>
<packaging>war</packaging>
<version>0.0.1-SNAPSHOT</version>
<packaging>jar</packaging>
<version>1.0.0</version>
<name>business</name>
<properties>
......
......@@ -9,6 +9,9 @@ import java.util.Map;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import log.Log;
import log.LogFactory;
import org.apache.commons.fileupload.FileItem;
import org.apache.commons.fileupload.disk.DiskFileItemFactory;
import org.apache.commons.fileupload.servlet.ServletFileUpload;
......@@ -36,9 +39,6 @@ import org.sss.presentation.noui.util.StringUtil;
import com.google.gson.Gson;
import log.Log;
import log.LogFactory;
public class AbstractCommonController {
protected static final Log log = LogFactory.getLog(AbstractCommonController.class);
protected static String ON_CLICK = "ON_CLICK";
......@@ -50,6 +50,7 @@ public class AbstractCommonController {
@SuppressWarnings("unchecked")
public Object event(String mappingUrl, String eventType, Map<String, Object> dataMap, HttpServletRequest request, HttpServletResponse response) {
NoUiContext context = null;
Result ret = null;
boolean isMultipart = false;
......@@ -62,21 +63,23 @@ public class AbstractCommonController {
// Parse the request
List<FileItem> items = upload.parseRequest(request);
Iterator<FileItem> iter = items.iterator();
while (iter.hasNext()) {
FileItem item = iter.next();
// 普通表单域
if (item.isFormField()) {
String itemName = item.getFieldName();
String itemValue =item.getString();
String itemValue = item.getString();
log.info("文件表单 key:" + itemName + ",Value:" + itemValue);
// 给dataMap赋值
Map<String,?> itemMap = new Gson().fromJson(itemValue, Map.class);
Map<String, ?> itemMap = new Gson().fromJson(itemValue, Map.class);
dataMap.put(itemName, itemMap);
} else { // 文件域
lastFileItem = item;
}
}
} else {
log.info("普通表单key-Value:" + dataMap);
}
NoUiRequest noUiRequest = new NoUiRequest(request, mappingUrl, dataMap);
context = NoUiContextManager.createNoUiContext(noUiRequest);
......@@ -114,13 +117,13 @@ public class AbstractCommonController {
((IDatafield<?>) currentDataField).invokeCheckRules(context);
}
}
} else if (eventType.equals(ON_STREAM_UPLOAD) && lastFileItem!=null) {
} else if (eventType.equals(ON_STREAM_UPLOAD) && lastFileItem != null) {
@SuppressWarnings("rawtypes")
IDatafield dataField = (IDatafield) baseObject(context, noUiRequest, alias);
IStream stream = (IStream) dataField.getValue();
stream.setName(lastFileItem.getName());
stream.setType(lastFileItem.getContentType());
IOUtils.copy(lastFileItem.getInputStream(), stream.getOutputStream(), 1024);
IOUtils.copy(lastFileItem.getInputStream(), stream.getOutputStream(), 1024);
// dataField.setValue(stream);
dataField.invokeEventRules(context, EventType.ON_STREAM_UPLOAD, null);
} else if (eventType.equals(ON_STREAM_DOWNLOAD)) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment