Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in / Register
Toggle navigation
S
spring-boot
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
DEMO
spring-boot
Commits
da50eb9a
Commit
da50eb9a
authored
Dec 15, 2015
by
Phillip Webb
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #4766 from mbenson/issue-4765
* pr/4766: Use canonical paths for Undertow document root
parents
097e5881
cc40dceb
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
17 additions
and
2 deletions
+17
-2
UndertowEmbeddedServletContainerFactory.java
...ded/undertow/UndertowEmbeddedServletContainerFactory.java
+17
-2
No files found.
spring-boot/src/main/java/org/springframework/boot/context/embedded/undertow/UndertowEmbeddedServletContainerFactory.java
View file @
da50eb9a
...
@@ -427,8 +427,7 @@ public class UndertowEmbeddedServletContainerFactory
...
@@ -427,8 +427,7 @@ public class UndertowEmbeddedServletContainerFactory
}
}
private
ResourceManager
getDocumentRootResourceManager
()
{
private
ResourceManager
getDocumentRootResourceManager
()
{
File
root
=
getValidDocumentRoot
();
File
root
=
getCanonicalDocumentRoot
();
root
=
(
root
!=
null
?
root
:
createTempDir
(
"undertow-docbase"
));
if
(
root
.
isDirectory
())
{
if
(
root
.
isDirectory
())
{
return
new
FileResourceManager
(
root
,
0
);
return
new
FileResourceManager
(
root
,
0
);
}
}
...
@@ -438,6 +437,22 @@ public class UndertowEmbeddedServletContainerFactory
...
@@ -438,6 +437,22 @@ public class UndertowEmbeddedServletContainerFactory
return
ResourceManager
.
EMPTY_RESOURCE_MANAGER
;
return
ResourceManager
.
EMPTY_RESOURCE_MANAGER
;
}
}
/**
* Return the document root in canonical form. Undertow uses File#getCanonicalFile()
* to determine whether a resource has been requested using the proper case but on
* Windows {@code java.io.tmpdir} may be set as a tilde-compressed pathname.
*/
private
File
getCanonicalDocumentRoot
()
{
try
{
File
root
=
getValidDocumentRoot
();
root
=
(
root
!=
null
?
root
:
createTempDir
(
"undertow-docbase"
));
return
root
.
getCanonicalFile
();
}
catch
(
IOException
e
)
{
throw
new
IllegalStateException
(
"Cannot get canonical document root"
,
e
);
}
}
private
void
configureErrorPages
(
DeploymentInfo
servletBuilder
)
{
private
void
configureErrorPages
(
DeploymentInfo
servletBuilder
)
{
for
(
ErrorPage
errorPage
:
getErrorPages
())
{
for
(
ErrorPage
errorPage
:
getErrorPages
())
{
servletBuilder
.
addErrorPage
(
getUndertowErrorPage
(
errorPage
));
servletBuilder
.
addErrorPage
(
getUndertowErrorPage
(
errorPage
));
...
...
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