diff options
author | Vitaly Takmazov | 2016-12-16 15:41:14 +0300 |
---|---|---|
committer | Vitaly Takmazov | 2016-12-16 15:41:14 +0300 |
commit | 300a0439b2a6e26d9025247ef780c886616d4ae1 (patch) | |
tree | bcdb7613c2c5f37b870cbe18241894dba9428fae /juick-spring-www/src/main/java/com/juick/www/controllers | |
parent | 18a8595d2150edc92084c94b9dbb8f4309d3ed36 (diff) |
CharEncoding.UTF_8
Diffstat (limited to 'juick-spring-www/src/main/java/com/juick/www/controllers')
-rw-r--r-- | juick-spring-www/src/main/java/com/juick/www/controllers/IndexController.java | 3 | ||||
-rw-r--r-- | juick-spring-www/src/main/java/com/juick/www/controllers/TagController.java | 7 |
2 files changed, 6 insertions, 4 deletions
diff --git a/juick-spring-www/src/main/java/com/juick/www/controllers/IndexController.java b/juick-spring-www/src/main/java/com/juick/www/controllers/IndexController.java index ffc64221..54d83b61 100644 --- a/juick-spring-www/src/main/java/com/juick/www/controllers/IndexController.java +++ b/juick-spring-www/src/main/java/com/juick/www/controllers/IndexController.java @@ -7,6 +7,7 @@ import com.juick.service.TagService; import com.juick.service.UserService; import com.juick.util.UserUtils; import com.juick.www.util.EncodeUtils; +import org.apache.commons.lang3.CharEncoding; import org.apache.commons.lang3.StringEscapeUtils; import org.apache.commons.lang3.StringUtils; import org.springframework.context.MessageSource; @@ -48,7 +49,7 @@ public class IndexController { ModelMap model) throws IOException { if (paramTagStr.isPresent()) - return "redirect:/tag/" + URLEncoder.encode(paramTagStr.get(), "UTF-8"); + return "redirect:/tag/" + URLEncoder.encode(paramTagStr.get(), CharEncoding.UTF_8); if (StringUtils.isNotEmpty(paramSearch) && paramSearch.length() > 64) paramSearch = ""; diff --git a/juick-spring-www/src/main/java/com/juick/www/controllers/TagController.java b/juick-spring-www/src/main/java/com/juick/www/controllers/TagController.java index 69688513..8c4ab46d 100644 --- a/juick-spring-www/src/main/java/com/juick/www/controllers/TagController.java +++ b/juick-spring-www/src/main/java/com/juick/www/controllers/TagController.java @@ -9,6 +9,7 @@ import com.juick.service.TagService; import com.juick.service.UserService; import com.juick.util.UserUtils; import com.juick.www.helpers.QueryString; +import org.apache.commons.lang3.CharEncoding; import org.apache.commons.lang3.StringEscapeUtils; import org.springframework.stereotype.Controller; import org.springframework.ui.ModelMap; @@ -51,13 +52,13 @@ public class TagController { throw new HttpNotFoundException(); } else if (paramTag.SynonymID > 0 && paramTag.TID != paramTag.SynonymID) { com.juick.Tag synTag = tagService.getTag(paramTag.SynonymID); - String url = "/tag/" + URLEncoder.encode(synTag.getName(), "UTF-8"); + String url = "/tag/" + URLEncoder.encode(synTag.getName(), CharEncoding.UTF_8); if (queryString.isPresent()) { url += "?" + queryString.get(); } return "redirect:" + url; } else if (!paramTag.getName().equals(paramTagStr)) { - String url = "/tag/" + URLEncoder.encode(paramTag.getName(), "UTF-8"); + String url = "/tag/" + URLEncoder.encode(paramTag.getName(), CharEncoding.UTF_8); if (queryString.isPresent()) { url += "?" + queryString.get(); } @@ -97,7 +98,7 @@ public class TagController { }).collect(Collectors.toList()) ); if (mids.size() >= 20) { - String nextpage = "/tag/" + URLEncoder.encode(paramTag.getName(), "UTF-8") + "?before=" + mids.get(mids.size() - 1); + String nextpage = "/tag/" + URLEncoder.encode(paramTag.getName(), CharEncoding.UTF_8) + "?before=" + mids.get(mids.size() - 1); model.addAttribute("nextpage", nextpage); } model.addAttribute("tags", tagService.getPopularTags()); |