Package org.xwiki.rest.script
Class RESTScriptService
- java.lang.Object
-
- org.xwiki.rest.script.RESTScriptService
-
- All Implemented Interfaces:
org.xwiki.script.service.ScriptService
@Component @Named("rest") @Singleton public class RESTScriptService extends Object implements org.xwiki.script.service.ScriptService
Generate REST URLs for different types of resources.- Since:
- 7.2M1
- Version:
- $Id: 466f46f19565ce6314fb59751750a32417198d4e $
-
-
Constructor Summary
Constructors Constructor Description RESTScriptService()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description XWikiRestException
getLastError()
Get the error generated while performing the previously called action.String
url(EntityReference reference)
Create an REST URL representing the passed entity.String
url(EntityReference reference, boolean external)
Create an REST URL representing the passed entity.
-
-
-
Method Detail
-
url
public String url(EntityReference reference)
Create an REST URL representing the passed entity.The URL path will be returned unless the reference wiki is different from the current wiki.
- Parameters:
reference
- an entity reference- Returns:
- the REST URL corresponding to the referenced entity, or null if an error occurs
- Since:
- 7.2M3
-
url
public String url(EntityReference reference, boolean external)
Create an REST URL representing the passed entity.If
external
is false the URL path will be returned unless the reference wiki is different from the current wiki.- Parameters:
reference
- an entity referenceexternal
- indicate if the returned URL should be absolute (to be used by an external service usually)- Returns:
- the REST URL corresponding to the referenced entity, or null if an error occurs
- Since:
- 7.2M3
-
getLastError
public XWikiRestException getLastError()
Get the error generated while performing the previously called action.- Returns:
- an eventual exception or
null
if no exception was thrown
-
-