Class LicenseService
The extraction of an uploaded license file relies
on HttpServletRequest.getPart(String), which requires that multipart-config is enabled on the servlet declaring this service.
This service is recommended to be declared by a specific servlet,
so that the servlet controls precisely the maximum size of an uploaded file in that context.
Recommendation is that maximum size for the upload is around 100Kb.
This service declares an empty Path annotation, as the dedicated servlet must be the one registered for the /security/license path.
A subclass may be used to override the extraction
and use an alternate mean to process the request payload (e.g. using Apache File Upload).
In such case, the subclass must declare a Path annotation whose value is /security/license.
- Since:
- 4.2.0
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected InputStreamgetPartInputStream(HttpServletRequest request, String field) Gets the input stream of the uploaded item by field name.
-
Constructor Details
-
LicenseService
public LicenseService()
-
-
Method Details
-
getLicenseConfiguration
-
addLicense
-
getPartInputStream
protected InputStream getPartInputStream(HttpServletRequest request, String field) throws IOException, ServletException, IllegalStateException Gets the input stream of the uploaded item by field name.Default implementation uses
HttpServletRequest.getPart(String), which requires that multipart-config is enabled on the servlet declaring this service. Subclasses may override this method to change how part content is extracted from the request payload (e.g. using Apache File Upload).- Parameters:
request- the HTTP request.field- the name of the field to look up.- Returns:
- the input stream of the uploaded item.
- Throws:
IOException- if an I/O error occurred during the retrieval of the requested PartServletException- if this request is not of type multipart/form-dataIllegalStateException- if the request body is larger than the maximum size allowed, or any Part in the request is larger than such size, or there is no MultipartConfig annotation or multipart-config in deployment descriptors
-