aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/com/juick/http/www/Help.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/com/juick/http/www/Help.java')
-rw-r--r--src/main/java/com/juick/http/www/Help.java18
1 files changed, 6 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..503044e6 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,11 @@ 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 +61,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 +77,6 @@ public class Help {
PageTemplates.pageFooter(request, out, visitor, false);
PageTemplates.pageEnd(out);
- } finally {
- out.close();
}
}