Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
N
nouiWithSpringMVC
Overview
Overview
Details
Activity
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
gechengyang
nouiWithSpringMVC
Commits
67d804aa
Commit
67d804aa
authored
Sep 23, 2020
by
WeiCong
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修复was服务器与tomcat不同
parent
e8cde8e0
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
9 deletions
+10
-9
ResourceAccessFilter.java
...rg/sss/presentation/noui/filter/ResourceAccessFilter.java
+10
-9
No files found.
src/main/java/org/sss/presentation/noui/filter/ResourceAccessFilter.java
View file @
67d804aa
...
@@ -31,9 +31,9 @@ public class ResourceAccessFilter implements Filter {
...
@@ -31,9 +31,9 @@ public class ResourceAccessFilter implements Filter {
HttpServletRequest
request
=
(
HttpServletRequest
)
req
;
HttpServletRequest
request
=
(
HttpServletRequest
)
req
;
HttpServletResponse
response
=
(
HttpServletResponse
)
res
;
HttpServletResponse
response
=
(
HttpServletResponse
)
res
;
String
uri
=
request
.
getRequestURI
();
String
uri
=
request
.
getRequestURI
();
String
servletPath
=
request
.
getServletPath
()
;
String
pdfres
;
if
(
needPdfsFilter
(
servletPath
)
)
{
if
(
(
pdfres
=
needPdfsFilter
(
uri
))!=
null
)
{
if
(!
doPdfsFilter
(
servletPath
,
request
,
response
))
{
if
(!
doPdfsFilter
(
uri
,
pdfres
,
request
,
response
))
{
return
;
return
;
}
}
}
else
if
(
isExcludeRes
(
uri
))
{
}
else
if
(
isExcludeRes
(
uri
))
{
...
@@ -43,12 +43,12 @@ public class ResourceAccessFilter implements Filter {
...
@@ -43,12 +43,12 @@ public class ResourceAccessFilter implements Filter {
chain
.
doFilter
(
req
,
res
);
chain
.
doFilter
(
req
,
res
);
}
}
}
catch
(
Throwable
b
)
{
}
catch
(
Throwable
b
)
{
log
.
warn
(
"资源访问过滤器执行异常
:"
+
b
.
getMessage
()
);
log
.
warn
(
"资源访问过滤器执行异常
"
);
chain
.
doFilter
(
req
,
res
);
chain
.
doFilter
(
req
,
res
);
}
}
}
}
private
boolean
doPdfsFilter
(
String
uri
,
HttpServletRequest
request
,
HttpServletResponse
response
)
throws
Exception
{
private
boolean
doPdfsFilter
(
String
uri
,
String
pdfres
,
HttpServletRequest
request
,
HttpServletResponse
response
)
throws
Exception
{
String
[]
parts
=
uri
.
split
(
"_"
);
String
[]
parts
=
uri
.
split
(
"_"
);
if
(
parts
.
length
!=
3
)
{
if
(
parts
.
length
!=
3
)
{
log
.
warn
(
"Access Pdfs Forbidden"
);
log
.
warn
(
"Access Pdfs Forbidden"
);
...
@@ -67,6 +67,7 @@ public class ResourceAccessFilter implements Filter {
...
@@ -67,6 +67,7 @@ public class ResourceAccessFilter implements Filter {
return
forbiddenPdf
(
request
,
response
);
return
forbiddenPdf
(
request
,
response
);
}
}
}
}
res
=
res
.
substring
(
res
.
indexOf
(
pdfres
),
res
.
length
());
pdfWriter
(
request
.
getSession
().
getServletContext
().
getResourceAsStream
(
res
),
response
);
pdfWriter
(
request
.
getSession
().
getServletContext
().
getResourceAsStream
(
res
),
response
);
return
false
;
return
false
;
}
}
...
@@ -94,13 +95,13 @@ public class ResourceAccessFilter implements Filter {
...
@@ -94,13 +95,13 @@ public class ResourceAccessFilter implements Filter {
return
true
;
return
true
;
}
}
private
boolean
needPdfsFilter
(
String
uri
)
{
private
String
needPdfsFilter
(
String
uri
)
{
for
(
String
pdf
:
pdfpth
)
{
for
(
String
pdf
:
pdfpth
)
{
if
(
uri
.
startsWith
(
pdf
))
{
if
(
uri
.
contains
(
pdf
))
{
return
true
;
return
pdf
;
}
}
}
}
return
false
;
return
null
;
}
}
private
boolean
isExcludeRes
(
String
uri
)
{
private
boolean
isExcludeRes
(
String
uri
)
{
...
...
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