Commit 32cef8b2 authored by Liang Ding's avatar Liang Ding

#12401

parent ba23e796
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<!-- <!--
Description: Solo POM. Description: Solo POM.
Version: 3.18.2.54, Feb 13, 2018 Version: 3.18.2.55, Mar 3, 2018
Author: <a href="http://88250.b3log.org">Liang Ding</a> Author: <a href="http://88250.b3log.org">Liang Ding</a>
Author: <a href="http://www.annpeter.cn">Ann Peter</a> Author: <a href="http://www.annpeter.cn">Ann Peter</a>
Author: <a href="http://vanessa.b3log.org">Vanessa</a> Author: <a href="http://vanessa.b3log.org">Vanessa</a>
...@@ -76,7 +76,7 @@ ...@@ -76,7 +76,7 @@
<properties> <properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<org.b3log.latke.version>2.3.17</org.b3log.latke.version> <org.b3log.latke.version>2.3.19</org.b3log.latke.version>
<servlet.version>3.1.0</servlet.version> <servlet.version>3.1.0</servlet.version>
<slf4j.version>1.7.5</slf4j.version> <slf4j.version>1.7.5</slf4j.version>
......
...@@ -44,7 +44,7 @@ import javax.servlet.http.HttpServletResponse; ...@@ -44,7 +44,7 @@ import javax.servlet.http.HttpServletResponse;
* Plugin console request processing. * Plugin console request processing.
* *
* @author <a href="http://88250.b3log.org">Liang Ding</a> * @author <a href="http://88250.b3log.org">Liang Ding</a>
* @version 1.0.0.3, Sep 21, 2017 * @version 1.0.0.4, Mar 3, 2018
* @since 0.4.0 * @since 0.4.0
*/ */
@RequestProcessor @RequestProcessor
...@@ -91,27 +91,29 @@ public class PageConsole { ...@@ -91,27 +91,29 @@ public class PageConsole {
* </pre> * </pre>
* </p> * </p>
* *
* @param request the specified http servlet request, for example, * @param request the specified http servlet request, for example,
* { * {
* "page": { * "page": {
* "oId": "", * "oId": "",
* "pageTitle": "", * "pageTitle": "",
* "pageContent": "", * "pageContent": "",
* "pageOrder": int, * "pageOrder": int,
* "pageCommentCount": int, * "pageCommentCount": int,
* "pagePermalink": "", * "pagePermalink": "",
* "pageCommentable": boolean, * "pageCommentable": boolean,
* "pageType": "", * "pageType": "",
* "pageOpenTarget": "", * "pageOpenTarget": "",
* "pageIcon": "" * "pageIcon": ""
* } * }
* }, see {@link org.b3log.solo.model.Page} for more details * }, see {@link org.b3log.solo.model.Page} for more details
* @param response the specified http servlet response * @param response the specified http servlet response
* @param context the specified http request context * @param context the specified http request context
* @param requestJSONObject the specified reuqest json object
* @throws Exception exception * @throws Exception exception
*/ */
@RequestProcessing(value = "/console/page/", method = HTTPRequestMethod.PUT) @RequestProcessing(value = "/console/page/", method = HTTPRequestMethod.PUT)
public void updatePage(final HttpServletRequest request, final HttpServletResponse response, final HTTPRequestContext context) public void updatePage(final HttpServletRequest request, final HttpServletResponse response, final HTTPRequestContext context,
final JSONObject requestJSONObject)
throws Exception { throws Exception {
if (!userQueryService.isAdminLoggedIn(request)) { if (!userQueryService.isAdminLoggedIn(request)) {
response.sendError(HttpServletResponse.SC_FORBIDDEN); response.sendError(HttpServletResponse.SC_FORBIDDEN);
...@@ -125,8 +127,6 @@ public class PageConsole { ...@@ -125,8 +127,6 @@ public class PageConsole {
final JSONObject ret = new JSONObject(); final JSONObject ret = new JSONObject();
try { try {
final JSONObject requestJSONObject = Requests.parseRequestJSONObject(request, response);
pageMgmtService.updatePage(requestJSONObject); pageMgmtService.updatePage(requestJSONObject);
ret.put(Keys.STATUS_CODE, true); ret.put(Keys.STATUS_CODE, true);
...@@ -203,24 +203,26 @@ public class PageConsole { ...@@ -203,24 +203,26 @@ public class PageConsole {
* </pre> * </pre>
* </p> * </p>
* *
* @param context the specified http request context * @param context the specified http request context
* @param request the specified http servlet request, for example, * @param request the specified http servlet request, for example,
* { * {
* "page": { * "page": {
* "pageTitle": "", * "pageTitle": "",
* "pageContent": "", * "pageContent": "",
* "pagePermalink": "" // optional, * "pagePermalink": "" // optional,
* "pageCommentable": boolean, * "pageCommentable": boolean,
* "pageType": "", * "pageType": "",
* "pageOpenTarget": "", * "pageOpenTarget": "",
* "pageIcon": "" * "pageIcon": ""
* } * }
* }, see {@link org.b3log.solo.model.Page} for more details * }, see {@link org.b3log.solo.model.Page} for more details
* @param response the specified http servlet response * @param response the specified http servlet response
* @param requestJSONObject the specified request json object
* @throws Exception exception * @throws Exception exception
*/ */
@RequestProcessing(value = "/console/page/", method = HTTPRequestMethod.POST) @RequestProcessing(value = "/console/page/", method = HTTPRequestMethod.POST)
public void addPage(final HTTPRequestContext context, final HttpServletRequest request, final HttpServletResponse response) public void addPage(final HTTPRequestContext context, final HttpServletRequest request, final HttpServletResponse response,
final JSONObject requestJSONObject)
throws Exception { throws Exception {
if (!userQueryService.isAdminLoggedIn(request)) { if (!userQueryService.isAdminLoggedIn(request)) {
response.sendError(HttpServletResponse.SC_FORBIDDEN); response.sendError(HttpServletResponse.SC_FORBIDDEN);
...@@ -234,8 +236,6 @@ public class PageConsole { ...@@ -234,8 +236,6 @@ public class PageConsole {
final JSONObject ret = new JSONObject(); final JSONObject ret = new JSONObject();
try { try {
final JSONObject requestJSONObject = Requests.parseRequestJSONObject(request, response);
final String pageId = pageMgmtService.addPage(requestJSONObject); final String pageId = pageMgmtService.addPage(requestJSONObject);
ret.put(Keys.OBJECT_ID, pageId); ret.put(Keys.OBJECT_ID, pageId);
...@@ -265,17 +265,19 @@ public class PageConsole { ...@@ -265,17 +265,19 @@ public class PageConsole {
* </pre> * </pre>
* </p> * </p>
* *
* @param request the specified http servlet request, for example, * @param request the specified http servlet request, for example,
* { * {
* "oId": "", * "oId": "",
* "direction": "" // "up"/"down" * "direction": "" // "up"/"down"
* } * }
* @param response the specified http servlet response * @param response the specified http servlet response
* @param context the specified http request context * @param context the specified http request context
* @param requestJSONObject the specified request json object
* @throws Exception exception * @throws Exception exception
*/ */
@RequestProcessing(value = "/console/page/order/", method = HTTPRequestMethod.PUT) @RequestProcessing(value = "/console/page/order/", method = HTTPRequestMethod.PUT)
public void changeOrder(final HttpServletRequest request, final HttpServletResponse response, final HTTPRequestContext context) public void changeOrder(final HttpServletRequest request, final HttpServletResponse response, final HTTPRequestContext context,
final JSONObject requestJSONObject)
throws Exception { throws Exception {
if (!userQueryService.isAdminLoggedIn(request)) { if (!userQueryService.isAdminLoggedIn(request)) {
response.sendError(HttpServletResponse.SC_FORBIDDEN); response.sendError(HttpServletResponse.SC_FORBIDDEN);
...@@ -289,7 +291,6 @@ public class PageConsole { ...@@ -289,7 +291,6 @@ public class PageConsole {
final JSONObject ret = new JSONObject(); final JSONObject ret = new JSONObject();
try { try {
final JSONObject requestJSONObject = Requests.parseRequestJSONObject(request, response);
final String linkId = requestJSONObject.getString(Keys.OBJECT_ID); final String linkId = requestJSONObject.getString(Keys.OBJECT_ID);
final String direction = requestJSONObject.getString(Common.DIRECTION); final String direction = requestJSONObject.getString(Common.DIRECTION);
......
...@@ -27,7 +27,6 @@ import org.b3log.latke.servlet.HTTPRequestMethod; ...@@ -27,7 +27,6 @@ import org.b3log.latke.servlet.HTTPRequestMethod;
import org.b3log.latke.servlet.annotation.RequestProcessing; import org.b3log.latke.servlet.annotation.RequestProcessing;
import org.b3log.latke.servlet.annotation.RequestProcessor; import org.b3log.latke.servlet.annotation.RequestProcessor;
import org.b3log.latke.servlet.renderer.JSONRenderer; import org.b3log.latke.servlet.renderer.JSONRenderer;
import org.b3log.latke.util.Requests;
import org.b3log.solo.model.Option; import org.b3log.solo.model.Option;
import org.b3log.solo.model.Sign; import org.b3log.solo.model.Sign;
import org.b3log.solo.model.Skin; import org.b3log.solo.model.Skin;
...@@ -44,7 +43,7 @@ import javax.servlet.http.HttpServletResponse; ...@@ -44,7 +43,7 @@ import javax.servlet.http.HttpServletResponse;
* Preference console request processing. * Preference console request processing.
* *
* @author <a href="http://88250.b3log.org">Liang Ding</a> * @author <a href="http://88250.b3log.org">Liang Ding</a>
* @version 1.2.0.10, May 2, 2017 * @version 1.2.0.11, May 2, 2018
* @since 0.4.0 * @since 0.4.0
*/ */
@RequestProcessor @RequestProcessor
...@@ -148,19 +147,21 @@ public class PreferenceConsole { ...@@ -148,19 +147,21 @@ public class PreferenceConsole {
/** /**
* Updates reply template. * Updates reply template.
* *
* @param request the specified http servlet request, for example, * @param request the specified http servlet request, for example,
* "replyNotificationTemplate": { * "replyNotificationTemplate": {
* "subject": "", * "subject": "",
* "body": "" * "body": ""
* } * }
* @param response the specified http servlet response * @param response the specified http servlet response
* @param context the specified http request context * @param context the specified http request context
* @param requestJSONObject the specified request json object
* @throws Exception exception * @throws Exception exception
*/ */
@RequestProcessing(value = "/console/reply/notification/template", method = HTTPRequestMethod.PUT) @RequestProcessing(value = "/console/reply/notification/template", method = HTTPRequestMethod.PUT)
public void updateReplyNotificationTemplate(final HttpServletRequest request, public void updateReplyNotificationTemplate(final HttpServletRequest request,
final HttpServletResponse response, final HttpServletResponse response,
final HTTPRequestContext context) throws Exception { final HTTPRequestContext context,
final JSONObject requestJSONObject) throws Exception {
if (!userQueryService.isLoggedIn(request, response)) { if (!userQueryService.isLoggedIn(request, response)) {
response.sendError(HttpServletResponse.SC_FORBIDDEN); response.sendError(HttpServletResponse.SC_FORBIDDEN);
return; return;
...@@ -170,7 +171,6 @@ public class PreferenceConsole { ...@@ -170,7 +171,6 @@ public class PreferenceConsole {
context.setRenderer(renderer); context.setRenderer(renderer);
try { try {
final JSONObject requestJSONObject = Requests.parseRequestJSONObject(request, response);
final JSONObject replyNotificationTemplate = requestJSONObject.getJSONObject("replyNotificationTemplate"); final JSONObject replyNotificationTemplate = requestJSONObject.getJSONObject("replyNotificationTemplate");
preferenceMgmtService.updateReplyNotificationTemplate(replyNotificationTemplate); preferenceMgmtService.updateReplyNotificationTemplate(replyNotificationTemplate);
...@@ -340,47 +340,48 @@ public class PreferenceConsole { ...@@ -340,47 +340,48 @@ public class PreferenceConsole {
/** /**
* Updates the preference by the specified request. * Updates the preference by the specified request.
* *
* @param request the specified http servlet request, for example, * @param request the specified http servlet request, for example,
* "preference": { * "preference": {
* "mostViewArticleDisplayCount": int, * "mostViewArticleDisplayCount": int,
* "recentCommentDisplayCount": int, * "recentCommentDisplayCount": int,
* "mostUsedTagDisplayCount": int, * "mostUsedTagDisplayCount": int,
* "articleListDisplayCount": int, * "articleListDisplayCount": int,
* "articleListPaginationWindowSize": int, * "articleListPaginationWindowSize": int,
* "mostCommentArticleDisplayCount": int, * "mostCommentArticleDisplayCount": int,
* "externalRelevantArticlesDisplayCount": int, * "externalRelevantArticlesDisplayCount": int,
* "relevantArticlesDisplayCount": int, * "relevantArticlesDisplayCount": int,
* "randomArticlesDisplayCount": int, * "randomArticlesDisplayCount": int,
* "blogTitle": "", * "blogTitle": "",
* "blogSubtitle": "", * "blogSubtitle": "",
* "skinDirName": "", * "skinDirName": "",
* "localeString": "", * "localeString": "",
* "timeZoneId": "", * "timeZoneId": "",
* "noticeBoard": "", * "noticeBoard": "",
* "footerContent": "", * "footerContent": "",
* "htmlHead": "", * "htmlHead": "",
* "metaKeywords": "", * "metaKeywords": "",
* "metaDescription": "", * "metaDescription": "",
* "enableArticleUpdateHint": boolean, * "enableArticleUpdateHint": boolean,
* "signs": [{ * "signs": [{
* "oId": "", * "oId": "",
* "signHTML": "" * "signHTML": ""
* }, ...], * }, ...],
* "allowVisitDraftViaPermalink": boolean, * "allowVisitDraftViaPermalink": boolean,
* "allowRegister": boolean, * "allowRegister": boolean,
* "articleListStyle": "", * "articleListStyle": "",
* "editorType": "", * "editorType": "",
* "commentable": boolean, * "commentable": boolean,
* "feedOutputMode: "", * "feedOutputMode: "",
* "feedOutputCnt": int * "feedOutputCnt": int
* } * }
* @param response the specified http servlet response * @param response the specified http servlet response
* @param context the specified http request context * @param context the specified http request context
* @param requestJSONObject the specified reuqest json object
* @throws Exception exception * @throws Exception exception
*/ */
@RequestProcessing(value = PREFERENCE_URI_PREFIX, method = HTTPRequestMethod.PUT) @RequestProcessing(value = PREFERENCE_URI_PREFIX, method = HTTPRequestMethod.PUT)
public void updatePreference(final HttpServletRequest request, final HttpServletResponse response, final HTTPRequestContext context) public void updatePreference(final HttpServletRequest request, final HttpServletResponse response, final HTTPRequestContext context,
throws Exception { final JSONObject requestJSONObject) throws Exception {
if (!userQueryService.isAdminLoggedIn(request)) { if (!userQueryService.isAdminLoggedIn(request)) {
response.sendError(HttpServletResponse.SC_FORBIDDEN); response.sendError(HttpServletResponse.SC_FORBIDDEN);
return; return;
...@@ -390,7 +391,6 @@ public class PreferenceConsole { ...@@ -390,7 +391,6 @@ public class PreferenceConsole {
context.setRenderer(renderer); context.setRenderer(renderer);
try { try {
final JSONObject requestJSONObject = Requests.parseRequestJSONObject(request, response);
final JSONObject preference = requestJSONObject.getJSONObject(Option.CATEGORY_C_PREFERENCE); final JSONObject preference = requestJSONObject.getJSONObject(Option.CATEGORY_C_PREFERENCE);
final JSONObject ret = new JSONObject(); final JSONObject ret = new JSONObject();
renderer.setJSONObject(ret); renderer.setJSONObject(ret);
...@@ -472,18 +472,19 @@ public class PreferenceConsole { ...@@ -472,18 +472,19 @@ public class PreferenceConsole {
/** /**
* Updates the Qiniu preference by the specified request. * Updates the Qiniu preference by the specified request.
* *
* @param request the specified http servlet request, for example, * @param request the specified http servlet request, for example,
* "qiniuAccessKey": "", * "qiniuAccessKey": "",
* "qiniuSecretKey": "", * "qiniuSecretKey": "",
* "qiniuDomain": "", * "qiniuDomain": "",
* "qiniuBucket": "" * "qiniuBucket": ""
* @param response the specified http servlet response * @param response the specified http servlet response
* @param context the specified http request context * @param context the specified http request context
* @param requestJSONObject the specified request json object
* @throws Exception exception * @throws Exception exception
*/ */
@RequestProcessing(value = PREFERENCE_URI_PREFIX + "qiniu", method = HTTPRequestMethod.PUT) @RequestProcessing(value = PREFERENCE_URI_PREFIX + "qiniu", method = HTTPRequestMethod.PUT)
public void updateQiniu(final HttpServletRequest request, final HttpServletResponse response, public void updateQiniu(final HttpServletRequest request, final HttpServletResponse response,
final HTTPRequestContext context) throws Exception { final HTTPRequestContext context, final JSONObject requestJSONObject) throws Exception {
if (!userQueryService.isAdminLoggedIn(request)) { if (!userQueryService.isAdminLoggedIn(request)) {
response.sendError(HttpServletResponse.SC_FORBIDDEN); response.sendError(HttpServletResponse.SC_FORBIDDEN);
...@@ -494,8 +495,6 @@ public class PreferenceConsole { ...@@ -494,8 +495,6 @@ public class PreferenceConsole {
context.setRenderer(renderer); context.setRenderer(renderer);
try { try {
final JSONObject requestJSONObject = Requests.parseRequestJSONObject(request, response);
final String accessKey = requestJSONObject.optString(Option.ID_C_QINIU_ACCESS_KEY).trim(); final String accessKey = requestJSONObject.optString(Option.ID_C_QINIU_ACCESS_KEY).trim();
final String secretKey = requestJSONObject.optString(Option.ID_C_QINIU_SECRET_KEY).trim(); final String secretKey = requestJSONObject.optString(Option.ID_C_QINIU_SECRET_KEY).trim();
String domain = requestJSONObject.optString(Option.ID_C_QINIU_DOMAIN).trim(); String domain = requestJSONObject.optString(Option.ID_C_QINIU_DOMAIN).trim();
......
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