|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.apache.stanbol.commons.web.base.resource.BaseStanbolResource
org.apache.stanbol.contenthub.web.resources.StoreResource
public class StoreResource
Resource to provide a CRU[D] REST API for content items and there related enhancements.
Creation is achieved using either POST requests on the root of the store or as PUT requests on the expected content item URI.
Retrieval is achieved using simple GET requests on the content item or enhancement public URIs.
| Nested Class Summary |
|---|
| Nested classes/interfaces inherited from class org.apache.stanbol.commons.web.base.resource.BaseStanbolResource |
|---|
org.apache.stanbol.commons.web.base.resource.BaseStanbolResource.MenuItem |
| Field Summary | |
|---|---|
static Set<String> |
RDF_MEDIA_TYPES
|
| Fields inherited from class org.apache.stanbol.commons.web.base.resource.BaseStanbolResource |
|---|
LINK_RESOURCES, NAVIGATION_LINKS, ROOT_URL, SCRIPT_RESOURCES, servletContext, STATIC_RESOURCES_ROOT_URL, SYSTEM_CONSOLE |
| Constructor Summary | |
|---|---|
StoreResource(javax.servlet.ServletContext context,
javax.ws.rs.core.UriInfo uriInfo,
String indexName)
|
|
| Method Summary | |
|---|---|
javax.ws.rs.core.Response |
createContentItem(org.apache.stanbol.enhancer.servicesapi.ContentItem ci,
String title,
String chain,
javax.ws.rs.core.HttpHeaders headers)
HTTP POST method to create a content item in Contenthub. |
javax.ws.rs.core.Response |
createContentItemFromForm(String uri,
String content,
String url,
String title,
String chain,
javax.ws.rs.core.HttpHeaders headers)
HTTP POST method to create a content item in Contenthub. |
javax.ws.rs.core.Response |
createContentItemWithRawData(byte[] data,
String uri,
String title,
String chain,
javax.ws.rs.core.HttpHeaders headers)
HTTP POST method to create a content item in Contenthub. |
javax.ws.rs.core.Response |
deleteContentItem(String uri,
javax.ws.rs.core.HttpHeaders headers)
HTTP DELETE method to delete a content item from Contenhub. |
javax.ws.rs.core.Response |
deleteContentItemByForm(String uri,
javax.ws.rs.core.HttpHeaders headers)
This method deletes the ContentItem specified by the given QueryParam. |
javax.ws.rs.core.Response |
downloadContentItem(String type,
String uri,
String format,
javax.ws.rs.core.HttpHeaders headers)
HTTP GET method specific for download operations. |
javax.ws.rs.core.Response |
getContent(String uri,
javax.ws.rs.core.HttpHeaders headers)
Cool URI handler for the uploaded resource. |
javax.ws.rs.core.Response |
getContentItemMetaData(String uri,
String format,
javax.ws.rs.core.HttpHeaders headers)
HTTP GET method to retrieve the metadata of the content item. |
ContentItemResource |
getContentItemView(String uri)
|
String |
getIndexName()
|
URI |
getMoreRecentItemsUri()
|
URI |
getOlderItemsUri()
|
javax.ws.rs.core.Response |
getRawContent(String uri,
javax.ws.rs.core.HttpHeaders headers)
HTTP GET method to retrieve the raw content item. |
List<org.apache.stanbol.contenthub.servicesapi.search.featured.DocumentResult> |
getRecentlyEnhancedItems()
|
org.apache.stanbol.commons.viewable.Viewable |
getView(javax.servlet.ServletContext context,
int offset,
int pageSize)
|
javax.ws.rs.core.Response |
handleCorsPreflight(javax.ws.rs.core.HttpHeaders headers)
|
javax.ws.rs.core.Response |
handleCorsPreflightContent(javax.ws.rs.core.HttpHeaders headers)
|
javax.ws.rs.core.Response |
handleCorsPreflightDownload(javax.ws.rs.core.HttpHeaders headers)
|
javax.ws.rs.core.Response |
handleCorsPreflightMetadata(javax.ws.rs.core.HttpHeaders headers)
|
javax.ws.rs.core.Response |
handleCorsPreflightRaw(javax.ws.rs.core.HttpHeaders headers)
|
javax.ws.rs.core.Response |
handleCorsPreflightURI(javax.ws.rs.core.HttpHeaders headers)
|
| Methods inherited from class org.apache.stanbol.commons.web.base.resource.BaseStanbolResource |
|---|
getConsoleBaseUri, getMainMenuItems, getNavigationLinks, getPublicBaseUri, getRegisteredLinkResources, getRegisteredScriptResources, getRequestUri, getRootUrl, getStaticRootUrl |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final Set<String> RDF_MEDIA_TYPES
| Constructor Detail |
|---|
public StoreResource(@Context
javax.servlet.ServletContext context,
@Context
javax.ws.rs.core.UriInfo uriInfo,
String indexName)
context - uriInfo - indexName - Name of the LDPath program (name of the Solr core/index) to be used while storing this
content item. LDPath programs can be managed through SemanticIndexManagerResource or
SemanticIndexManager| Method Detail |
|---|
public javax.ws.rs.core.Response handleCorsPreflight(@Context
javax.ws.rs.core.HttpHeaders headers)
public javax.ws.rs.core.Response handleCorsPreflightContent(@Context
javax.ws.rs.core.HttpHeaders headers)
public javax.ws.rs.core.Response handleCorsPreflightDownload(@Context
javax.ws.rs.core.HttpHeaders headers)
public javax.ws.rs.core.Response handleCorsPreflightMetadata(@Context
javax.ws.rs.core.HttpHeaders headers)
public javax.ws.rs.core.Response handleCorsPreflightRaw(@Context
javax.ws.rs.core.HttpHeaders headers)
public javax.ws.rs.core.Response handleCorsPreflightURI(@Context
javax.ws.rs.core.HttpHeaders headers)
public javax.ws.rs.core.Response getContent(String uri,
@Context
javax.ws.rs.core.HttpHeaders headers)
throws org.apache.stanbol.contenthub.servicesapi.store.StoreException
SupportedFormat
annotation, the request is redirected to the metadata endpoint and metadata of the specified
ContentItem is returned.ContentItem is returned.
uri - The URI of the resource in the Stanbol Contenthub storeheaders - HTTP headers
org.apache.stanbol.contenthub.servicesapi.store.StoreException
public javax.ws.rs.core.Response downloadContentItem(String type,
String uri,
String format,
@Context
javax.ws.rs.core.HttpHeaders headers)
throws IOException,
org.apache.stanbol.contenthub.servicesapi.store.StoreException
type - Type can be "metadata" or "raw". Based on the type, related parts of the
content item will be prepared for download.uri - URI of the ContentItem in the Contenthubformat - Rdf serialization format of metadata
IOException
org.apache.stanbol.contenthub.servicesapi.store.StoreException
public javax.ws.rs.core.Response getContentItemMetaData(String uri,
String format,
@Context
javax.ws.rs.core.HttpHeaders headers)
throws IOException,
org.apache.stanbol.contenthub.servicesapi.store.StoreException
uri - URI id of the resource in the Stanbol Contenthub store
IOException
org.apache.stanbol.contenthub.servicesapi.store.StoreException
public javax.ws.rs.core.Response getRawContent(String uri,
@Context
javax.ws.rs.core.HttpHeaders headers)
throws IOException,
org.apache.stanbol.contenthub.servicesapi.store.StoreException
uri - URI of the resource in the Stanbol Contenthub store
IOException
org.apache.stanbol.contenthub.servicesapi.store.StoreException
public javax.ws.rs.core.Response createContentItem(org.apache.stanbol.enhancer.servicesapi.ContentItem ci,
String title,
String chain,
@Context
javax.ws.rs.core.HttpHeaders headers)
throws org.apache.stanbol.contenthub.servicesapi.store.StoreException,
URISyntaxException
HTTP POST method to create a content item in Contenthub. This method takes a ContentItem object
directly. This means that the values provided for this service will be parsed by the multipart mime
serialization of Content Items. (see the following links: Content Item Multipart Serialization and Using the
multi-part content item RESTful API extensions)
If the passed ContentItem does already have the metadata part, it is not sent to Stanbol
enhancer to be enhanced.
ci - ContentItem to be stored.title - The title for the content item. Titles can be used to present summary of the actual content.
For example, search results are presented by showing the titles of resultant content items.chain - name of a particular Chain in which the enhancement engines are ordered according to
a specific use case or needheaders - HTTP Headers
org.apache.stanbol.contenthub.servicesapi.store.StoreException
URISyntaxException
public javax.ws.rs.core.Response createContentItemWithRawData(byte[] data,
String uri,
String title,
String chain,
@Context
javax.ws.rs.core.HttpHeaders headers)
throws URISyntaxException,
org.apache.stanbol.enhancer.servicesapi.EngineException,
org.apache.stanbol.contenthub.servicesapi.store.StoreException
data - Raw data of the content itemuri - URI for the content item. If not supplied, Contenthub automatically assigns a unique ID
(uri) to the content item.title - The title for the content item. Titles can be used to present summary of the actual content.
For example, search results are presented by showing the titles of resultant content items.chain - name of a particular Chain in which the enhancement engines are ordered according to
a specific use case or needheaders - HTTP headers
URISyntaxException
org.apache.stanbol.enhancer.servicesapi.EngineException
org.apache.stanbol.contenthub.servicesapi.store.StoreException
public javax.ws.rs.core.Response createContentItemFromForm(String uri,
String content,
String url,
String title,
String chain,
@Context
javax.ws.rs.core.HttpHeaders headers)
throws URISyntaxException,
org.apache.stanbol.enhancer.servicesapi.EngineException,
MalformedURLException,
IOException,
org.apache.stanbol.contenthub.servicesapi.store.StoreException
uri - Optional URI for the content item to be created.content - Actual content in text format. If this parameter is supplied, url is ommitted.url - URL where the actual content resides. If this parameter is supplied (and content is
null, then the content is retrieved from this url.title - The title for the content item. Titles can be used to present summary of the actual content.
For example, search results are presented by showing the titles of resultant content items.chain - name of a particular Chain in which the enhancement engines are ordered according to
a specific use case or needheaders - HTTP headers (optional)
URISyntaxException
org.apache.stanbol.enhancer.servicesapi.EngineException
MalformedURLException
IOException
org.apache.stanbol.contenthub.servicesapi.store.StoreException
public javax.ws.rs.core.Response deleteContentItemByForm(String uri,
@Context
javax.ws.rs.core.HttpHeaders headers)
throws org.apache.stanbol.contenthub.servicesapi.store.StoreException
ContentItem specified by the given QueryParam.
uri - URI of the ContentItem to be deleted.headers -
Response.ok() if the removal is successful
org.apache.stanbol.contenthub.servicesapi.store.StoreException
public javax.ws.rs.core.Response deleteContentItem(String uri,
@Context
javax.ws.rs.core.HttpHeaders headers)
throws org.apache.stanbol.contenthub.servicesapi.store.StoreException
uri - URI of the content item to be deleted.
org.apache.stanbol.contenthub.servicesapi.store.StoreException
public org.apache.stanbol.commons.viewable.Viewable getView(@Context
javax.servlet.ServletContext context,
int offset,
int pageSize)
throws IllegalArgumentException,
IOException,
org.osgi.framework.InvalidSyntaxException
IllegalArgumentException
IOException
org.osgi.framework.InvalidSyntaxException
public ContentItemResource getContentItemView(String uri)
throws IOException,
org.apache.stanbol.contenthub.servicesapi.store.StoreException
IOException
org.apache.stanbol.contenthub.servicesapi.store.StoreException
public List<org.apache.stanbol.contenthub.servicesapi.search.featured.DocumentResult> getRecentlyEnhancedItems()
throws org.apache.clerezza.rdf.core.sparql.ParseException
org.apache.clerezza.rdf.core.sparql.ParseExceptionpublic URI getMoreRecentItemsUri()
public URI getOlderItemsUri()
public String getIndexName()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||