Extjs4 使用RESTEasy 2.3.0.GA上传ExtJs 4文件,JSON响应无效
关于这个话题有很多讨论,但没有真正的解决办法 如果我使用Extjs4 使用RESTEasy 2.3.0.GA上传ExtJs 4文件,JSON响应无效,extjs4,resteasy,jboss6.x,Extjs4,Resteasy,Jboss6.x,关于这个话题有很多讨论,但没有真正的解决办法 如果我使用 1@Produceapplication/Json在中显示Json响应时,我遇到了相同的问题,我的解决方案是: 使用@Producestext/html 您的方法需要将字符串发回前端: 公共字符串上载文件 最简单的方法是在ExtjsJson类中实现一个toString方法,该类以字符串格式返回该方法。 我也有同样的问题,我的解决方案是: 使用@Producestext/html 您的方法需要将字符串发回前端: 公共字符串上载文件 最简单的
1@Produceapplication/Json在中显示Json响应时,我遇到了相同的问题,我的解决方案是: 使用@Producestext/html 您的方法需要将字符串发回前端: 公共字符串上载文件 最简单的方法是在ExtjsJson类中实现一个toString方法,该类以字符串格式返回该方法。
我也有同样的问题,我的解决方案是: 使用@Producestext/html 您的方法需要将字符串发回前端: 公共字符串上载文件 最简单的方法是在ExtjsJson类中实现一个toString方法,该类以字符串格式返回该方法。
来吧,伙计们,给我指点方向!!来吧,伙计们,给我指点方向!!
@POST
@Path("/bulkUpdate")
@Consumes("multipart/form-data")
@Produces({"application/json"})
public ExtjsJson<DataException> uploadFile(MultipartFormDataInput input) {
Map<String, List<InputPart>> uploadForm = input.getFormDataMap();
List<InputPart> inputParts = uploadForm.get("uploadedFile");
List<DataException> list = new ArrayList<DataException>();
final ExtjsJson<DataException> returnObj = new ExtjsJson<DataException>();
for (InputPart inputPart : inputParts) {
try {
MultivaluedMap<String, String> header = inputPart.getHeaders();
String fileName = getFileName(header);
InputStream inputStream = inputPart.getBody(InputStream.class, null);
byte[] bytes = IOUtils.toByteArray(inputStream);
//handle the excel file upload and return the error if the file does not have valid data some like...
DataException error = new DataException("supervisor", "columnName", 1, "SheetName", "this is not a valid supervisor");
list.add(error);
} catch (IOException e) {
e.printStackTrace();
}
}
returnObj.setSuccess(true);
returnObj.setResults(list);
return returnObj;
}
@Data
@XmlRootElement
@XmlAccessorType(XmlAccessType.FIELD)
public class DataException {
//private static final long serialVersionUID = 1L;
/** excel sheet name */
private String sheetName;
/** row number of the excel sheet */
private int rowNumber;
/** field name/cell header **/
private String fieldName;
/** cell value */
private String fieldValue;
private String description;
}