我有一个带有控制器的spring boot应用程序,可以使用p-fileUpload从primeng上传文件。当我在STS中作为Sprint Boot App运行spring boot服务时,一切正常,但是当我将服务部署到weblogic 12c R2(12.2.1.1)时,控制器方法会得到一个空列表。
代码如下。我需要做些什么才能让weblogic工作?
// 3.1.2 Multiple file upload
// @PostMapping("/api/upload/multi")
// @Consumes(MediaType.MULTIPART_FORM_DATA_VALUE)
@ResponseBody
@RequestMapping(value = { "/upload/multi/{fein}" }, method = { RequestMethod.POST })
public ResponseEntity<?> uploadFileMulti(
@PathVariable Long fein,
// @RequestParam("extraField") String extraField,
@RequestPart("uploadFiles") List<MultipartFile> myFiles) {
log.info("Multiple file upload!");
// Get file name
// String uploadedFileName = Arrays.stream(uploadFiles).map(x ->
// x.getOriginalFilename())
// .filter(x -> !StringUtils.isEmpty(x)).collect(Collectors.joining(" ,
// "));
//
// if (StringUtils.isEmpty(uploadedFileName)) {
// return new ResponseEntity("please select a file!", HttpStatus.OK);
// }
// Check for empty files.
for (MultipartFile myFile : myFiles) {
log.info("Attempting to upload of files=" + myFile.getOriginalFilename());
if (myFile.isEmpty()) {
log.error("No file specified!");
return new ResponseEntity<>("No file specified!", HttpStatus.BAD_REQUEST);
}
}
try {
// saveUploadedFiles( fein, Arrays.asList(myFiles));
saveUploadedFiles( fein, myFiles);
} catch (IOException e) {
return new ResponseEntity<>(HttpStatus.BAD_REQUEST);
}
return new ResponseEntity<>("Successfully uploaded - file(s).", HttpStatus.OK);
}
<div class="container">
<div class="row">
<div class="col-md-12">
<form [formGroup]="attachmentForm" (ngSubmit)="onSubmit()">
<div class="row">
<div class="col-md-12">
<p-panel header="Instructions">
<ul class="no-list-style">
<li><label>Step 1: Click Browse to find the document(s) you want to upload</label></li>
<li><label>Step 2: Click Upload</label></li>
<li><label>Step 3: Click Save</label></li>
</ul>
</p-panel>
</div>
</div>
<div class="row">
<div class="col-md-12">
<div class="form-group">
<p-fileUpload name="uploadFiles" url={{uploadUrlString}} accept={{acceptString}} maxFileSize="50000000" (onUpload)="onUpload($event)"></p-fileUpload>
<!-- <label>File Name</label>
<input type="text" class="form-control" value={{selectedAttachment.filName}} formControlName="filename" /> -->
</div>
</div>
</div>
<div class="row">
<div class="col-md-12">
<div class="form-group">
<label>File Name</label>
<textarea class="form-control" value={{selectedAttachment.filName}} formControlName="filename"></textarea>
</div>
</div>
</div>
<div class="row">
<div class="col-md-12">
<div class="form-group">
<label>Comments</label>
<textarea class="form-control" value={{selectedAttachment.comments}} formControlName="comments"></textarea>
</div>
</div>
</div>
<div class="row">
<button type="submit" class="btn btn-primary btn-sm pull-left" style="margin-left:15px; margin-right:15px; margin-top:5px; margin-bottom:5px">Save Attachment</button>
<button type="button" class="btn btn-primary btn-sm pull-left" style="margin-left:15px; margin-right:15px; margin-top:5px; margin-bottom:5px"
(click)="onCancel()">Cancel</button>
</div>
</form>
</div>
</div>
</div>
答案 0 :(得分:0)
经过大量研究,结果证明这是weblogic 12c的解决方案。我希望这对人们有所帮助。
<FE>
<id>1</id>
<pass>0</pass>
<CONSECUTIVE>0</CONSECUTIVE>
....
</FE>