Commit 9182d8ec authored by Liang Ding's avatar Liang Ding

Fix #12409

parent e13ec102
...@@ -51,7 +51,6 @@ import javax.servlet.http.Cookie; ...@@ -51,7 +51,6 @@ import javax.servlet.http.Cookie;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession; import javax.servlet.http.HttpSession;
import javax.servlet.http.HttpSessionEvent; import javax.servlet.http.HttpSessionEvent;
import java.util.ResourceBundle;
import java.util.Set; import java.util.Set;
import java.util.concurrent.locks.Lock; import java.util.concurrent.locks.Lock;
import java.util.concurrent.locks.ReentrantLock; import java.util.concurrent.locks.ReentrantLock;
...@@ -60,43 +59,20 @@ import java.util.concurrent.locks.ReentrantLock; ...@@ -60,43 +59,20 @@ import java.util.concurrent.locks.ReentrantLock;
* Solo Servlet listener. * Solo Servlet listener.
* *
* @author <a href="http://88250.b3log.org">Liang Ding</a> * @author <a href="http://88250.b3log.org">Liang Ding</a>
* @version 1.9.3.29, Mar 6, 2018 * @version 1.9.3.30, Mar 11, 2018
* @since 0.3.1 * @since 0.3.1
*/ */
public final class SoloServletListener extends AbstractServletListener { public final class SoloServletListener extends AbstractServletListener {
/**
* Solo version.
*/
public static final String VERSION = "2.7.0";
/**
* B3log Rhythm address.
*/
public static final String B3LOG_RHYTHM_SERVE_PATH;
/**
* B3log Symphony address.
*/
public static final String B3LOG_SYMPHONY_SERVE_PATH;
/**
* Favicon API.
*/
public static final String FAVICON_API;
/** /**
* Logger. * Logger.
*/ */
private static final Logger LOGGER = Logger.getLogger(SoloServletListener.class); private static final Logger LOGGER = Logger.getLogger(SoloServletListener.class);
static { /**
final ResourceBundle b3log = ResourceBundle.getBundle("b3log"); * Solo version.
*/
B3LOG_RHYTHM_SERVE_PATH = b3log.getString("rhythm.servePath"); public static final String VERSION = "2.7.0";
B3LOG_SYMPHONY_SERVE_PATH = b3log.getString("symphony.servePath");
FAVICON_API = b3log.getString("faviconAPI");
}
/** /**
* Bean manager. * Bean manager.
......
...@@ -35,6 +35,7 @@ import org.b3log.solo.model.Article; ...@@ -35,6 +35,7 @@ import org.b3log.solo.model.Article;
import org.b3log.solo.model.Common; import org.b3log.solo.model.Common;
import org.b3log.solo.model.Option; import org.b3log.solo.model.Option;
import org.b3log.solo.service.PreferenceQueryService; import org.b3log.solo.service.PreferenceQueryService;
import org.b3log.solo.util.Solos;
import org.json.JSONObject; import org.json.JSONObject;
import java.net.MalformedURLException; import java.net.MalformedURLException;
...@@ -49,7 +50,7 @@ import java.util.Date; ...@@ -49,7 +50,7 @@ import java.util.Date;
* *
* @author <a href="http://88250.b3log.org">Liang Ding</a> * @author <a href="http://88250.b3log.org">Liang Ding</a>
* @author ArmstrongCN * @author ArmstrongCN
* @version 1.0.2.11, Oct 24, 2017 * @version 1.0.2.12, Mar 11, 2018
* @since 0.3.1 * @since 0.3.1
*/ */
public final class ArticleSender extends AbstractEventListener<JSONObject> { public final class ArticleSender extends AbstractEventListener<JSONObject> {
...@@ -66,7 +67,7 @@ public final class ArticleSender extends AbstractEventListener<JSONObject> { ...@@ -66,7 +67,7 @@ public final class ArticleSender extends AbstractEventListener<JSONObject> {
static { static {
try { try {
ADD_ARTICLE_URL = new URL(SoloServletListener.B3LOG_RHYTHM_SERVE_PATH + "/article"); ADD_ARTICLE_URL = new URL(Solos.B3LOG_RHYTHM_SERVE_PATH + "/article");
} catch (final MalformedURLException e) { } catch (final MalformedURLException e) {
LOGGER.log(Level.ERROR, "Creates remote service address[rhythm add article] error!"); LOGGER.log(Level.ERROR, "Creates remote service address[rhythm add article] error!");
throw new IllegalStateException(e); throw new IllegalStateException(e);
......
...@@ -35,6 +35,7 @@ import org.b3log.solo.model.Article; ...@@ -35,6 +35,7 @@ import org.b3log.solo.model.Article;
import org.b3log.solo.model.Common; import org.b3log.solo.model.Common;
import org.b3log.solo.model.Option; import org.b3log.solo.model.Option;
import org.b3log.solo.service.PreferenceQueryService; import org.b3log.solo.service.PreferenceQueryService;
import org.b3log.solo.util.Solos;
import org.json.JSONObject; import org.json.JSONObject;
import java.net.MalformedURLException; import java.net.MalformedURLException;
...@@ -48,7 +49,7 @@ import java.util.Date; ...@@ -48,7 +49,7 @@ import java.util.Date;
* </p> * </p>
* *
* @author <a href="http://88250.b3log.org">Liang Ding</a> * @author <a href="http://88250.b3log.org">Liang Ding</a>
* @version 1.0.1.1, Oct 24, 2017 * @version 1.0.1.2, Mar 11, 2018
* @since 0.6.0 * @since 0.6.0
*/ */
public final class ArticleUpdater extends AbstractEventListener<JSONObject> { public final class ArticleUpdater extends AbstractEventListener<JSONObject> {
...@@ -65,7 +66,7 @@ public final class ArticleUpdater extends AbstractEventListener<JSONObject> { ...@@ -65,7 +66,7 @@ public final class ArticleUpdater extends AbstractEventListener<JSONObject> {
static { static {
try { try {
UPDATE_ARTICLE_URL = new URL(SoloServletListener.B3LOG_RHYTHM_SERVE_PATH + "/article"); UPDATE_ARTICLE_URL = new URL(Solos.B3LOG_RHYTHM_SERVE_PATH + "/article");
} catch (final MalformedURLException e) { } catch (final MalformedURLException e) {
LOGGER.log(Level.ERROR, "Creates remote service address[rhythm update article] error!"); LOGGER.log(Level.ERROR, "Creates remote service address[rhythm update article] error!");
throw new IllegalStateException(e); throw new IllegalStateException(e);
......
...@@ -15,7 +15,6 @@ ...@@ -15,7 +15,6 @@
*/ */
package org.b3log.solo.event.symphony; package org.b3log.solo.event.symphony;
import org.b3log.latke.Keys; import org.b3log.latke.Keys;
import org.b3log.latke.Latkes; import org.b3log.latke.Latkes;
import org.b3log.latke.event.AbstractEventListener; import org.b3log.latke.event.AbstractEventListener;
...@@ -35,17 +34,17 @@ import org.b3log.solo.event.rhythm.ArticleSender; ...@@ -35,17 +34,17 @@ import org.b3log.solo.event.rhythm.ArticleSender;
import org.b3log.solo.model.Comment; import org.b3log.solo.model.Comment;
import org.b3log.solo.model.Option; import org.b3log.solo.model.Option;
import org.b3log.solo.service.PreferenceQueryService; import org.b3log.solo.service.PreferenceQueryService;
import org.b3log.solo.util.Solos;
import org.json.JSONObject; import org.json.JSONObject;
import java.net.MalformedURLException; import java.net.MalformedURLException;
import java.net.URL; import java.net.URL;
/** /**
* This listener is responsible for sending comment to B3log Symphony. * This listener is responsible for sending comment to B3log Symphony.
* *
* @author <a href="http://88250.b3log.org">Liang Ding</a> * @author <a href="http://88250.b3log.org">Liang Ding</a>
* @version 1.0.1.0, Sep 6, 2017 * @version 1.0.1.1, Mar 11, 2018
* @since 0.5.5 * @since 0.5.5
*/ */
public final class CommentSender extends AbstractEventListener<JSONObject> { public final class CommentSender extends AbstractEventListener<JSONObject> {
...@@ -67,7 +66,7 @@ public final class CommentSender extends AbstractEventListener<JSONObject> { ...@@ -67,7 +66,7 @@ public final class CommentSender extends AbstractEventListener<JSONObject> {
static { static {
try { try {
ADD_COMMENT_URL = new URL(SoloServletListener.B3LOG_SYMPHONY_SERVE_PATH + "/solo/comment"); ADD_COMMENT_URL = new URL(Solos.B3LOG_SYMPHONY_SERVE_PATH + "/solo/comment");
} catch (final MalformedURLException e) { } catch (final MalformedURLException e) {
LOGGER.log(Level.ERROR, "Creates remote service address[symphony add comment] error!"); LOGGER.log(Level.ERROR, "Creates remote service address[symphony add comment] error!");
throw new IllegalStateException(e); throw new IllegalStateException(e);
......
...@@ -36,6 +36,7 @@ import org.b3log.solo.model.Article; ...@@ -36,6 +36,7 @@ import org.b3log.solo.model.Article;
import org.b3log.solo.model.Option; import org.b3log.solo.model.Option;
import org.b3log.solo.model.Tag; import org.b3log.solo.model.Tag;
import org.b3log.solo.service.*; import org.b3log.solo.service.*;
import org.b3log.solo.util.Solos;
import org.json.JSONArray; import org.json.JSONArray;
import org.json.JSONObject; import org.json.JSONObject;
...@@ -50,7 +51,7 @@ import java.util.Set; ...@@ -50,7 +51,7 @@ import java.util.Set;
* Blog processor. * Blog processor.
* *
* @author <a href="http://88250.b3log.org">Liang Ding</a> * @author <a href="http://88250.b3log.org">Liang Ding</a>
* @version 1.3.1.0, Nov 15, 2017 * @version 1.3.1.1, Mar 11, 2018
* @since 0.4.6 * @since 0.4.6
*/ */
@RequestProcessor @RequestProcessor
...@@ -172,7 +173,7 @@ public class BlogProcessor { ...@@ -172,7 +173,7 @@ public class BlogProcessor {
} }
final HTTPRequest httpRequest = new HTTPRequest(); final HTTPRequest httpRequest = new HTTPRequest();
httpRequest.setURL(new URL(SoloServletListener.B3LOG_SYMPHONY_SERVE_PATH + "/apis/user")); httpRequest.setURL(new URL(Solos.B3LOG_SYMPHONY_SERVE_PATH + "/apis/user"));
httpRequest.setRequestMethod(HTTPRequestMethod.POST); httpRequest.setRequestMethod(HTTPRequestMethod.POST);
final JSONObject requestJSONObject = new JSONObject(); final JSONObject requestJSONObject = new JSONObject();
......
...@@ -43,6 +43,7 @@ import org.b3log.solo.repository.*; ...@@ -43,6 +43,7 @@ import org.b3log.solo.repository.*;
import org.b3log.solo.service.*; import org.b3log.solo.service.*;
import org.b3log.solo.util.Emotions; import org.b3log.solo.util.Emotions;
import org.b3log.solo.util.Markdowns; import org.b3log.solo.util.Markdowns;
import org.b3log.solo.util.Solos;
import org.b3log.solo.util.Thumbnails; import org.b3log.solo.util.Thumbnails;
import org.b3log.solo.util.comparator.Comparators; import org.b3log.solo.util.comparator.Comparators;
import org.json.JSONArray; import org.json.JSONArray;
...@@ -62,7 +63,7 @@ import static org.b3log.solo.model.Article.ARTICLE_CONTENT; ...@@ -62,7 +63,7 @@ import static org.b3log.solo.model.Article.ARTICLE_CONTENT;
* *
* @author <a href="http://88250.b3log.org">Liang Ding</a> * @author <a href="http://88250.b3log.org">Liang Ding</a>
* @author <a href="http://vanessa.b3log.org">Liyuan Li</a> * @author <a href="http://vanessa.b3log.org">Liyuan Li</a>
* @version 1.6.16.0, Mar 8, 2017 * @version 1.6.16.1, Mar 11, 2018
* @since 0.3.1 * @since 0.3.1
*/ */
@Service @Service
...@@ -690,7 +691,7 @@ public class Filler { ...@@ -690,7 +691,7 @@ public class Filler {
dataModel.put(Common.YEAR, String.valueOf(Calendar.getInstance().get(Calendar.YEAR))); dataModel.put(Common.YEAR, String.valueOf(Calendar.getInstance().get(Calendar.YEAR)));
dataModel.put(Common.IS_LOGGED_IN, null != userQueryService.getCurrentUser(request)); dataModel.put(Common.IS_LOGGED_IN, null != userQueryService.getCurrentUser(request));
dataModel.put(Common.FAVICON_API, SoloServletListener.FAVICON_API); dataModel.put(Common.FAVICON_API, Solos.FAVICON_API);
final String noticeBoard = preference.getString(Option.ID_C_NOTICE_BOARD); final String noticeBoard = preference.getString(Option.ID_C_NOTICE_BOARD);
......
...@@ -58,7 +58,7 @@ import java.util.Set; ...@@ -58,7 +58,7 @@ import java.util.Set;
* Solo initialization service. * Solo initialization service.
* *
* @author <a href="http://88250.b3log.org">Liang Ding</a> * @author <a href="http://88250.b3log.org">Liang Ding</a>
* @version 1.5.2.17, Feb 27, 2018 * @version 1.5.2.18, Mar 11, 2018
* @since 0.4.0 * @since 0.4.0
*/ */
@Service @Service
...@@ -319,7 +319,7 @@ public class InitService { ...@@ -319,7 +319,7 @@ public class InitService {
comment.put(Comment.COMMENT_CONTENT, langPropsService.get("helloWorld.comment.content")); comment.put(Comment.COMMENT_CONTENT, langPropsService.get("helloWorld.comment.content"));
comment.put(Comment.COMMENT_ORIGINAL_COMMENT_ID, ""); comment.put(Comment.COMMENT_ORIGINAL_COMMENT_ID, "");
comment.put(Comment.COMMENT_ORIGINAL_COMMENT_NAME, ""); comment.put(Comment.COMMENT_ORIGINAL_COMMENT_NAME, "");
comment.put(Comment.COMMENT_THUMBNAIL_URL, Thumbnails.GRAVATAR + "59a5e8209c780307dbe9c9ba728073f5??s=60&r=G"); comment.put(Comment.COMMENT_THUMBNAIL_URL, Solos.GRAVATAR + "59a5e8209c780307dbe9c9ba728073f5??s=60&r=G");
comment.put(Comment.COMMENT_DATE, date); comment.put(Comment.COMMENT_DATE, date);
comment.put(Comment.COMMENT_ON_ID, articleId); comment.put(Comment.COMMENT_ON_ID, articleId);
comment.put(Comment.COMMENT_ON_TYPE, Article.ARTICLE); comment.put(Comment.COMMENT_ON_TYPE, Article.ARTICLE);
......
/*
* Copyright (c) 2010-2018, b3log.org & hacpai.com
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.b3log.solo.util;
import java.util.MissingResourceException;
import java.util.ResourceBundle;
/**
* Solo utilities.
*
* @author <a href="http://88250.b3log.org">Liang Ding</a>
* @version 1.0.0.0, Mar 11, 2018
* @since 2.8.0
*/
public final class Solos {
/**
* B3log Rhythm address.
*/
public static final String B3LOG_RHYTHM_SERVE_PATH;
/**
* B3log Symphony address.
*/
public static final String B3LOG_SYMPHONY_SERVE_PATH;
/**
* Favicon API.
*/
public static final String FAVICON_API;
/**
* Gravatar address.
*/
public static final String GRAVATAR;
/**
* Local file upload dir path.
*/
public static final String UPLOAD_DIR_PATH;
static {
ResourceBundle solo;
try {
solo = ResourceBundle.getBundle("solo");
} catch (final MissingResourceException e) {
solo = ResourceBundle.getBundle("b3log"); // 2.8.0 向后兼容
}
B3LOG_RHYTHM_SERVE_PATH = solo.getString("rhythm.servePath");
B3LOG_SYMPHONY_SERVE_PATH = solo.getString("symphony.servePath");
FAVICON_API = solo.getString("faviconAPI");
GRAVATAR = solo.getString("gravatar");
UPLOAD_DIR_PATH = solo.getString("uploadDir");
}
/**
* Private constructor.
*/
private Solos() {
}
}
...@@ -17,8 +17,6 @@ package org.b3log.solo.util; ...@@ -17,8 +17,6 @@ package org.b3log.solo.util;
import org.b3log.latke.util.MD5; import org.b3log.latke.util.MD5;
import java.util.ResourceBundle;
/** /**
* Thumbnail utilities. * Thumbnail utilities.
* <p> * <p>
...@@ -26,22 +24,11 @@ import java.util.ResourceBundle; ...@@ -26,22 +24,11 @@ import java.util.ResourceBundle;
* </p> * </p>
* *
* @author <a href="http://88250.b3log.org">Liang Ding</a> * @author <a href="http://88250.b3log.org">Liang Ding</a>
* @version 1.1.0.0, May 19, 2015 * @version 1.1.0.1, Mar 11, 2018
* @since 0.6.1 * @since 0.6.1
*/ */
public final class Thumbnails { public final class Thumbnails {
/**
* Gravatar address.
*/
public static final String GRAVATAR;
static {
final ResourceBundle b3log = ResourceBundle.getBundle("b3log");
GRAVATAR = b3log.getString("gravatar");
}
/** /**
* Gets the Gravatar URL for the specified email with the specified size. * Gets the Gravatar URL for the specified email with the specified size.
* *
...@@ -50,7 +37,7 @@ public final class Thumbnails { ...@@ -50,7 +37,7 @@ public final class Thumbnails {
* @return the Gravatar URL * @return the Gravatar URL
*/ */
public static String getGravatarURL(final String email, final String size) { public static String getGravatarURL(final String email, final String size) {
return Thumbnails.GRAVATAR + MD5.hash(email) + "?s=" + size; return Solos.GRAVATAR + MD5.hash(email) + "?s=" + size;
} }
/** /**
......
...@@ -15,8 +15,8 @@ ...@@ -15,8 +15,8 @@
# #
# #
# Description: B3log configurations. # Description: Solo configurations.
# Version: 2.2.0.1, Jul 25, 2017 # Version: 2.3.0.0, Mar 11, 2018
# Author: Liang Ding # Author: Liang Ding
# #
...@@ -24,4 +24,5 @@ rhythm.servePath=http://rhythm.b3log.org:80 ...@@ -24,4 +24,5 @@ rhythm.servePath=http://rhythm.b3log.org:80
symphony.servePath=https://hacpai.com:443 symphony.servePath=https://hacpai.com:443
gravatar=https://secure.gravatar.com/avatar/ gravatar=https://secure.gravatar.com/avatar/
faviconAPI=https://api.byi.pw/favicon?url= faviconAPI=https://api.byi.pw/favicon?url=
\ No newline at end of file uploadDir=
\ No newline at end of file
...@@ -25,7 +25,7 @@ import java.util.Locale; ...@@ -25,7 +25,7 @@ import java.util.Locale;
* {@link org.b3log.solo.util.Thumbnails} test case. * {@link org.b3log.solo.util.Thumbnails} test case.
* *
* @author <a href="http://88250.b3log.org">Liang Ding</a> * @author <a href="http://88250.b3log.org">Liang Ding</a>
* @version 1.0.0.0, Jul 29, 2013 * @version 1.0.0.1, Mar 11, 2018
* @since 0.6.1 * @since 0.6.1
*/ */
public final class ThumbnailsTestCase { public final class ThumbnailsTestCase {
...@@ -42,6 +42,6 @@ public final class ThumbnailsTestCase { ...@@ -42,6 +42,6 @@ public final class ThumbnailsTestCase {
final String gravatarURL = Thumbnails.getGravatarURL("test@b3log.org", "128"); final String gravatarURL = Thumbnails.getGravatarURL("test@b3log.org", "128");
Assert.assertEquals(gravatarURL, Thumbnails.GRAVATAR + "bd7e4673cf7fa4b4777353008c86e093?s=128"); Assert.assertEquals(gravatarURL, Solos.GRAVATAR + "bd7e4673cf7fa4b4777353008c86e093?s=128");
} }
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment