@InstantiationStrategy(value=PER_LOOKUP) public class XWikiResource extends Object implements XWikiRestComponent, org.xwiki.component.phase.Initializable
Modifier and Type | Class and Description |
---|---|
protected static class |
XWikiResource.DocumentInfo
A wrapper class for returning an XWiki document enriched with information about its status.
|
Modifier and Type | Field and Description |
---|---|
protected org.xwiki.component.manager.ComponentManager |
componentManager
The XWiki component manager that is used to lookup XWiki components and context.
|
protected ObjectFactory |
objectFactory
The object factory for model objects to be used when creating representations.
|
protected QueryManager |
queryManager
The query manager to be used to perform low-level queries for retrieving information about wiki content.
|
protected org.slf4j.Logger |
slf4Jlogger
The logger to be used to output log messages.
|
protected javax.ws.rs.core.UriInfo |
uriInfo
The actual URI information about the JAX-RS resource being called.
|
protected javax.inject.Provider<XWikiContext> |
xcontextProvider |
Constructor and Description |
---|
XWikiResource() |
Modifier and Type | Method and Description |
---|---|
XWikiResource.DocumentInfo |
getDocumentInfo(String wikiName,
List<String> spaces,
String pageName,
String localeString,
String version,
boolean failIfDoesntExist,
boolean failIfLocked)
Retrieve a document.
|
XWikiResource.DocumentInfo |
getDocumentInfo(String wikiName,
String spaceName,
String pageName,
String language,
String version,
boolean failIfDoesntExist,
boolean failIfLocked)
Retrieve a document.
|
protected org.slf4j.Logger |
getLogger() |
SpaceReference |
getSpaceReference(String spaceSegments,
String wikiName) |
String |
getUriTemplate()
A special GET method that produces the ad-hoc "uritemplate" media type used for retrieving the URI template
associated to a resource.
|
protected XWikiContext |
getXWikiContext()
Retrieve the XWiki context from the current execution context.
|
void |
initialize()
Resource initialization.
|
List<String> |
parseSpaceSegments(String spaceSegments) |
@Context protected javax.ws.rs.core.UriInfo uriInfo
@Inject protected org.slf4j.Logger slf4Jlogger
protected ObjectFactory objectFactory
@Inject @Named(value="context") protected org.xwiki.component.manager.ComponentManager componentManager
@Inject protected javax.inject.Provider<XWikiContext> xcontextProvider
@Inject protected QueryManager queryManager
public void initialize() throws org.xwiki.component.phase.InitializationException
initialize
in interface org.xwiki.component.phase.Initializable
org.xwiki.component.phase.InitializationException
public List<String> parseSpaceSegments(String spaceSegments) throws XWikiRestException
spaceSegments
- the space segments of the URL (the URL-encoded value of the /spaces/...
URL
path parameter)XWikiRestException
- if the URL is malformedpublic SpaceReference getSpaceReference(String spaceSegments, String wikiName) throws XWikiRestException
spaceSegments
- the space segments of the URLwikiName
- the name of the wikiXWikiRestException
- if the URL is malformedpublic XWikiResource.DocumentInfo getDocumentInfo(String wikiName, String spaceName, String pageName, String language, String version, boolean failIfDoesntExist, boolean failIfLocked) throws XWikiException, XWikiRestException
wikiName
- The wiki name. Cannot be null.spaceName
- The space name. Cannot be null.pageName
- The page name. Cannot be null.language
- The language. Null for the default language.version
- The version. Null for the latest version.failIfDoesntExist
- True if an exception should be raised whenever the page doesn't exist.failIfLocked
- True if an exception should be raised whenever the page is locked.IllegalArgumentException
- If a parameter has an incorrect value (e.g. null)javax.ws.rs.WebApplicationException
- NOT_FOUND if failIfDoesntExist is true and the page doesn't exist.XWikiRestException
- if the URL is malformed PRECONDITION_FAILED if failIfLocked is true and the document
is locked.XWikiException
public XWikiResource.DocumentInfo getDocumentInfo(String wikiName, List<String> spaces, String pageName, String localeString, String version, boolean failIfDoesntExist, boolean failIfLocked) throws XWikiException
wikiName
- The wiki name. Cannot be null.spaces
- The space hierarchy. Cannot be null.pageName
- The page name. Cannot be null.localeString
- The language. Null for the default language.version
- The version. Null for the latest version.failIfDoesntExist
- True if an exception should be raised whenever the page doesn't exist.failIfLocked
- True if an exception should be raised whenever the page is locked.IllegalArgumentException
- If a parameter has an incorrect value (e.g. null)javax.ws.rs.WebApplicationException
- NOT_FOUND if failIfDoesntExist is true and the page doesn't exist.
PRECONDITION_FAILED if failIfLocked is true and the document is locked.XWikiException
public String getUriTemplate()
protected XWikiContext getXWikiContext()
protected org.slf4j.Logger getLogger()
Copyright © 2004–2021 XWiki. All rights reserved.