aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/com/juick/http
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/com/juick/http')
-rw-r--r--src/main/java/com/juick/http/www/Discover.java8
-rw-r--r--src/main/java/com/juick/http/www/Help.java2
-rw-r--r--src/main/java/com/juick/http/www/Home.java13
-rw-r--r--src/main/java/com/juick/http/www/Main.java2
-rw-r--r--src/main/java/com/juick/http/www/PageTemplates.java14
-rw-r--r--src/main/java/com/juick/http/www/TwitterAuth.java7
-rw-r--r--src/main/java/com/juick/http/www/User.java1
-rw-r--r--src/main/java/com/juick/http/www/Utils.java16
8 files changed, 23 insertions, 40 deletions
diff --git a/src/main/java/com/juick/http/www/Discover.java b/src/main/java/com/juick/http/www/Discover.java
index bdb86380..4ae3156b 100644
--- a/src/main/java/com/juick/http/www/Discover.java
+++ b/src/main/java/com/juick/http/www/Discover.java
@@ -22,16 +22,14 @@ import com.juick.server.MessagesQueries;
import com.juick.server.TagQueries;
import org.springframework.jdbc.core.JdbcTemplate;
+import javax.servlet.ServletException;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.io.PrintWriter;
import java.net.URLDecoder;
import java.net.URLEncoder;
-import java.sql.Connection;
-import java.util.ArrayList;
import java.util.List;
-import javax.servlet.ServletException;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
/**
*
diff --git a/src/main/java/com/juick/http/www/Help.java b/src/main/java/com/juick/http/www/Help.java
index 503044e6..761c6ce1 100644
--- a/src/main/java/com/juick/http/www/Help.java
+++ b/src/main/java/com/juick/http/www/Help.java
@@ -30,7 +30,7 @@ import java.io.*;
*/
public class Help {
- protected void doRedirectToHelpIndex(JdbcTemplate sql, HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
+ protected void doRedirectToHelpIndex(HttpServletResponse response) throws ServletException, IOException {
Utils.sendTemporaryRedirect(response, "/help/ru/");
}
diff --git a/src/main/java/com/juick/http/www/Home.java b/src/main/java/com/juick/http/www/Home.java
index d5c1bb7b..1c7cdc30 100644
--- a/src/main/java/com/juick/http/www/Home.java
+++ b/src/main/java/com/juick/http/www/Home.java
@@ -21,15 +21,13 @@ import com.juick.server.AdsQueries;
import com.juick.server.MessagesQueries;
import org.springframework.jdbc.core.JdbcTemplate;
+import javax.servlet.ServletException;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.io.PrintWriter;
import java.net.URLEncoder;
-import java.sql.Connection;
-import java.util.ArrayList;
import java.util.List;
-import javax.servlet.ServletException;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
/**
*
@@ -103,8 +101,7 @@ public class Home {
}
response.setContentType("text/html; charset=UTF-8");
- PrintWriter out = response.getWriter();
- try {
+ try (PrintWriter out = response.getWriter()) {
String head = "";
if (paramBefore > 0 || paramShow != null) {
head = "<meta name=\"robots\" content=\"noindex\"/>";
@@ -168,8 +165,6 @@ public class Home {
PageTemplates.pageFooter(request, out, visitor, true);
PageTemplates.pageEnd(out);
- } finally {
- out.close();
}
}
}
diff --git a/src/main/java/com/juick/http/www/Main.java b/src/main/java/com/juick/http/www/Main.java
index 63bf1c1f..ebdda1c9 100644
--- a/src/main/java/com/juick/http/www/Main.java
+++ b/src/main/java/com/juick/http/www/Main.java
@@ -185,7 +185,7 @@ public class Main extends HttpServlet implements Stream.StreamListener {
} else if (uri.equals("/signup")) {
signup.doGet(sql, request, response);
} else if (uri.equals("/help") || uri.equals("/help/")) {
- help.doRedirectToHelpIndex(sql, request, response);
+ help.doRedirectToHelpIndex(response);
} else if (uri.startsWith("/help/")) {
help.doGetHelp(sql, request, response);
} else if (uri.startsWith("/tag/")) {
diff --git a/src/main/java/com/juick/http/www/PageTemplates.java b/src/main/java/com/juick/http/www/PageTemplates.java
index 7021ccba..da5659e9 100644
--- a/src/main/java/com/juick/http/www/PageTemplates.java
+++ b/src/main/java/com/juick/http/www/PageTemplates.java
@@ -22,13 +22,14 @@ import com.juick.Tag;
import com.juick.server.MessagesQueries;
import com.juick.server.TagQueries;
import com.juick.server.UserQueries;
+import org.springframework.jdbc.core.JdbcTemplate;
+import org.springframework.util.StringUtils;
+import ru.sape.Sape;
+
+import javax.servlet.http.HttpServletRequest;
import java.io.PrintWriter;
import java.io.UnsupportedEncodingException;
import java.net.URLEncoder;
-import java.sql.Connection;
-import java.sql.PreparedStatement;
-import java.sql.ResultSet;
-import java.sql.SQLException;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Calendar;
@@ -37,11 +38,6 @@ import java.util.List;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import java.util.stream.Collectors;
-import javax.servlet.http.HttpServletRequest;
-
-import org.springframework.jdbc.core.JdbcTemplate;
-import org.springframework.util.StringUtils;
-import ru.sape.Sape;
/**
*
diff --git a/src/main/java/com/juick/http/www/TwitterAuth.java b/src/main/java/com/juick/http/www/TwitterAuth.java
index bbad4d83..cc586740 100644
--- a/src/main/java/com/juick/http/www/TwitterAuth.java
+++ b/src/main/java/com/juick/http/www/TwitterAuth.java
@@ -2,9 +2,11 @@ package com.juick.http.www;
import com.github.scribejava.apis.TwitterApi;
import com.github.scribejava.core.builder.ServiceBuilder;
-import com.github.scribejava.core.model.*;
+import com.github.scribejava.core.model.OAuth1AccessToken;
+import com.github.scribejava.core.model.OAuth1RequestToken;
+import com.github.scribejava.core.model.OAuthRequest;
+import com.github.scribejava.core.model.Verb;
import com.github.scribejava.core.oauth.OAuth10aService;
-import com.github.scribejava.core.oauth.OAuthService;
import com.juick.server.UserQueries;
import org.json.JSONObject;
import org.springframework.jdbc.core.JdbcTemplate;
@@ -14,7 +16,6 @@ import javax.servlet.http.Cookie;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
-import java.sql.Connection;
/**
* Created by vt on 01.12.2015.
diff --git a/src/main/java/com/juick/http/www/User.java b/src/main/java/com/juick/http/www/User.java
index 0bdd910e..b8441560 100644
--- a/src/main/java/com/juick/http/www/User.java
+++ b/src/main/java/com/juick/http/www/User.java
@@ -31,7 +31,6 @@ import java.io.IOException;
import java.io.PrintWriter;
import java.io.UnsupportedEncodingException;
import java.net.URLEncoder;
-import java.util.Arrays;
import java.util.List;
/**
diff --git a/src/main/java/com/juick/http/www/Utils.java b/src/main/java/com/juick/http/www/Utils.java
index ab721020..44b085b1 100644
--- a/src/main/java/com/juick/http/www/Utils.java
+++ b/src/main/java/com/juick/http/www/Utils.java
@@ -19,24 +19,18 @@ package com.juick.http.www;
import org.springframework.jdbc.core.JdbcTemplate;
-import java.io.BufferedReader;
-import java.io.FileOutputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.InputStreamReader;
-import java.io.PrintWriter;
+import javax.servlet.http.Cookie;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import javax.servlet.http.Part;
+import java.io.*;
import java.net.URL;
import java.net.URLConnection;
-import java.sql.Connection;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import java.util.ArrayList;
import java.util.UUID;
-import javax.servlet.http.Cookie;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-import javax.servlet.http.Part;
/**
*