|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.olat.core.logging.LogDelegator
org.olat.core.defaults.dispatcher.StaticMediaDispatcher
public class StaticMediaDispatcher
The URL contains the web app version ID to make sure browsers always fetch the newest version after a new release to prevent browser caching issues.
This should only be used to deliver basic files from the body.html and some other static resource. When developing modules, put all your static files like js libraries or other resource into the _static resources folder and include them using the JSAndCSSComponent.java or get the URL to those resources from th ClassPathStaticDispatcher.java
Initial Date: 16.05.2007
| Field Summary | |
|---|---|
static java.lang.String |
NOVERSION
|
static java.lang.String |
STATIC_DIR_NAME
|
| Constructor Summary | |
|---|---|
StaticMediaDispatcher(java.lang.String mapperPathFromConfig)
Constructor |
|
| Method Summary | |
|---|---|
static java.lang.String |
createStaticURIFor(java.lang.String URI)
Create a static URI for this relative URI. |
static java.lang.String |
createStaticURIFor(java.lang.String URI,
boolean addVersionID)
Create a static URI for this relative URI. |
void |
execute(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response,
java.lang.String uriPrefix)
|
static java.lang.String |
getStaticMapperPath()
|
static java.lang.String |
normalizePath(java.lang.String path)
Return a context-relative path, beginning with a "/", that represents the canonical version of the specified path |
static void |
renderStaticURI(StringOutput target,
java.lang.String URI)
Note: use only rarely - all non-generic js libs and css classes should be included using JsAndCssComponent, and all images should be referenced with the css background-image capability. |
static void |
renderStaticURI(StringOutput target,
java.lang.String URI,
boolean addVersionID)
Render a static URL to resource. |
| Methods inherited from class java.lang.Object |
|---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static java.lang.String STATIC_DIR_NAME
public static java.lang.String NOVERSION
| Constructor Detail |
|---|
public StaticMediaDispatcher(java.lang.String mapperPathFromConfig)
mapperPathFromConfig - | Method Detail |
|---|
public void execute(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response,
java.lang.String uriPrefix)
execute in interface DispatcherDispatcher.execute(javax.servlet.http.HttpServletRequest,
javax.servlet.http.HttpServletResponse, java.lang.String)public static java.lang.String normalizePath(java.lang.String path)
".." and "." elements are resolved out. If the specified path attempts to
go outside the boundaries of the current context (i.e. too many ".." path
elements are present), return null instead.
path - Path to be normalized
public static void renderStaticURI(StringOutput target,
java.lang.String URI)
This method will add a version ID to the path that guarantees that the browser fetches the file again when you release a new version of your application.
target - URI - e.g. img/specialimagenotpossiblewithcss.jpg
public static void renderStaticURI(StringOutput target,
java.lang.String URI,
boolean addVersionID)
target - The output targetURI - e.g. img/specialimagenotpossiblewithcss.jpgaddVersionID - true: the build version is added to the URL to force
browser reload the resource when releasing a new version; false:
don't add version (but allow browsers to cache even when resource
has changed). Only use false when really neededpublic static java.lang.String createStaticURIFor(java.lang.String URI)
This method will add a version ID to the path that guarantees that the browser fetches the file again when you release a new version of your application.
URI - e.g. img/specialimagenotpossiblewithcss.jpg
public static java.lang.String createStaticURIFor(java.lang.String URI,
boolean addVersionID)
URI - e.g. img/specialimagenotpossiblewithcss.jpgaddVersionID - true: the build version is added to the URL to force
browser reload the resource when releasing a new version; false:
don't add version (but allow browsers to cache even when resource
has changed). Only use false when really needed
public static java.lang.String getStaticMapperPath()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||