本文整理汇总了Java中org.apache.tomcat.util.http.fileupload.FileUploadBase类的典型用法代码示例。如果您正苦于以下问题:Java FileUploadBase类的具体用法?Java FileUploadBase怎么用?Java FileUploadBase使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
FileUploadBase类属于org.apache.tomcat.util.http.fileupload包,在下文中一共展示了FileUploadBase类的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: init
import org.apache.tomcat.util.http.fileupload.FileUploadBase; //导入依赖的package包/类
@PostConstruct
public void init() {
exceptionToStatusCodeMap.put(FileUploadBase.FileSizeLimitExceededException.class, 413);
exceptionToStatusCodeMap.put(FileUploadBase.SizeLimitExceededException.class, 413);
exceptionToStatusCodeMap.put(MethodArgumentTypeMismatchException.class, 404);
exceptionToStatusCodeMap.put(MethodArgumentNotValidException.class, 422);
exceptionToMessageMap.put(MethodArgumentNotValidException.class, "Request validation failed");
}
开发者ID:hmcts,项目名称:document-management-store-app,代码行数:10,代码来源:ExceptionStatusCodeAndMessageResolver.java
示例2: should_find_cause_from_exception_and_return_appropriate_code
import org.apache.tomcat.util.http.fileupload.FileUploadBase; //导入依赖的package包/类
@Test
public void should_find_cause_from_exception_and_return_appropriate_code() {
final FileUploadBase.FileSizeLimitExceededException fileSizeLimitExceededException =
new FileUploadBase.FileSizeLimitExceededException("Too Big", 1234, 1024);
final MultipartException multipartException =
new MultipartException("Limit exceeded", fileSizeLimitExceededException);
final ErrorStatusCodeAndMessage statusCodeAndMessage =
resolver.resolveStatusCodeAndMessage(multipartException, "It broke", 500);
assertThat(statusCodeAndMessage.getStatusCode(), equalTo(413));
}
开发者ID:hmcts,项目名称:document-management-store-app,代码行数:13,代码来源:ExceptionStatusCodeAndMessageResolverTest.java
示例3: contentLength
import org.apache.tomcat.util.http.fileupload.FileUploadBase; //导入依赖的package包/类
/**
* Retrieve the content length of the request.
*
* @return The content length of the request.
* @since 1.3
*/
@Override
public long contentLength() {
long size;
try {
size = Long.parseLong(request.getHeader(FileUploadBase.CONTENT_LENGTH));
} catch (NumberFormatException e) {
size = request.getContentLength();
}
return size;
}
示例4: handleMultipartException
import org.apache.tomcat.util.http.fileupload.FileUploadBase; //导入依赖的package包/类
@ExceptionHandler(MultipartException.class)
public ResponseEntity<UploadImagesDTO> handleMultipartException(Exception e){
UploadImagesDTO dto = new UploadImagesDTO("", false);
if(e.getCause() instanceof IllegalStateException && e.getCause().getCause() instanceof FileUploadBase.SizeLimitExceededException) {
return ResponseEntity
.status(HttpStatus.PAYLOAD_TOO_LARGE)
.body(dto);
} else {
e.printStackTrace();
return ResponseEntity
.status(HttpStatus.INTERNAL_SERVER_ERROR)
.body(dto);
}
}
开发者ID:2DV603NordVisaProject,项目名称:nordvisa_calendar,代码行数:16,代码来源:CustomResponseEntityExceptionHandler.java
示例5: contentLength
import org.apache.tomcat.util.http.fileupload.FileUploadBase; //导入依赖的package包/类
/**
* Retrieve the content length of the request.
*
* @return The content length of the request.
* @since 1.3
*/
@Override
public long contentLength() {
long size;
try {
size = Long.parseLong(request.getHeader(FileUploadBase.CONTENT_LENGTH));
} catch (NumberFormatException e) {
size = request.getContentLength();
}
return size;
}
示例6: multipartConfigElement
import org.apache.tomcat.util.http.fileupload.FileUploadBase; //导入依赖的package包/类
@Bean
MultipartConfigElement multipartConfigElement() {
// spring-config
MultipartConfigFactory factory = new MultipartConfigFactory();
factory.setMaxFileSize(System.getProperty("yaio.server.maxfilesize", "128kb"));
factory.setMaxRequestSize(System.getProperty("yaio.server.maxrequestsize", "128kb"));
MultipartConfigElement config = factory.createMultipartConfig();
// tomcat-config
FileUploadBase tomcatConfig = new FileUpload();
tomcatConfig.setFileSizeMax(config.getMaxFileSize());
tomcatConfig.setSizeMax(config.getMaxFileSize());
return config;
}
示例7: isMultipartContent
import org.apache.tomcat.util.http.fileupload.FileUploadBase; //导入依赖的package包/类
/**
* Utility method that determines whether the request contains multipart
* content.
*
* @param request The servlet request to be evaluated. Must be non-null.
*
* @return <code>true</code> if the request is multipart;
* <code>false</code> otherwise.
*/
public static final boolean isMultipartContent(
HttpServletRequest request) {
if (!POST_METHOD.equalsIgnoreCase(request.getMethod())) {
return false;
}
return FileUploadBase.isMultipartContent(new ServletRequestContext(request));
}
示例8: isMultipartContent
import org.apache.tomcat.util.http.fileupload.FileUploadBase; //导入依赖的package包/类
/**
* Utility method that determines whether the request contains multipart
* content.
*
* @param request
* The servlet request to be evaluated. Must be non-null.
*
* @return <code>true</code> if the request is multipart; <code>false</code>
* otherwise.
*/
public static final boolean isMultipartContent(HttpServletRequest request) {
if (!POST_METHOD.equalsIgnoreCase(request.getMethod())) {
return false;
}
return FileUploadBase.isMultipartContent(new ServletRequestContext(request));
}