I'm using Spark to serve a web page.. For the static files I initialize Spark like stated here:
So I have this structure:
/src/main/resources/public/
|-- foo/
|-- css/
| |-- bootstrap.css
|-- js/
| ...
|-- img/
...
I made the foo
folder to make a trick because my webpage is located under /foo
url..like this:
http://www.example.com/foo/index
So my static files are loaded like this for example:
http://www.example.com/foo/css/bootstrap.css
What I want now is to have this path variable.. Because I have different environments and for example if I deploy this app in another domain I want it to be:
http://www.example2.com/superfoo/css/bootstrap.css
But for this I have to change the release and change the folder...
For the controllers I made this easily:
Example:
Spark.get(this.appBasePath + "/users", (request, response) -> {
return this.getUsersView(request);
}, new FreeMarkerEngine());
this.appBasePath
comes from a configuration that is loaded deciding the environment.
So what I am asking is to set programmatically the static files URL without making any folder. Is there any way to achieve this?
/env1/css/bootstrap.css
and in another I would have/env1/css/bootstrap.css
withoud changing the code, just a property. – Misname