Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
E
education
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
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
李丛阳
education
Commits
b3b11579
Commit
b3b11579
authored
Nov 11, 2019
by
王淑君
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改接口
parent
5c2a5eb7
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
4 deletions
+12
-4
BBannerServiceImpl.java
...oft/business/bbanner/service/impl/BBannerServiceImpl.java
+12
-4
No files found.
src/main/java/org/rcisoft/business/bbanner/service/impl/BBannerServiceImpl.java
View file @
b3b11579
...
@@ -22,6 +22,8 @@ import org.springframework.stereotype.Service;
...
@@ -22,6 +22,8 @@ import org.springframework.stereotype.Service;
import
org.springframework.transaction.annotation.Propagation
;
import
org.springframework.transaction.annotation.Propagation
;
import
org.springframework.transaction.annotation.Transactional
;
import
org.springframework.transaction.annotation.Transactional
;
import
java.io.InputStream
;
import
java.net.URL
;
import
java.util.List
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.Map
;
import
java.util.regex.Pattern
;
import
java.util.regex.Pattern
;
...
@@ -51,10 +53,16 @@ public class BBannerServiceImpl implements BBannerService {
...
@@ -51,10 +53,16 @@ public class BBannerServiceImpl implements BBannerService {
if
(
"1"
.
equals
(
model
.
getIsExternalLink
())
&&
StringUtils
.
isEmpty
(
model
.
getExternalUrl
()))
if
(
"1"
.
equals
(
model
.
getIsExternalLink
())
&&
StringUtils
.
isEmpty
(
model
.
getExternalUrl
()))
throw
new
ServiceException
(
ResultServiceEnums
.
JUMP_ADDRESS_NULL
);
throw
new
ServiceException
(
ResultServiceEnums
.
JUMP_ADDRESS_NULL
);
else
if
(
"1"
.
equals
(
model
.
getIsExternalLink
())
&&
StringUtils
.
isNotBlank
(
model
.
getExternalUrl
())){
else
if
(
"1"
.
equals
(
model
.
getIsExternalLink
())
&&
StringUtils
.
isNotBlank
(
model
.
getExternalUrl
())){
String
regex
=
"^([hH][tT]{2}[pP]:/*|[hH][tT]{2}[pP][sS]:/*|[fF][tT][pP]:/*)(([A-Za-z0-9-~]+).)+([A-Za-z0-9-~\\/])+(\\?{0,1}(([A-Za-z0-9-~]+\\={0,1})([A-Za-z0-9-~]*)\\&{0,1})*)$"
;
// +(\?{0,1}(([A-Za-z0-9-~]+\={0,1})([A-Za-z0-9-~]*)\&{0,1})*)$
// String regex = "^([hH][tT]{2}[pP]:/*|[hH][tT]{2}[pP][sS]:/*|[fF][tT][pP]:/*)(([A-Za-z0-9-~]+).)+([A-Za-z0-9-~\\/])+(\\?{0,1}(([A-Za-z0-9-~]+\\={0,1})([A-Za-z0-9-~]*)\\&{0,1})*)$"; // +(\?{0,1}(([A-Za-z0-9-~]+\={0,1})([A-Za-z0-9-~]*)\&{0,1})*)$
Pattern
pattern
=
Pattern
.
compile
(
regex
);
// Pattern pattern = Pattern.compile(regex);
//
if
(!
pattern
.
matcher
(
model
.
getExternalUrl
()).
matches
())
{
// if (!pattern.matcher(model.getExternalUrl()).matches()) {
// throw new ServiceException(ResultServiceEnums.ILLEGAL_URL);
// }
try
{
URL
url
=
new
URL
(
model
.
getExternalUrl
());
InputStream
in
=
((
URL
)
url
).
openStream
();
}
catch
(
Exception
e1
)
{
throw
new
ServiceException
(
ResultServiceEnums
.
ILLEGAL_URL
);
throw
new
ServiceException
(
ResultServiceEnums
.
ILLEGAL_URL
);
}
}
}
}
...
...
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