diff options
Diffstat (limited to 'src/main/java/com/juick/http/www/Help.java')
-rw-r--r-- | src/main/java/com/juick/http/www/Help.java | 20 |
1 files changed, 8 insertions, 12 deletions
diff --git a/src/main/java/com/juick/http/www/Help.java b/src/main/java/com/juick/http/www/Help.java index 438fc3a9..e8b7532e 100644 --- a/src/main/java/com/juick/http/www/Help.java +++ b/src/main/java/com/juick/http/www/Help.java @@ -17,15 +17,12 @@ */ package com.juick.http.www; -import java.io.BufferedReader; -import java.io.File; -import java.io.FileReader; -import java.io.IOException; -import java.io.PrintWriter; -import java.sql.Connection; +import org.springframework.jdbc.core.JdbcTemplate; + import javax.servlet.ServletException; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; +import java.io.*; /** * @@ -33,11 +30,13 @@ import javax.servlet.http.HttpServletResponse; */ public class Help { - protected void doRedirectToHelpIndex(Connection sql, HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { + protected void doRedirectToHelpIndex(JdbcTemplate sql, HttpServletRequest request, + HttpServletResponse response) throws ServletException, IOException { Utils.sendTemporaryRedirect(response, "/help/ru/"); } - protected void doGetHelp(Connection sql, HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { + protected void doGetHelp(JdbcTemplate sql, HttpServletRequest request, + HttpServletResponse response) throws ServletException, IOException { com.juick.User visitor = Utils.getVisitorUser(sql, request, response); String path[] = request.getRequestURI().split("/"); @@ -64,8 +63,7 @@ public class Help { } response.setContentType("text/html; charset=UTF-8"); - PrintWriter out = response.getWriter(); - try { + try (PrintWriter out = response.getWriter()) { PageTemplates.pageHead(out, "Помощь", null); PageTemplates.pageNavigation(out, visitor, null); @@ -81,8 +79,6 @@ public class Help { PageTemplates.pageFooter(request, out, visitor, false); PageTemplates.pageEnd(out); - } finally { - out.close(); } } |