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
e14c7dad
Commit
e14c7dad
authored
Jan 25, 2017
by
Andy Wilkinson
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch '1.5.x'
parents
661fd848
11d13d10
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
33 additions
and
9 deletions
+33
-9
AbstractEmbeddedServletContainerFactory.java
...ext/embedded/AbstractEmbeddedServletContainerFactory.java
+14
-8
AbstractEmbeddedServletContainerFactoryTests.java
...mbedded/AbstractEmbeddedServletContainerFactoryTests.java
+19
-1
No files found.
spring-boot/src/main/java/org/springframework/boot/context/embedded/AbstractEmbeddedServletContainerFactory.java
View file @
e14c7dad
/*
/*
* Copyright 2012-201
5
the original author or authors.
* Copyright 2012-201
7
the original author or authors.
*
*
* Licensed under the Apache License, Version 2.0 (the "License");
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* you may not use this file except in compliance with the License.
...
@@ -83,15 +83,21 @@ public abstract class AbstractEmbeddedServletContainerFactory
...
@@ -83,15 +83,21 @@ public abstract class AbstractEmbeddedServletContainerFactory
}
}
private
File
getExplodedWarFileDocumentRoot
()
{
private
File
getExplodedWarFileDocumentRoot
()
{
File
file
=
getCodeSourceArchive
();
return
getExplodedWarFileDocumentRoot
(
getCodeSourceArchive
());
}
File
getExplodedWarFileDocumentRoot
(
File
codeSourceFile
)
{
if
(
this
.
logger
.
isDebugEnabled
())
{
if
(
this
.
logger
.
isDebugEnabled
())
{
this
.
logger
.
debug
(
"Code archive: "
+
f
ile
);
this
.
logger
.
debug
(
"Code archive: "
+
codeSourceF
ile
);
}
}
if
(
file
!=
null
&&
file
.
exists
()
if
(
codeSourceFile
!=
null
&&
codeSourceFile
.
exists
())
{
&&
file
.
getAbsolutePath
().
contains
(
"/WEB-INF/"
))
{
String
path
=
codeSourceFile
.
getAbsolutePath
();
String
path
=
file
.
getAbsolutePath
();
int
webInfPathIndex
=
path
path
=
path
.
substring
(
0
,
path
.
indexOf
(
"/WEB-INF/"
));
.
indexOf
(
File
.
separatorChar
+
"WEB-INF"
+
File
.
separatorChar
);
return
new
File
(
path
);
if
(
webInfPathIndex
>=
0
)
{
path
=
path
.
substring
(
0
,
webInfPathIndex
);
return
new
File
(
path
);
}
}
}
return
null
;
return
null
;
}
}
...
...
spring-boot/src/test/java/org/springframework/boot/context/embedded/AbstractEmbeddedServletContainerFactoryTests.java
View file @
e14c7dad
/*
/*
* Copyright 2012-201
6
the original author or authors.
* Copyright 2012-201
7
the original author or authors.
*
*
* Licensed under the Apache License, Version 2.0 (the "License");
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* you may not use this file except in compliance with the License.
...
@@ -942,6 +942,24 @@ public abstract class AbstractEmbeddedServletContainerFactoryTests {
...
@@ -942,6 +942,24 @@ public abstract class AbstractEmbeddedServletContainerFactoryTests {
assertThat
(
options
.
getDevelopment
()).
isEqualTo
(
false
);
assertThat
(
options
.
getDevelopment
()).
isEqualTo
(
false
);
}
}
@Test
public
void
explodedWarFileDocumentRootWhenRunningFromExplodedWar
()
throws
Exception
{
AbstractEmbeddedServletContainerFactory
factory
=
getFactory
();
File
webInfClasses
=
this
.
temporaryFolder
.
newFolder
(
"test.war"
,
"WEB-INF"
,
"lib"
,
"spring-boot.jar"
);
File
documentRoot
=
factory
.
getExplodedWarFileDocumentRoot
(
webInfClasses
);
assertThat
(
documentRoot
)
.
isEqualTo
(
webInfClasses
.
getParentFile
().
getParentFile
().
getParentFile
());
}
@Test
public
void
explodedWarFileDocumentRootWhenRunningFromPackagedWar
()
throws
Exception
{
AbstractEmbeddedServletContainerFactory
factory
=
getFactory
();
File
codeSourceFile
=
this
.
temporaryFolder
.
newFile
(
"test.war"
);
File
documentRoot
=
factory
.
getExplodedWarFileDocumentRoot
(
codeSourceFile
);
assertThat
(
documentRoot
).
isNull
();
}
protected
abstract
void
addConnector
(
int
port
,
protected
abstract
void
addConnector
(
int
port
,
AbstractEmbeddedServletContainerFactory
factory
);
AbstractEmbeddedServletContainerFactory
factory
);
...
...
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