| Line 1... |
Line 1... |
| 1 |
package com.spice.profitmandi.common.web.util;
|
1 |
package com.spice.profitmandi.common.web.util;
|
| 2 |
|
2 |
|
| - |
|
3 |
import java.io.File;
|
| - |
|
4 |
import java.nio.file.Files;
|
| - |
|
5 |
|
| 3 |
import javax.servlet.http.HttpServletRequest;
|
6 |
import javax.servlet.http.HttpServletRequest;
|
| 4 |
import javax.servlet.http.HttpServletResponse;
|
7 |
import javax.servlet.http.HttpServletResponse;
|
| 5 |
|
8 |
|
| 6 |
import org.springframework.http.HttpStatus;
|
9 |
import org.springframework.http.HttpStatus;
|
| 7 |
import org.springframework.http.MediaType;
|
10 |
import org.springframework.http.MediaType;
|
| Line 60... |
Line 63... |
| 60 |
response.setCharacterEncoding("UTF-8");
|
63 |
response.setCharacterEncoding("UTF-8");
|
| 61 |
response.getWriter().println(data);
|
64 |
response.getWriter().println(data);
|
| 62 |
response.getWriter().flush();
|
65 |
response.getWriter().flush();
|
| 63 |
}
|
66 |
}
|
| 64 |
|
67 |
|
| - |
|
68 |
public void writeOkFileContentType(HttpServletRequest request, HttpServletResponse response, File file, String contentType) throws Exception{
|
| - |
|
69 |
response.setStatus(HttpStatus.OK.value());
|
| - |
|
70 |
response.setContentType(contentType);
|
| - |
|
71 |
response.getWriter().println(Files.readAllBytes(file.toPath()));
|
| - |
|
72 |
response.getWriter().flush();
|
| - |
|
73 |
}
|
| - |
|
74 |
|
| 65 |
public void writeUnauthorized(HttpServletRequest request, HttpServletResponse response, Response failedResponse) throws Exception{
|
75 |
public void writeUnauthorized(HttpServletRequest request, HttpServletResponse response, Response failedResponse) throws Exception{
|
| 66 |
this.writeGenericRequest(request, response, failedResponse, HttpStatus.UNAUTHORIZED);
|
76 |
this.writeGenericRequest(request, response, failedResponse, HttpStatus.UNAUTHORIZED);
|
| 67 |
}
|
77 |
}
|
| 68 |
|
78 |
|
| 69 |
public void writeForbidden(HttpServletRequest request, HttpServletResponse response, Response failedResponse) throws Exception{
|
79 |
public void writeForbidden(HttpServletRequest request, HttpServletResponse response, Response failedResponse) throws Exception{
|