-
Notifications
You must be signed in to change notification settings - Fork 29
Static Resources
David Willson edited this page Jun 25, 2014
·
1 revision
-
Create a "resources" directory under src
-
Put your static files in that directory
-
Add an entry to the maven-assembly-plugin configuration section of pom.xml as follows. Replace NameHere with a unique name
<archive> <manifestEntries> <Plugin-Name>NameHere</Plugin-Name> </manifestEntries> </archive>
-
Add an entry to the build configuration section as follows:
<resources> <resource> <directory>src</directory> <includes> <include>resources/**</include> </includes> </resource> </resources>
-
Compile and assemble package normally
-
Resources can be accessed through the API as
/testproxy/api/resource/NameHere/fileName
Example HTML embed:
<img src="http://localhost:8090/testproxy/api/resource/NameHere/logo-line.jpg"/>
-
Resource can be accessed in a plugin function using
getResourceAsStream
on the current class (example classname isMyClass
)InputStream resource = MyClass.class.getResourceAsStream("/resources/resource1.json");