@Component @Named(value="webjars") @Singleton public class WebJarsScriptService extends Object implements org.xwiki.script.service.ScriptService
Constructor and Description |
---|
WebJarsScriptService() |
Modifier and Type | Method and Description |
---|---|
String |
url(String resourceName)
Compute an XWiki WebJar URL of the form
http://server/bin/webjars/resource/path?value=(resource name) . |
String |
url(String webjarId,
String path)
Creates an URL that can be used to load a resource (JavaScript, CSS, etc.) from a WebJar.
|
String |
url(String webjarId,
String path,
Map<String,?> params)
Creates an URL that can be used to load a resource (JavaScript, CSS, etc.) from a WebJar.
|
public String url(String resourceName)
http://server/bin/webjars/resource/path?value=(resource name)
.resourceName
- the resource asked (e.g. angular/2.1.11/angular.js"
)public String url(String webjarId, String path)
webjarId
- the id of the WebJar that contains the resource; the format of the WebJar id is
groupId:artifactId
(e.g. org.xwiki.platform:xwiki-platform-job-webjar
), where the
groupId
can be omitted if it is DEFAULT_WEBJAR_GROUP_ID
(i.e. angular
translates to org.webjars:angular
)path
- the path within the WebJar, starting from the version folder (e.g. you should pass just
angular.js
if the actual path is META-INF/resources/webjars/angular/2.1.11/angular.js
)public String url(String webjarId, String path, Map<String,?> params)
webjarId
- the id of the WebJar that contains the resource; the format of the WebJar id is
groupId:artifactId
(e.g. org.xwiki.platform:xwiki-platform-job-webjar
), where the
groupId
can be omitted if it is DEFAULT_WEBJAR_GROUP_ID
(i.e. angular
translates to org.webjars:angular
)path
- the path within the WebJar, starting from the version folder (e.g. you should pass just
angular.js
if the actual path is META-INF/resources/webjars/angular/2.1.11/angular.js
)params
- additional query string parameters to add to the returned URL; there are two known (reserved)
parameters: version
(the WebJar version) and evaluate
(a boolean parameter that
specifies if the requested resource has Velocity code that needs to be evaluated); besides these you
can pass whatever parameters you like (they will be taken into account or not depending on the
resource)Copyright © 2004–2015 XWiki. All rights reserved.