本文整理汇总了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;
}
开发者ID:liaokailin,项目名称:tomcat7,代码行数:17,代码来源:ServletRequestContext.java
示例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;
}
开发者ID:how2j,项目名称:lazycat,代码行数:17,代码来源:ServletRequestContext.java
示例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;
}
开发者ID:das-praktische-schreinerlein,项目名称:your-all-in-one,代码行数:16,代码来源:MvcConfig.java
示例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));
}
开发者ID:liaokailin,项目名称:tomcat7,代码行数:17,代码来源:ServletFileUpload.java
示例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));
}
开发者ID:how2j,项目名称:lazycat,代码行数:17,代码来源:ServletFileUpload.java
注:本文中的org.apache.tomcat.util.http.fileupload.FileUploadBase类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论