Class HttpResolution
java.lang.Object
it.uniroma2.art.semanticturkey.services.STServiceAdapter
it.uniroma2.art.semanticturkey.services.core.HttpResolution
- All Implemented Interfaces:
NewerNewStyleService
,STService
-
Field Summary
Fields inherited from class it.uniroma2.art.semanticturkey.services.STServiceAdapter
applicationEventPublisher, cfManager, stServiceContext
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
contentNegotiation
(jakarta.servlet.http.HttpServletRequest oReq, jakarta.servlet.http.HttpServletResponse oRes, String resURI) Given a resource URI (e.g. http://example#c_123, http://dbpedia.org/resource/Rome), find the project mapped to the URI and, according the Accept header and the rewriting rules configured for the project, returns a 303 with the proper location or that redirects to the resource description serialization (rdfResURI) or to the html resource page (htmlResURI) AnIllegalStateException
is thrown if: - no project is mapped to resURI - no rewriting rule matches resURI If Accept header is not provided, or if it's one not supported, by default the 303 is to the html pagecom.fasterxml.jackson.databind.JsonNode
getBrowsingInfo
(String htmlResURI) Given an (html) resource URI (e.g. http://example#c_123.html, http://dbpedia.org/page/Rome) returns a response with the project name and the inverseRewritingRules for such project.getContentNegotiationSettings
(String projectName) getMappedProject
(String resURI) Returns the Project mapped to the input URI.Returns the mappingvoid
rdfProvider
(jakarta.servlet.http.HttpServletResponse oRes, String rdfResURI) Given a (RDF) resource URI (e.g. http://example#c_123.ttl, http://dbpedia.org/data/Rome.ttl) - detects the project mapped to such URI - then according its inverse rewriting rules retrieves the original resource IRI and the format - finally returns the serialization of the resource description in the above format AnIllegalStateException
is thrown if - no project is mapped to rdfResURI - no inverse rewriting rule matches rdfResURI In case an unsupported format is retrieved, a not-acceptable (406) response is returnedvoid
storeContentNegotiationSettings
(com.fasterxml.jackson.databind.node.ObjectNode settings, String projectName) void
storeUri2ProjectSettings
(Map<String, String> uri2ProjectMap) Methods inherited from class it.uniroma2.art.semanticturkey.services.STServiceAdapter
addValue, checkNotLocallyDefined, createQueryBuilder, generateIRI, generateNatureSPARQLSelectPart, generateNatureSPARQLWherePart, generateResourceWithCustomConstructor, getCodaLexModeForSearchFromLexicalizationModel, getDeleteGraph, getGraphFromNature, getInitializedCodaCore, getManagedConnection, getMetadataGraph, getOptionalProject, getPlatformTransactionManager, getProject, getRepository, getRoleFromNature, getUserNamedGraphs, getWorkingGraph, instantiateSearchStrategy, instantiateSearchStrategy, parseReference, publishResourceDeleted, publishResourceDeleted, removeReifiedValue, retrieveResources, shutDownCodaCore, updateTriplePredicate
-
Constructor Details
-
HttpResolution
public HttpResolution()
-
-
Method Details
-
getContentNegotiationSettings
@STServiceOperation @PreAuthorize("@auth.isAdmin()") public ContentNegotiationSettings getContentNegotiationSettings(String projectName) throws IllegalStateException, STPropertyAccessException, NoSuchSettingsManager, ProjectAccessException, ProjectInexistentException, InvalidProjectNameException -
storeContentNegotiationSettings
@STServiceOperation(method=POST) @PreAuthorize("@auth.isAdmin()") public void storeContentNegotiationSettings(com.fasterxml.jackson.databind.node.ObjectNode settings, String projectName) throws NoSuchSettingsManager, STPropertyAccessException, STPropertyUpdateException, WrongPropertiesException, ProjectAccessException, ProjectInexistentException, InvalidProjectNameException -
getUri2ProjectSettings
@STServiceOperation @PreAuthorize("@auth.isAdmin()") public Map<String,String> getUri2ProjectSettings() throws IllegalStateException, STPropertyAccessException, NoSuchSettingsManager, STPropertyUpdateException, WrongPropertiesExceptionReturns the mapping -
storeUri2ProjectSettings
@STServiceOperation(method=POST) @PreAuthorize("@auth.isAdmin()") public void storeUri2ProjectSettings(Map<String, String> uri2ProjectMap) throws NoSuchSettingsManager, STPropertyAccessException, STPropertyUpdateException, WrongPropertiesException -
contentNegotiation
@STServiceOperation(methods={GET,HEAD}) @Produces("*/*") public void contentNegotiation(jakarta.servlet.http.HttpServletRequest oReq, jakarta.servlet.http.HttpServletResponse oRes, String resURI) throws IOException, NoSuchSettingsManager, STPropertyAccessException, ProjectAccessException, ProjectInexistentException, InvalidProjectNameException Given a resource URI (e.g. http://example#c_123, http://dbpedia.org/resource/Rome), find the project mapped to the URI and, according the Accept header and the rewriting rules configured for the project, returns a 303 with the proper location or that redirects to the resource description serialization (rdfResURI) or to the html resource page (htmlResURI) AnIllegalStateException
is thrown if: - no project is mapped to resURI - no rewriting rule matches resURI If Accept header is not provided, or if it's one not supported, by default the 303 is to the html page- Parameters:
oReq
-oRes
-resURI
-- Throws:
IOException
NoSuchSettingsManager
STPropertyAccessException
ProjectAccessException
ProjectInexistentException
InvalidProjectNameException
-
rdfProvider
@STServiceOperation(methods={GET,HEAD}) @Produces("*/*") public void rdfProvider(jakarta.servlet.http.HttpServletResponse oRes, String rdfResURI) throws IOException, NoSuchSettingsManager, ProjectAccessException, ProjectInexistentException, InvalidProjectNameException, STPropertyAccessException Given a (RDF) resource URI (e.g. http://example#c_123.ttl, http://dbpedia.org/data/Rome.ttl) - detects the project mapped to such URI - then according its inverse rewriting rules retrieves the original resource IRI and the format - finally returns the serialization of the resource description in the above format AnIllegalStateException
is thrown if - no project is mapped to rdfResURI - no inverse rewriting rule matches rdfResURI In case an unsupported format is retrieved, a not-acceptable (406) response is returned- Parameters:
oRes
-rdfResURI
-- Throws:
IOException
NoSuchSettingsManager
ProjectAccessException
ProjectInexistentException
InvalidProjectNameException
STPropertyAccessException
-
getBrowsingInfo
@STServiceOperation public com.fasterxml.jackson.databind.JsonNode getBrowsingInfo(String htmlResURI) throws NoSuchSettingsManager, ProjectAccessException, ProjectInexistentException, InvalidProjectNameException, STPropertyAccessException Given an (html) resource URI (e.g. http://example#c_123.html, http://dbpedia.org/page/Rome) returns a response with the project name and the inverseRewritingRules for such project. In case no project is mapped to such URI, anIllegalStateException
is thrown.- Parameters:
htmlResURI
-- Returns:
- Throws:
NoSuchSettingsManager
ProjectAccessException
ProjectInexistentException
InvalidProjectNameException
STPropertyAccessException
-
getMappedProject
@STServiceOperation public String getMappedProject(String resURI) throws IllegalStateException, STPropertyAccessException, NoSuchSettingsManager, ProjectAccessException, ProjectInexistentException, InvalidProjectNameException Returns the Project mapped to the input URI. In case of no mapping found, throw an uncheckedIllegalStateException
- Parameters:
resURI
-- Returns:
- Throws:
IllegalStateException
STPropertyAccessException
NoSuchSettingsManager
ProjectAccessException
ProjectInexistentException
InvalidProjectNameException
-