aboutsummaryrefslogtreecommitdiff
path: root/juick-www/src/main/java/com/juick/www
diff options
context:
space:
mode:
authorGravatar Vitaly Takmazov2016-07-12 17:39:33 +0300
committerGravatar Vitaly Takmazov2016-07-12 17:39:33 +0300
commitbdbf65e0a50758bfcc88e1cc9c501eeed4e7e45d (patch)
tree756e8b29b2442c82ae50a3548c772f4a65b6d1ef /juick-www/src/main/java/com/juick/www
parent291da35b1bf7dcd66bf621160f907872fd0f7825 (diff)
jackson-databind WIP
Diffstat (limited to 'juick-www/src/main/java/com/juick/www')
-rw-r--r--juick-www/src/main/java/com/juick/www/Discover.java10
-rw-r--r--juick-www/src/main/java/com/juick/www/NewMessage.java4
-rw-r--r--juick-www/src/main/java/com/juick/www/PageTemplates.java4
-rw-r--r--juick-www/src/main/java/com/juick/www/User.java19
4 files changed, 21 insertions, 16 deletions
diff --git a/juick-www/src/main/java/com/juick/www/Discover.java b/juick-www/src/main/java/com/juick/www/Discover.java
index 240d0fdd..e94d6e99 100644
--- a/juick-www/src/main/java/com/juick/www/Discover.java
+++ b/juick-www/src/main/java/com/juick/www/Discover.java
@@ -47,14 +47,14 @@ public class Discover {
return;
} else if (paramTag.SynonymID > 0 && paramTag.TID != paramTag.SynonymID) {
com.juick.Tag synTag = TagQueries.getTag(sql, paramTag.SynonymID);
- String url = "/tag/" + URLEncoder.encode(synTag.Name, "UTF-8");
+ String url = "/tag/" + URLEncoder.encode(synTag.getName(), "UTF-8");
if (request.getQueryString() != null) {
url += "?" + request.getQueryString();
}
Utils.sendPermanentRedirect(response, url);
return;
- } else if (!paramTag.Name.equals(paramTagStr)) {
- String url = "/tag/" + URLEncoder.encode(paramTag.Name, "UTF-8");
+ } else if (!paramTag.getName().equals(paramTagStr)) {
+ String url = "/tag/" + URLEncoder.encode(paramTag.getName(), "UTF-8");
if (request.getQueryString() != null) {
url += "?" + request.getQueryString();
}
@@ -73,7 +73,7 @@ public class Discover {
int visitor_uid = visitor.getUID();
- String title = "*" + Utils.encodeHTML(paramTag.Name);
+ String title = "*" + Utils.encodeHTML(paramTag.getName());
List<Integer> mids = MessagesQueries.getTag(sql, paramTag.TID, visitor_uid, paramBefore, (visitor_uid == 0) ? 40 : 20);
response.setContentType("text/html; charset=UTF-8");
@@ -104,7 +104,7 @@ public class Discover {
}
if (mids.size() >= 20) {
- String nextpage = "/tag/" + URLEncoder.encode(paramTag.Name, "UTF-8") + "?before=" + mids.get(mids.size() - 1);
+ String nextpage = "/tag/" + URLEncoder.encode(paramTag.getName(), "UTF-8") + "?before=" + mids.get(mids.size() - 1);
out.println("<p class=\"page\"><a href=\"" + nextpage + "\" rel=\"prev\">Читать дальше →</a></p>");
}
diff --git a/juick-www/src/main/java/com/juick/www/NewMessage.java b/juick-www/src/main/java/com/juick/www/NewMessage.java
index 397badbb..bb169b60 100644
--- a/juick-www/src/main/java/com/juick/www/NewMessage.java
+++ b/juick-www/src/main/java/com/juick/www/NewMessage.java
@@ -113,7 +113,9 @@ public class NewMessage {
}
String taglink = "";
try {
- taglink = "<a onclick=\"return addTag('" + Utils.encodeHTML(tags.get(i).Name) + "')\" href=\"/" + visitor.getUName() + "/?tag=" + URLEncoder.encode(tags.get(i).Name, "utf-8") + "\" title=\"" + tags.get(i).UsageCnt + "\">" + Utils.encodeHTML(tags.get(i).Name) + "</a>";
+ taglink = "<a onclick=\"return addTag('" + Utils.encodeHTML(tags.get(i).getName()) + "')\" href=\"/" +
+ visitor.getUName() + "/?tag=" + URLEncoder.encode(tags.get(i).getName(), "utf-8") +
+ "\" title=\"" + tags.get(i).UsageCnt + "\">" + Utils.encodeHTML(tags.get(i).getName()) + "</a>";
} catch (UnsupportedEncodingException e) {
}
int usagecnt = tags.get(i).UsageCnt;
diff --git a/juick-www/src/main/java/com/juick/www/PageTemplates.java b/juick-www/src/main/java/com/juick/www/PageTemplates.java
index 0bb17ff0..c570ae7f 100644
--- a/juick-www/src/main/java/com/juick/www/PageTemplates.java
+++ b/juick-www/src/main/java/com/juick/www/PageTemplates.java
@@ -191,9 +191,9 @@ public class PageTemplates {
public static String formatTags(List<Tag> tags) {
String ret = "";
for (Tag tag : tags) {
- String tagName = tag.Name.replaceAll("<", "&lt;").replaceAll(">", "&gt;");
+ String tagName = tag.getName().replaceAll("<", "&lt;").replaceAll(">", "&gt;");
try {
- ret += " *<a href=\"/tag/" + URLEncoder.encode(tag.Name, "utf-8") + "\"";
+ ret += " *<a href=\"/tag/" + URLEncoder.encode(tag.getName(), "utf-8") + "\"";
if (tag.UsageCnt < 2) {
ret += " rel=\"nofollow\"";
}
diff --git a/juick-www/src/main/java/com/juick/www/User.java b/juick-www/src/main/java/com/juick/www/User.java
index ce2a5826..0d0056ad 100644
--- a/juick-www/src/main/java/com/juick/www/User.java
+++ b/juick-www/src/main/java/com/juick/www/User.java
@@ -55,8 +55,8 @@ public class User {
if (paramTag == null) {
Errors.doGet404(sql, request, response);
return;
- } else if (!paramTag.Name.equals(paramTagStr)) {
- String url = "/" + user.getUName() + "/?tag=" + URLEncoder.encode(paramTag.Name, "UTF-8");
+ } else if (!paramTag.getName().equals(paramTagStr)) {
+ String url = "/" + user.getUName() + "/?tag=" + URLEncoder.encode(paramTag.getName(), "UTF-8");
Utils.sendPermanentRedirect(response, url);
return;
}
@@ -88,7 +88,7 @@ public class User {
String title;
if (paramShow == null) {
if (paramTag != null) {
- title = "Блог " + user.getUName() + ": *" + Utils.encodeHTML(paramTag.Name);
+ title = "Блог " + user.getUName() + ": *" + Utils.encodeHTML(paramTag.getName());
mids = MessagesQueries.getUserTag(sql, user.getUID(), paramTag.TID, privacy, paramBefore);
} else if (paramSearch != null) {
title = "Блог " + user.getUName() + ": " + Utils.encodeHTML(paramSearch);
@@ -114,7 +114,8 @@ public class User {
response.setContentType("text/html; charset=UTF-8");
try (PrintWriter out = response.getWriter()) {
- String head = "<link rel=\"alternate\" type=\"application/rss+xml\" title=\"@" + user.getUName() + "\" href=\"//rss.juick.com/" + user.getUName() + "/blog\"/>";
+ String head = "<link rel=\"alternate\" type=\"application/rss+xml\" title=\"@" +
+ user.getUName() + "\" href=\"//rss.juick.com/" + user.getUName() + "/blog\"/>";
if (paramTag != null && TagQueries.getTagNoIndex(sql, paramTag.TID)) {
head += "<meta name=\"robots\" content=\"noindex,nofollow\"/>";
} else if (paramBefore > 0 || paramShow != null) {
@@ -128,7 +129,9 @@ public class User {
out.println("<section id=\"content\">");
if (paramTag != null) {
- out.println("<p class=\"page\"><a href=\"/tag/" + URLEncoder.encode(paramTag.Name, "UTF-8") + "\">← Все записи с тегом <b>" + Utils.encodeHTML(paramTag.Name) + "</b></a></p>");
+ out.println("<p class=\"page\"><a href=\"/tag/" +
+ URLEncoder.encode(paramTag.getName(), "UTF-8") + "\">← Все записи с тегом <b>" +
+ Utils.encodeHTML(paramTag.getName()) + "</b></a></p>");
}
PageTemplates.printMessages(out, sql, user, mids, visitor, visitor.getUID() == 0 ? 4 : 5, 0);
@@ -139,7 +142,7 @@ public class User {
nextpage += "&amp;show=" + paramShow;
}
if (paramTag != null) {
- nextpage += "&amp;tag=" + URLEncoder.encode(paramTag.Name, "UTF-8");
+ nextpage += "&amp;tag=" + URLEncoder.encode(paramTag.getName(), "UTF-8");
}
if (paramSearch != null) {
nextpage += "&amp;search=" + URLEncoder.encode(paramSearch, "UTF-8");
@@ -323,9 +326,9 @@ public class User {
String ret = "";
int count = cnt > 0 ? Math.min(tags.size(), cnt) : tags.size();
for (int i = 0; i < count; i++) {
- String tag = Utils.encodeHTML(tags.get(i).Name);
+ String tag = Utils.encodeHTML(tags.get(i).getName());
try {
- tag = "<a href=\"./?tag=" + URLEncoder.encode(tags.get(i).Name, "UTF-8") + "\" title=\""
+ tag = "<a href=\"./?tag=" + URLEncoder.encode(tags.get(i).getName(), "UTF-8") + "\" title=\""
+ tags.get(i).UsageCnt + "\" rel=\"nofollow\">" + tag + "</a>";
} catch (UnsupportedEncodingException e) {
}