Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
X
xyqb-user2
Project
Project
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
head_group
xyqb-user2
Commits
0656edcf
Commit
0656edcf
authored
Nov 28, 2017
by
技术部-任文超
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' of
http://git.quantgroup.cn/head_group/xyqb-user2
parents
6b945e53
bae2a1c5
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
5 additions
and
62 deletions
+5
-62
InterceptorConfig.java
...java/cn/quantgroup/xyqb/config/web/InterceptorConfig.java
+5
-7
ChannelIdInterceptor.java
...cn/quantgroup/xyqb/interceptors/ChannelIdInterceptor.java
+0
-55
No files found.
src/main/java/cn/quantgroup/xyqb/config/web/InterceptorConfig.java
View file @
0656edcf
package
cn
.
quantgroup
.
xyqb
.
config
.
web
;
package
cn
.
quantgroup
.
xyqb
.
config
.
web
;
import
cn.quantgroup.xyqb.interceptors.ChannelIdInterceptor
;
import
cn.quantgroup.xyqb.interceptors.IPWhiteListInterceptor
;
import
cn.quantgroup.xyqb.interceptors.IPWhiteListInterceptor
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.context.annotation.Configuration
;
import
org.springframework.context.annotation.Configuration
;
...
@@ -13,12 +12,11 @@ import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter
...
@@ -13,12 +12,11 @@ import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter
@Configuration
@Configuration
public
class
InterceptorConfig
extends
WebMvcConfigurerAdapter
{
public
class
InterceptorConfig
extends
WebMvcConfigurerAdapter
{
@Value
(
"${configserver.disable}"
)
@Value
(
"${configserver.disable}"
)
private
Integer
isDebug
;
private
Integer
isDebug
;
public
void
addInterceptors
(
InterceptorRegistry
registry
)
{
public
void
addInterceptors
(
InterceptorRegistry
registry
)
{
registry
.
addInterceptor
(
new
IPWhiteListInterceptor
(
isDebug
)).
addPathPatterns
(
"/innerapi/**"
);
registry
.
addInterceptor
(
new
IPWhiteListInterceptor
(
isDebug
)).
addPathPatterns
(
"/innerapi/**"
);
registry
.
addInterceptor
(
new
ChannelIdInterceptor
()).
addPathPatterns
(
"/**"
);
}
}
}
}
src/main/java/cn/quantgroup/xyqb/interceptors/ChannelIdInterceptor.java
deleted
100644 → 0
View file @
6b945e53
package
cn
.
quantgroup
.
xyqb
.
interceptors
;
import
org.springframework.web.servlet.HandlerInterceptor
;
import
org.springframework.web.servlet.ModelAndView
;
import
javax.servlet.http.HttpServletRequest
;
import
javax.servlet.http.HttpServletResponse
;
/**
* Created by Miraculous on 15/7/10.
*/
public
class
ChannelIdInterceptor
implements
HandlerInterceptor
{
private
static
final
String
CHANNEL_ID
=
"channelId"
;
private
static
final
String
CREATED_FROM
=
"createdFrom"
;
private
static
final
String
APP_CHANNEL
=
"appChannel"
;
@Override
public
boolean
preHandle
(
HttpServletRequest
request
,
HttpServletResponse
response
,
Object
o
)
throws
Exception
{
String
channelId
=
request
.
getParameter
(
CHANNEL_ID
);
if
(
channelId
==
null
)
{
channelId
=
(
String
)
request
.
getAttribute
(
CHANNEL_ID
);
}
if
(
channelId
!=
null
)
{
request
.
getSession
().
setAttribute
(
CHANNEL_ID
,
channelId
);
}
String
createdFrom
=
request
.
getParameter
(
CREATED_FROM
);
if
(
createdFrom
==
null
)
{
createdFrom
=
(
String
)
request
.
getAttribute
(
CREATED_FROM
);
}
if
(
createdFrom
!=
null
)
{
request
.
getSession
().
setAttribute
(
CREATED_FROM
,
createdFrom
);
}
String
appChannel
=
request
.
getParameter
(
APP_CHANNEL
);
if
(
appChannel
==
null
)
{
appChannel
=
(
String
)
request
.
getAttribute
(
APP_CHANNEL
);
}
if
(
appChannel
!=
null
)
{
request
.
getSession
().
setAttribute
(
APP_CHANNEL
,
appChannel
);
}
return
true
;
}
@Override
public
void
postHandle
(
HttpServletRequest
request
,
HttpServletResponse
response
,
Object
o
,
ModelAndView
modelAndView
)
throws
Exception
{
}
@Override
public
void
afterCompletion
(
HttpServletRequest
request
,
HttpServletResponse
response
,
Object
o
,
Exception
e
)
throws
Exception
{
}
}
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