Class LicenseService

java.lang.Object
com.sodius.oslc.server.security.services.LicenseService

@Path("") public class LicenseService extends Object
Manages the edition of the license by an administrator.

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 Details

    • LicenseService

      public LicenseService()
  • Method Details

    • getLicenseConfiguration

      @GET @Produces({"application/rdf+xml","application/xml","text/xml","application/json","application/ld+json","text/turtle"}) public Response getLicenseConfiguration()
    • addLicense

      @POST @Consumes("multipart/form-data") @Produces({"application/rdf+xml","application/xml","text/xml","application/json","application/ld+json","text/turtle"}) public Response 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 Part
      ServletException - if this request is not of type multipart/form-data
      IllegalStateException - 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