org.xwiki.rest
Class XWikiResource
java.lang.Object
org.xwiki.rest.XWikiResource
- All Implemented Interfaces:
- org.xwiki.component.phase.Initializable, XWikiRestComponent
- Direct Known Subclasses:
- AllObjectsForClassNameResource, AttachmentAtPageVersionResource, AttachmentHistoryResource, AttachmentResource, AttachmentsAtPageVersionResource, AttachmentsResource, AttachmentVersionResource, BaseAttachmentsResource, BaseSearchResult, ClassesResource, ClassPropertiesResource, ClassPropertyResource, ClassResource, CommentResource, CommentsResource, CommentsVersionResource, CommentVersionResource, ModifiablePageResource, ModificationsResource, ObjectAtPageVersionResource, ObjectPropertiesAtPageVersionResource, ObjectPropertiesResource, ObjectPropertyAtPageVersionResource, ObjectPropertyResource, ObjectResource, ObjectsAtPageVersionResource, ObjectsForClassNameResource, ObjectsResource, PageChildrenResource, PageHistoryResource, PagesForTagsResource, PagesResource, PageTranslationHistoryResource, PageTranslationsResource, PageTranslationVersionResource, PageVersionResource, RootResource, SpaceResource, SpacesResource, SyntaxesResource, TagsResource, WikiPagesResource, WikisResource
@InstantiationStrategy(value=PER_LOOKUP)
public class XWikiResource
- extends java.lang.Object
- implements XWikiRestComponent, org.xwiki.component.phase.Initializable
Base class for all XWiki-related JAX-RS resources. This class provides to subclasses a set of protected fields to
access the XWiki API and a method for retrieving documents in their different incarnations.
- Version:
- $Id: XWikiResource.java 21281 2009-06-13 19:22:09Z sdumitriu $
|
Nested Class Summary |
protected static class |
XWikiResource.DocumentInfo
A wrapper class for returning an XWiki document enriched with information about its status. |
|
Method Summary |
XWikiResource.DocumentInfo |
getDocumentInfo(java.lang.String wikiName,
java.lang.String spaceName,
java.lang.String pageName,
java.lang.String language,
java.lang.String version,
boolean failIfDoesntExist,
boolean failIfLocked)
Retrieve a document. |
java.lang.String |
getUriTemplate()
A special GET method that produces the ad-hoc "uritemplate" media type used for retrieving the URI template
associated to a resource. |
void |
initialize()
Resource initialization. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
xwikiContext
protected com.xpn.xwiki.XWikiContext xwikiContext
xwiki
protected com.xpn.xwiki.XWiki xwiki
xwikiApi
protected com.xpn.xwiki.api.XWiki xwikiApi
xwikiUser
protected java.lang.String xwikiUser
uriInfo
@Context
protected javax.ws.rs.core.UriInfo uriInfo
logger
protected java.util.logging.Logger logger
objectFactory
protected ObjectFactory objectFactory
componentManager
@Requirement
protected org.xwiki.component.manager.ComponentManager componentManager
queryManager
protected org.xwiki.query.QueryManager queryManager
XWikiResource
public XWikiResource()
initialize
public void initialize()
throws org.xwiki.component.phase.InitializationException
- Resource initialization.
- Specified by:
initialize in interface org.xwiki.component.phase.Initializable
- Throws:
org.xwiki.component.phase.InitializationException
getDocumentInfo
public XWikiResource.DocumentInfo getDocumentInfo(java.lang.String wikiName,
java.lang.String spaceName,
java.lang.String pageName,
java.lang.String language,
java.lang.String version,
boolean failIfDoesntExist,
boolean failIfLocked)
throws com.xpn.xwiki.XWikiException
- Retrieve a document. This method never returns null. If something goes wrong with respect to some precondition an
exception is thrown.
- Parameters:
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.
- Returns:
- A DocumentInfo structure containing the actual document and additional information about it.
- Throws:
java.lang.IllegalArgumentException - If a parameter has an incorrect value (e.g. null)
com.xpn.xwiki.XWikiException
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.
getUriTemplate
public java.lang.String getUriTemplate()
- A special GET method that produces the ad-hoc "uritemplate" media type used for retrieving the URI template
associated to a resource. This is an auxiliary method that is used for documenting the REST API.
- Returns:
- The URI template string associated to the requested resource.
Copyright © 2004-2009 XWiki. All Rights Reserved.