Commit fb3a3f77 by hy

.

parent d9868cda
......@@ -3,4 +3,5 @@ package com.tbyf.license;
public class Constants {
public static final String LICENSE_FILE_NAME = "hip.lic";
public static final String TEXT_PLAIN_MEDIA_TYPE = "text/plain;charset=UTF-8";
}
......@@ -2,10 +2,8 @@ package com.tbyf.license;
import lombok.Setter;
import org.springframework.http.HttpStatus;
import org.springframework.http.MediaType;
import javax.servlet.ServletException;
import javax.servlet.annotation.MultipartConfig;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
......@@ -35,12 +33,12 @@ public class LicenseInstallationServlet extends HttpServlet {
Files.copy(is, dest, StandardCopyOption.REPLACE_EXISTING);
this.licenseManager.install(dest.toString());
resp.setStatus(HttpStatus.OK.value());
resp.setContentType("text/plain;charset=UTF-8");
resp.setContentType(Constants.TEXT_PLAIN_MEDIA_TYPE);
resp.getWriter().write("200");
}
catch (Exception e) {
resp.setStatus(HttpStatus.BAD_REQUEST.value());
resp.setContentType("text/plain;charset=UTF-8");
resp.setContentType(Constants.TEXT_PLAIN_MEDIA_TYPE);
resp.getWriter().write("400");
}
}
......
package com.tbyf.license;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
import global.namespace.fun.io.api.NoContentException;
import global.namespace.truelicense.api.LicenseManagementException;
import global.namespace.truelicense.api.LicenseValidationException;
......@@ -17,7 +15,6 @@ import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
public class LicenseValidationFilter extends OncePerRequestFilter {
......
package com.tbyf.license;
import org.springframework.boot.web.servlet.ServletContextInitializer;
import javax.servlet.ServletContext;
import javax.servlet.ServletException;
public class MultipartConfig implements ServletContextInitializer {
@Override
public void onStartup(ServletContext servletContext) throws ServletException {
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment