Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
solo-1
Project overview
Project overview
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Administrator
solo-1
Commits
0168859e
Commit
0168859e
authored
Mar 03, 2018
by
Liang Ding
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
♻
#12401
parent
32cef8b2
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
79 additions
and
99 deletions
+79
-99
src/main/java/org/b3log/solo/api/symphony/ArticleReceiver.java
...ain/java/org/b3log/solo/api/symphony/ArticleReceiver.java
+23
-34
src/main/java/org/b3log/solo/api/symphony/CommentReceiver.java
...ain/java/org/b3log/solo/api/symphony/CommentReceiver.java
+19
-28
src/main/java/org/b3log/solo/processor/console/LinkConsole.java
...in/java/org/b3log/solo/processor/console/LinkConsole.java
+14
-14
src/main/java/org/b3log/solo/processor/console/PageConsole.java
...in/java/org/b3log/solo/processor/console/PageConsole.java
+11
-11
src/main/java/org/b3log/solo/processor/console/PreferenceConsole.java
...a/org/b3log/solo/processor/console/PreferenceConsole.java
+12
-12
No files found.
src/main/java/org/b3log/solo/api/symphony/ArticleReceiver.java
View file @
0168859e
...
...
@@ -26,7 +26,6 @@ import org.b3log.latke.servlet.HTTPRequestMethod;
import
org.b3log.latke.servlet.annotation.RequestProcessing
;
import
org.b3log.latke.servlet.annotation.RequestProcessor
;
import
org.b3log.latke.servlet.renderer.JSONRenderer
;
import
org.b3log.latke.util.Requests
;
import
org.b3log.solo.model.Article
;
import
org.b3log.solo.model.Common
;
import
org.b3log.solo.model.Option
;
...
...
@@ -37,14 +36,11 @@ import org.b3log.solo.service.UserQueryService;
import
org.b3log.solo.util.QueryResults
;
import
org.json.JSONObject
;
import
javax.servlet.http.HttpServletRequest
;
import
javax.servlet.http.HttpServletResponse
;
/**
* Article receiver (from B3log Symphony).
*
* @author <a href="http://88250.b3log.org">Liang Ding</a>
* @version 1.0.4.
0, Nov 20, 2017
* @version 1.0.4.
1, Mar 3, 2018
* @since 0.5.5
*/
@RequestProcessor
...
...
@@ -92,7 +88,8 @@ public class ArticleReceiver {
* </pre>
* </p>
*
* @param request the specified http servlet request, for example,
* @param context the specified http request context
* @param requestJSONObject the specified http servlet request, for example,
* "article": {
* "oId": "",
* "articleTitle": "",
...
...
@@ -101,19 +98,16 @@ public class ArticleReceiver {
* "userB3Key": "",
* "articleEditorType": ""
* }
* @param response the specified http servlet response
* @param context the specified http request context
* @throws Exception exception
*/
@RequestProcessing
(
value
=
"/apis/symphony/article"
,
method
=
HTTPRequestMethod
.
POST
)
public
void
addArticle
(
final
H
ttpServletRequest
request
,
final
HttpServletResponse
response
,
final
HTTPRequestContext
contex
t
)
public
void
addArticle
(
final
H
TTPRequestContext
context
,
final
JSONObject
requestJSONObjec
t
)
throws
Exception
{
final
JSONRenderer
renderer
=
new
JSONRenderer
();
context
.
setRenderer
(
renderer
);
final
JSONObject
ret
=
new
JSONObject
();
try
{
final
JSONObject
requestJSONObject
=
Requests
.
parseRequestJSONObject
(
request
,
response
);
final
JSONObject
article
=
requestJSONObject
.
optJSONObject
(
Article
.
ARTICLE
);
final
String
userB3Key
=
article
.
optString
(
"userB3Key"
);
final
JSONObject
preference
=
preferenceQueryService
.
getPreference
();
...
...
@@ -167,7 +161,8 @@ public class ArticleReceiver {
* </pre>
* </p>
*
* @param request the specified http servlet request, for example,
* @param context the specified http request context
* @param requestJSONObject the specified http servlet request, for example,
* "article": {
* "oId": "", // Symphony Article#clientArticleId
* "articleTitle": "",
...
...
@@ -176,23 +171,17 @@ public class ArticleReceiver {
* "userB3Key": "",
* "articleEditorType": ""
* }
* @param response the specified http servlet response
* @param context the specified http request context
* @throws Exception exception
*/
@RequestProcessing
(
value
=
"/apis/symphony/article"
,
method
=
HTTPRequestMethod
.
PUT
)
public
void
updateArticle
(
final
H
ttpServletRequest
request
,
final
HttpServletResponse
response
,
final
HTTPRequestContext
contex
t
)
public
void
updateArticle
(
final
H
TTPRequestContext
context
,
final
JSONObject
requestJSONObjec
t
)
throws
Exception
{
final
JSONRenderer
renderer
=
new
JSONRenderer
();
context
.
setRenderer
(
renderer
);
final
JSONObject
ret
=
new
JSONObject
();
renderer
.
setJSONObject
(
ret
);
try
{
final
JSONObject
requestJSONObject
=
Requests
.
parseRequestJSONObject
(
request
,
response
);
final
JSONObject
article
=
requestJSONObject
.
optJSONObject
(
Article
.
ARTICLE
);
final
String
userB3Key
=
article
.
optString
(
"userB3Key"
);
final
JSONObject
preference
=
preferenceQueryService
.
getPreference
();
...
...
src/main/java/org/b3log/solo/api/symphony/CommentReceiver.java
View file @
0168859e
...
...
@@ -31,7 +31,6 @@ import org.b3log.latke.servlet.annotation.RequestProcessor;
import
org.b3log.latke.servlet.renderer.JSONRenderer
;
import
org.b3log.latke.urlfetch.URLFetchService
;
import
org.b3log.latke.urlfetch.URLFetchServiceFactory
;
import
org.b3log.latke.util.Requests
;
import
org.b3log.latke.util.Strings
;
import
org.b3log.solo.event.EventTypes
;
import
org.b3log.solo.model.Article
;
...
...
@@ -47,7 +46,6 @@ import org.b3log.solo.util.Comments;
import
org.b3log.solo.util.QueryResults
;
import
org.json.JSONObject
;
import
javax.servlet.http.HttpServletRequest
;
import
javax.servlet.http.HttpServletResponse
;
import
java.net.MalformedURLException
;
import
java.net.URL
;
...
...
@@ -57,7 +55,7 @@ import java.util.Date;
* Comment receiver (from B3log Symphony).
*
* @author <a href="http://88250.b3log.org">Liang Ding</a>
* @version 1.1.1.1
2, Apr 25, 2017
* @version 1.1.1.1
3, Mar 3, 2018
* @since 0.5.5
*/
@RequestProcessor
...
...
@@ -117,7 +115,7 @@ public class CommentReceiver {
/**
* Adds an article with the specified request.
*
*
<p>
* <p>
* Renders the response with a json object, for example,
* <pre>
...
...
@@ -127,7 +125,8 @@ public class CommentReceiver {
* </pre>
* </p>
*
* @param request the specified http servlet request, for example, <pre>
* @param context the specified http request context
* @param requestJSONObject the specified http servlet request, for example,
* {
* "comment": {
* "userB3Key": "",
...
...
@@ -142,26 +141,18 @@ public class CommentReceiver {
* "commentOriginalCommentId": "" // optional, if exists this key, the comment is an reply
* }
* }
* </pre>
*
* @param response the specified http servlet response
* @param context the specified http request context
* @throws Exception exception
*/
@RequestProcessing
(
value
=
"/apis/symphony/comment"
,
method
=
HTTPRequestMethod
.
PUT
)
public
void
addComment
(
final
H
ttpServletRequest
request
,
final
HttpServletResponse
response
,
final
HTTPRequestContext
contex
t
)
public
void
addComment
(
final
H
TTPRequestContext
context
,
final
JSONObject
requestJSONObjec
t
)
throws
Exception
{
final
JSONRenderer
renderer
=
new
JSONRenderer
();
context
.
setRenderer
(
renderer
);
final
JSONObject
ret
=
new
JSONObject
();
renderer
.
setJSONObject
(
ret
);
final
Transaction
transaction
=
commentRepository
.
beginTransaction
();
try
{
final
JSONObject
requestJSONObject
=
Requests
.
parseRequestJSONObject
(
request
,
response
);
final
JSONObject
symphonyCmt
=
requestJSONObject
.
optJSONObject
(
Comment
.
COMMENT
);
final
JSONObject
preference
=
preferenceQueryService
.
getPreference
();
final
String
keyOfSolo
=
preference
.
optString
(
Option
.
ID_C_KEY_OF_SOLO
);
...
...
src/main/java/org/b3log/solo/processor/console/LinkConsole.java
View file @
0168859e
...
...
@@ -133,7 +133,10 @@ public class LinkConsole {
* </pre>
* </p>
*
* @param request the specified http servlet request, for example,
* @param request the specified http servlet request
* @param context the specified http request context
* @param response the specified http servlet response
* @param requestJSONObject the specified request json object, for example,
* {
* "link": {
* "oId": "",
...
...
@@ -142,12 +145,11 @@ public class LinkConsole {
* "linkDescription": ""
* }
* }, see {@link org.b3log.solo.model.Link} for more details
* @param context the specified http request context
* @param response the specified http servlet response
* @throws Exception exception
*/
@RequestProcessing
(
value
=
"/console/link/"
,
method
=
HTTPRequestMethod
.
PUT
)
public
void
updateLink
(
final
HttpServletRequest
request
,
final
HttpServletResponse
response
,
final
HTTPRequestContext
context
)
public
void
updateLink
(
final
HttpServletRequest
request
,
final
HttpServletResponse
response
,
final
HTTPRequestContext
context
,
final
JSONObject
requestJSONObject
)
throws
Exception
{
if
(!
userQueryService
.
isAdminLoggedIn
(
request
))
{
response
.
sendError
(
HttpServletResponse
.
SC_FORBIDDEN
);
...
...
@@ -160,8 +162,6 @@ public class LinkConsole {
final
JSONObject
ret
=
new
JSONObject
();
try
{
final
JSONObject
requestJSONObject
=
Requests
.
parseRequestJSONObject
(
request
,
response
);
linkMgmtService
.
updateLink
(
requestJSONObject
);
ret
.
put
(
Keys
.
STATUS_CODE
,
true
);
...
...
src/main/java/org/b3log/solo/processor/console/PageConsole.java
View file @
0168859e
...
...
@@ -91,7 +91,10 @@ public class PageConsole {
* </pre>
* </p>
*
* @param request the specified http servlet request, for example,
* @param request the specified http servlet request
* @param response the specified http servlet response
* @param context the specified http request context
* @param requestJSONObject the specified reuqest json object, for example,
* {
* "page": {
* "oId": "",
...
...
@@ -106,9 +109,6 @@ public class PageConsole {
* "pageIcon": ""
* }
* }, see {@link org.b3log.solo.model.Page} for more details
* @param response the specified http servlet response
* @param context the specified http request context
* @param requestJSONObject the specified reuqest json object
* @throws Exception exception
*/
@RequestProcessing
(
value
=
"/console/page/"
,
method
=
HTTPRequestMethod
.
PUT
)
...
...
@@ -204,7 +204,9 @@ public class PageConsole {
* </p>
*
* @param context the specified http request context
* @param request the specified http servlet request, for example,
* @param request the specified http servlet request
* @param response the specified http servlet response
* @param requestJSONObject the specified request json object, for example,
* {
* "page": {
* "pageTitle": "",
...
...
@@ -216,8 +218,6 @@ public class PageConsole {
* "pageIcon": ""
* }
* }, see {@link org.b3log.solo.model.Page} for more details
* @param response the specified http servlet response
* @param requestJSONObject the specified request json object
* @throws Exception exception
*/
@RequestProcessing
(
value
=
"/console/page/"
,
method
=
HTTPRequestMethod
.
POST
)
...
...
@@ -265,14 +265,14 @@ public class PageConsole {
* </pre>
* </p>
*
* @param request the specified http servlet request, for example,
* @param request the specified http servlet request
* @param response the specified http servlet response
* @param context the specified http request context
* @param requestJSONObject the specified request json object, for example,
* {
* "oId": "",
* "direction": "" // "up"/"down"
* }
* @param response the specified http servlet response
* @param context the specified http request context
* @param requestJSONObject the specified request json object
* @throws Exception exception
*/
@RequestProcessing
(
value
=
"/console/page/order/"
,
method
=
HTTPRequestMethod
.
PUT
)
...
...
src/main/java/org/b3log/solo/processor/console/PreferenceConsole.java
View file @
0168859e
...
...
@@ -147,14 +147,14 @@ public class PreferenceConsole {
/**
* Updates reply template.
*
* @param request the specified http servlet request, for example,
* @param request the specified http servlet request
* @param response the specified http servlet response
* @param context the specified http request context
* @param requestJSONObject the specified request json object, for example,
* "replyNotificationTemplate": {
* "subject": "",
* "body": ""
* }
* @param response the specified http servlet response
* @param context the specified http request context
* @param requestJSONObject the specified request json object
* @throws Exception exception
*/
@RequestProcessing
(
value
=
"/console/reply/notification/template"
,
method
=
HTTPRequestMethod
.
PUT
)
...
...
@@ -340,7 +340,10 @@ public class PreferenceConsole {
/**
* Updates the preference by the specified request.
*
* @param request the specified http servlet request, for example,
* @param request the specified http servlet request
* @param response the specified http servlet response
* @param context the specified http request context
* @param requestJSONObject the specified reuqest json object, for example,
* "preference": {
* "mostViewArticleDisplayCount": int,
* "recentCommentDisplayCount": int,
...
...
@@ -374,9 +377,6 @@ public class PreferenceConsole {
* "feedOutputMode: "",
* "feedOutputCnt": int
* }
* @param response the specified http servlet response
* @param context the specified http request context
* @param requestJSONObject the specified reuqest json object
* @throws Exception exception
*/
@RequestProcessing
(
value
=
PREFERENCE_URI_PREFIX
,
method
=
HTTPRequestMethod
.
PUT
)
...
...
@@ -472,14 +472,14 @@ public class PreferenceConsole {
/**
* Updates the Qiniu preference by the specified request.
*
* @param request the specified http servlet request, for example,
* @param request the specified http servlet request
* @param response the specified http servlet response
* @param context the specified http request context
* @param requestJSONObject the specified request json object, for example,
* "qiniuAccessKey": "",
* "qiniuSecretKey": "",
* "qiniuDomain": "",
* "qiniuBucket": ""
* @param response the specified http servlet response
* @param context the specified http request context
* @param requestJSONObject the specified request json object
* @throws Exception exception
*/
@RequestProcessing
(
value
=
PREFERENCE_URI_PREFIX
+
"qiniu"
,
method
=
HTTPRequestMethod
.
PUT
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment