Guest User

Untitled

a guest
Jul 19th, 2018
87
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.58 KB | None | 0 0
  1. public class DocumentationController {
  2. @GET
  3. @Path("/doc")
  4. public static Object get(Response response,Request request) throws Exception{
  5. String path = "/apps/static/doc/";
  6. String fileName = "api.html";
  7.  
  8. File file = new File(path + fileName);
  9.  
  10. String htmlContent = null;
  11. try {
  12. htmlContent = Files.asCharSource(file, Charsets.UTF_8).read();
  13. } catch (IOException e) {
  14. throw new Exception(e.getMessage());
  15. }
  16. response.status(HttpServletResponse.SC_OK);
  17. request.header("Content-Type", MediaType.HTML_UTF_8.toString());
  18.  
  19. return htmlContent;
  20. }
Add Comment
Please, Sign In to add comment