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
6e37d9ab
Commit
6e37d9ab
authored
Mar 03, 2018
by
Liang Ding
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
♻
#12401
parent
0168859e
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
36 deletions
+14
-36
src/main/java/org/b3log/solo/processor/console/PluginConsole.java
.../java/org/b3log/solo/processor/console/PluginConsole.java
+14
-36
No files found.
src/main/java/org/b3log/solo/processor/console/PluginConsole.java
View file @
6e37d9ab
...
@@ -15,7 +15,6 @@
...
@@ -15,7 +15,6 @@
*/
*/
package
org
.
b3log
.
solo
.
processor
.
console
;
package
org
.
b3log
.
solo
.
processor
.
console
;
import
org.b3log.latke.Keys
;
import
org.b3log.latke.Keys
;
import
org.b3log.latke.Latkes
;
import
org.b3log.latke.Latkes
;
import
org.b3log.latke.ioc.inject.Inject
;
import
org.b3log.latke.ioc.inject.Inject
;
...
@@ -41,13 +40,12 @@ import javax.servlet.http.HttpServletRequest;
...
@@ -41,13 +40,12 @@ import javax.servlet.http.HttpServletRequest;
import
javax.servlet.http.HttpServletResponse
;
import
javax.servlet.http.HttpServletResponse
;
import
java.util.Map
;
import
java.util.Map
;
/**
/**
* 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>
* @author <a href="mailto:wmainlove@gmail.com">Love Yao</a>
* @author <a href="mailto:wmainlove@gmail.com">Love Yao</a>
* @version 1.1.0.
0, Jan 17, 2013
* @version 1.1.0.
1, Mar 3, 2018
* @since 0.4.0
* @since 0.4.0
*/
*/
@RequestProcessor
@RequestProcessor
...
@@ -89,20 +87,15 @@ public class PluginConsole {
...
@@ -89,20 +87,15 @@ public class PluginConsole {
* </pre>
* </pre>
* </p>
* </p>
*
*
* @param request the specified http servlet request
* @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 requeset json object
* @throws Exception exception
* @throws Exception exception
*/
*/
@RequestProcessing
(
value
=
"/console/plugin/status/"
,
method
=
HTTPRequestMethod
.
PUT
)
@RequestProcessing
(
value
=
"/console/plugin/status/"
,
method
=
HTTPRequestMethod
.
PUT
)
public
void
setPluginStatus
(
final
HttpServletRequest
request
,
final
HttpServletResponse
response
,
final
HTTPRequestContext
context
)
public
void
setPluginStatus
(
final
HTTPRequestContext
context
,
final
JSONObject
requestJSONObject
)
throws
Exception
{
throws
Exception
{
final
JSONRenderer
renderer
=
new
JSONRenderer
();
final
JSONRenderer
renderer
=
new
JSONRenderer
();
context
.
setRenderer
(
renderer
);
context
.
setRenderer
(
renderer
);
final
JSONObject
requestJSONObject
=
Requests
.
parseRequestJSONObject
(
request
,
response
);
final
String
pluginId
=
requestJSONObject
.
getString
(
Keys
.
OBJECT_ID
);
final
String
pluginId
=
requestJSONObject
.
getString
(
Keys
.
OBJECT_ID
);
final
String
status
=
requestJSONObject
.
getString
(
Plugin
.
PLUGIN_STATUS
);
final
String
status
=
requestJSONObject
.
getString
(
Plugin
.
PLUGIN_STATUS
);
...
@@ -175,22 +168,16 @@ public class PluginConsole {
...
@@ -175,22 +168,16 @@ public class PluginConsole {
/**
/**
* get the info of the specified pluginoId,just fot the plugin-setting.
* get the info of the specified pluginoId,just fot the plugin-setting.
*
*
* @param request the specified http servlet request
* @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
* @param renderer the specified {@link ConsoleRenderer}
* @param renderer the specified {@link ConsoleRenderer}
* @throws Exception exception
*/
*/
@RequestProcessing
(
value
=
"/console/plugin/toSetting"
,
method
=
HTTPRequestMethod
.
POST
)
@RequestProcessing
(
value
=
"/console/plugin/toSetting"
,
method
=
HTTPRequestMethod
.
POST
)
public
void
toSetting
(
final
HttpServletRequest
request
,
final
HttpServletResponse
response
,
final
HTTPRequestContext
context
,
public
void
toSetting
(
final
HTTPRequestContext
context
,
final
JSONObject
requestJSONObject
,
final
ConsoleRenderer
renderer
)
{
final
ConsoleRenderer
renderer
)
throws
Exception
{
context
.
setRenderer
(
renderer
);
context
.
setRenderer
(
renderer
);
try
{
try
{
final
JSONObject
requestJSONObject
=
Requests
.
parseRequestJSONObject
(
request
,
response
);
final
String
pluginId
=
requestJSONObject
.
getString
(
Keys
.
OBJECT_ID
);
final
String
pluginId
=
requestJSONObject
.
getString
(
Keys
.
OBJECT_ID
);
final
String
setting
=
pluginQueryService
.
getPluginSetting
(
pluginId
);
final
String
setting
=
pluginQueryService
.
getPluginSetting
(
pluginId
);
renderer
.
setTemplateName
(
"admin-plugin-setting.ftl"
);
renderer
.
setTemplateName
(
"admin-plugin-setting.ftl"
);
...
@@ -200,41 +187,32 @@ public class PluginConsole {
...
@@ -200,41 +187,32 @@ public class PluginConsole {
dataModel
.
put
(
Plugin
.
PLUGIN_SETTING
,
setting
);
dataModel
.
put
(
Plugin
.
PLUGIN_SETTING
,
setting
);
dataModel
.
put
(
Keys
.
OBJECT_ID
,
pluginId
);
dataModel
.
put
(
Keys
.
OBJECT_ID
,
pluginId
);
}
catch
(
final
Exception
e
)
{
}
catch
(
final
Exception
e
)
{
LOGGER
.
log
(
Level
.
ERROR
,
e
.
getMessage
(),
e
);
LOGGER
.
log
(
Level
.
ERROR
,
e
.
getMessage
(),
e
);
final
JSONObject
jsonObject
=
QueryResults
.
defaultResult
();
final
JSONObject
jsonObject
=
QueryResults
.
defaultResult
();
final
JSONRenderer
jsonRenderer
=
new
JSONRenderer
();
final
JSONRenderer
jsonRenderer
=
new
JSONRenderer
();
jsonRenderer
.
setJSONObject
(
jsonObject
);
jsonRenderer
.
setJSONObject
(
jsonObject
);
jsonObject
.
put
(
Keys
.
MSG
,
langPropsService
.
get
(
"getFailLabel"
));
jsonObject
.
put
(
Keys
.
MSG
,
langPropsService
.
get
(
"getFailLabel"
));
}
}
}
}
/**
/**
* update the setting of the plugin.
* update the setting of the plugin.
*
*
* @param request the specified http servlet request
* @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
* @param renderer the specified {@link ConsoleRenderer}
* @param renderer the specified {@link ConsoleRenderer}
* @throws Exception exception
*/
*/
@RequestProcessing
(
value
=
"/console/plugin/updateSetting"
,
method
=
HTTPRequestMethod
.
POST
)
@RequestProcessing
(
value
=
"/console/plugin/updateSetting"
,
method
=
HTTPRequestMethod
.
POST
)
public
void
updateSetting
(
final
HttpServletRequest
request
,
final
HttpServletResponse
response
,
final
HTTPRequestContext
context
,
public
void
updateSetting
(
final
HTTPRequestContext
context
,
final
JSONObject
requestJSONObject
,
final
JSONRenderer
renderer
)
{
final
JSONRenderer
renderer
)
throws
Exception
{
context
.
setRenderer
(
renderer
);
context
.
setRenderer
(
renderer
);
final
JSONObject
requestJSONObject
=
Requests
.
parseRequestJSONObject
(
request
,
response
);
final
String
pluginoId
=
requestJSONObject
.
optString
(
Keys
.
OBJECT_ID
);
final
String
pluginoId
=
requestJSONObject
.
getString
(
Keys
.
OBJECT_ID
);
final
String
settings
=
requestJSONObject
.
optString
(
Plugin
.
PLUGIN_SETTING
);
final
String
settings
=
requestJSONObject
.
getString
(
Plugin
.
PLUGIN_SETTING
);
final
JSONObject
ret
=
pluginMgmtService
.
updatePluginSetting
(
pluginoId
,
settings
);
final
JSONObject
ret
=
pluginMgmtService
.
updatePluginSetting
(
pluginoId
,
settings
);
renderer
.
setJSONObject
(
ret
);
renderer
.
setJSONObject
(
ret
);
}
}
}
}
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