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
9ccaaa19
Unverified
Commit
9ccaaa19
authored
Nov 05, 2019
by
Liang Ding
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
🎨
错误页处理
parent
d077d3ec
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
8 additions
and
9 deletions
+8
-9
src/main/java/org/b3log/solo/Server.java
src/main/java/org/b3log/solo/Server.java
+5
-3
src/main/java/org/b3log/solo/processor/ErrorProcessor.java
src/main/java/org/b3log/solo/processor/ErrorProcessor.java
+3
-6
No files found.
src/main/java/org/b3log/solo/Server.java
View file @
9ccaaa19
...
...
@@ -46,7 +46,7 @@ import org.json.JSONObject;
* Server.
*
* @author <a href="http://88250.b3log.org">Liang Ding</a>
* @version 2.0.0.
0, Nov 3
, 2019
* @version 2.0.0.
1, Nov 5
, 2019
* @since 1.2.0
*/
public
final
class
Server
extends
BaseServer
{
...
...
@@ -183,8 +183,6 @@ public final class Server extends BaseServer {
Dispatcher
.
HANDLERS
.
add
(
2
,
new
InitCheckHandler
());
Dispatcher
.
HANDLERS
.
add
(
3
,
new
PermalinkHandler
());
Dispatcher
.
HANDLERS
.
add
(
4
,
new
StopwatchEndHandler
());
final
BeanManager
beanManager
=
BeanManager
.
getInstance
();
routeConsoleProcessors
();
Stopwatchs
.
start
(
"Context Initialized"
);
...
...
@@ -200,6 +198,7 @@ public final class Server extends BaseServer {
validateSkin
();
final
BeanManager
beanManager
=
BeanManager
.
getInstance
();
final
InitService
initService
=
beanManager
.
getReference
(
InitService
.
class
);
initService
.
initTables
();
...
...
@@ -428,6 +427,9 @@ public final class Server extends BaseServer {
Dispatcher
.
get
(
"/console/changeRole/{id}"
,
userConsole:
:
changeUserRole
);
Dispatcher
.
mapping
();
final
ErrorProcessor
errorProcessor
=
beanManager
.
getReference
(
ErrorProcessor
.
class
);
Dispatcher
.
error
(
"/error/{statusCode}"
,
errorProcessor:
:
showErrorPage
);
}
/**
...
...
src/main/java/org/b3log/solo/processor/ErrorProcessor.java
View file @
9ccaaa19
...
...
@@ -19,13 +19,11 @@ package org.b3log.solo.processor;
import
org.apache.commons.lang.StringUtils
;
import
org.b3log.latke.Keys
;
import
org.b3log.latke.http.HttpMethod
;
import
org.b3log.latke.http.Request
;
import
org.b3log.latke.http.RequestContext
;
import
org.b3log.latke.http.annotation.RequestProcessing
;
import
org.b3log.latke.http.annotation.RequestProcessor
;
import
org.b3log.latke.http.renderer.AbstractFreeMarkerRenderer
;
import
org.b3log.latke.ioc.Inject
;
import
org.b3log.latke.ioc.Singleton
;
import
org.b3log.latke.logging.Level
;
import
org.b3log.latke.logging.Logger
;
import
org.b3log.latke.service.LangPropsService
;
...
...
@@ -43,10 +41,10 @@ import java.util.Map;
* Error processor.
*
* @author <a href="http://88250.b3log.org">Liang Ding</a>
* @version
1.0.2.0, Mar 30
, 2019
* @version
2.0.0.0, Nov 5
, 2019
* @since 0.4.5
*/
@
RequestProcessor
@
Singleton
public
class
ErrorProcessor
{
/**
...
...
@@ -84,7 +82,6 @@ public class ErrorProcessor {
* @param context the specified context
* @throws Exception exception
*/
@RequestProcessing
(
value
=
"/error/{statusCode}"
,
method
=
{
HttpMethod
.
GET
,
HttpMethod
.
POST
,
HttpMethod
.
PUT
,
HttpMethod
.
DELETE
})
public
void
showErrorPage
(
final
RequestContext
context
)
{
final
Request
request
=
context
.
getRequest
();
final
String
statusCode
=
context
.
pathVar
(
"statusCode"
);
...
...
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