Package org.apache.jena.riot
Class WebContent
- java.lang.Object
-
- org.apache.jena.riot.WebContent
-
public class WebContent extends java.lang.Object
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.String
charsetASCII
static java.lang.String
charsetUTF8
static java.lang.String
contentTypeHTMLForm
static java.lang.String
contentTypeJSON
static java.lang.String
contentTypeJSONLD
static java.lang.String
contentTypeMultiAlt
static java.lang.String
contentTypeMultipartFormData
static java.lang.String
contentTypeMultipartMixed
static java.lang.String
contentTypeN3
static java.lang.String
contentTypeN3Alt1
static java.lang.String
contentTypeN3Alt2
static java.lang.String
contentTypeNQuads
static java.lang.String
contentTypeNQuadsAlt1
static java.lang.String
contentTypeNTriples
static java.lang.String
contentTypeNTriplesAlt
static java.lang.String
contentTypeOctets
static java.lang.String
contentTypeRDFJSON
static java.lang.String
contentTypeRDFProto
static java.lang.String
contentTypeRDFThrift
static java.lang.String
contentTypeRDFXML
static java.lang.String
contentTypeResultsJSON
static java.lang.String
contentTypeResultsProtobuf
static java.lang.String
contentTypeResultsThrift
static java.lang.String
contentTypeResultsXML
static java.lang.String
contentTypeSPARQLQuery
static java.lang.String
contentTypeSPARQLUpdate
static java.lang.String
contentTypeSSE
static java.lang.String
contentTypeTextCSV
static java.lang.String
contentTypeTextPlain
static java.lang.String
contentTypeTextTSV
static java.lang.String
contentTypeTriG
static java.lang.String
contentTypeTriGAlt1
static java.lang.String
contentTypeTriX
static java.lang.String
contentTypeTriXxml
static java.lang.String
contentTypeTurtle
static java.lang.String
contentTypeTurtleAlt1
static java.lang.String
contentTypeXML
static java.lang.String
contentTypeXMLAlt
static ContentType
ctHTMLForm
static ContentType
ctJSON
static ContentType
ctJSONLD
static ContentType
ctMultiAlt
static ContentType
ctMultipartFormData
static ContentType
ctMultipartMixed
static ContentType
ctN3Alt1
static ContentType
ctN3Alt2
static ContentType
ctNQuads
static ContentType
ctNQuadsAlt1
static ContentType
ctNTriples
static ContentType
ctNTriplesAlt
static ContentType
ctOctets
static ContentType
ctRDFJSON
static ContentType
ctRDFProto
static ContentType
ctRDFTHRIFT
static ContentType
ctRDFXML
static ContentType
ctResultsJSON
static ContentType
ctResultsProtobuf
static ContentType
ctResultsThrift
static ContentType
ctResultsXML
static ContentType
ctSPARQLQuery
static ContentType
ctSPARQLUpdate
static ContentType
ctSSE
static ContentType
ctTextCSV
static ContentType
ctTextPlain
static ContentType
ctTextTSV
static ContentType
ctTriG
static ContentType
ctTriGAlt1
static ContentType
ctTriX
static ContentType
ctTriXxml
static ContentType
ctTurtle
static ContentType
ctTurtleAlt1
static ContentType
ctTypeN3
static ContentType
ctXML
static ContentType
ctXMLAlt
static java.lang.String
defaultDatasetAcceptHeader
Accept header when looking for a datasetstatic java.lang.String
defaultGraphAcceptHeader
Accept header when looking for a graphstatic java.lang.String
defaultRDFAcceptHeader
Accept header when looking for a graph or datasetstatic java.lang.String
defaultSparqlAskHeader
static java.lang.String
defaultSparqlResultsHeader
static java.lang.String
encodingDeflate
static java.lang.String
encodingGzip
static java.lang.String
encodingUTF8
Java name for UTF-8 encodingstatic java.lang.String
langN3
static java.lang.String
langNQuads
static java.lang.String
langNTriple
static java.lang.String
langNTriples
static java.lang.String
langRdfJson
static java.lang.String
langRDFXML
static java.lang.String
langRDFXMLAbbrev
static java.lang.String
langTriG
static java.lang.String
langTTL
static java.lang.String
langTurtle
static java.lang.String
sparqlAsk
static java.lang.String
sparqlResults
-
Constructor Summary
Constructors Constructor Description WebContent()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static java.lang.String
contentTypeCanonical(java.lang.String contentType)
Return our "canonical" name for a Content Type.static Lang
contentTypeToLangResultSet(java.lang.String contentType)
Map content-type to lang for SPARQL results, with pragmatic adapters.static ContentType
determineCT(java.lang.String contentTypeStr, Lang hintLang, java.lang.String target)
Determine the content type to be used, given the target URL, the content-type from Content Negotiation and a hint language.static boolean
isHtmlForm(ContentType ct)
static boolean
isMultiPartForm(ContentType ct)
static boolean
matchContentType(java.lang.String ct1, java.lang.String ct2)
static boolean
matchContentType(ContentType ct1, ContentType ct2)
Match content type (ignores charsets and other parameters)
-
-
-
Field Detail
-
contentTypeTurtle
public static final java.lang.String contentTypeTurtle
- See Also:
- Constant Field Values
-
ctTurtle
public static final ContentType ctTurtle
-
contentTypeTurtleAlt1
public static final java.lang.String contentTypeTurtleAlt1
- See Also:
- Constant Field Values
-
ctTurtleAlt1
public static final ContentType ctTurtleAlt1
-
contentTypeRDFXML
public static final java.lang.String contentTypeRDFXML
- See Also:
- Constant Field Values
-
ctRDFXML
public static final ContentType ctRDFXML
-
contentTypeRDFJSON
public static final java.lang.String contentTypeRDFJSON
- See Also:
- Constant Field Values
-
ctRDFJSON
public static final ContentType ctRDFJSON
-
contentTypeJSONLD
public static final java.lang.String contentTypeJSONLD
- See Also:
- Constant Field Values
-
ctJSONLD
public static final ContentType ctJSONLD
-
contentTypeTextPlain
public static final java.lang.String contentTypeTextPlain
- See Also:
- Constant Field Values
-
ctTextPlain
public static final ContentType ctTextPlain
-
contentTypeNTriples
public static final java.lang.String contentTypeNTriples
- See Also:
- Constant Field Values
-
ctNTriples
public static final ContentType ctNTriples
-
contentTypeNTriplesAlt
public static final java.lang.String contentTypeNTriplesAlt
- See Also:
- Constant Field Values
-
ctNTriplesAlt
public static final ContentType ctNTriplesAlt
-
contentTypeXML
public static final java.lang.String contentTypeXML
- See Also:
- Constant Field Values
-
ctXML
public static final ContentType ctXML
-
contentTypeXMLAlt
public static final java.lang.String contentTypeXMLAlt
- See Also:
- Constant Field Values
-
ctXMLAlt
public static final ContentType ctXMLAlt
-
contentTypeTriG
public static final java.lang.String contentTypeTriG
- See Also:
- Constant Field Values
-
ctTriG
public static final ContentType ctTriG
-
contentTypeNQuads
public static final java.lang.String contentTypeNQuads
- See Also:
- Constant Field Values
-
ctNQuads
public static final ContentType ctNQuads
-
contentTypeTriGAlt1
public static final java.lang.String contentTypeTriGAlt1
- See Also:
- Constant Field Values
-
ctTriGAlt1
public static final ContentType ctTriGAlt1
-
contentTypeRDFProto
public static final java.lang.String contentTypeRDFProto
- See Also:
- Constant Field Values
-
ctRDFProto
public static final ContentType ctRDFProto
-
contentTypeRDFThrift
public static final java.lang.String contentTypeRDFThrift
- See Also:
- Constant Field Values
-
ctRDFTHRIFT
public static final ContentType ctRDFTHRIFT
-
contentTypeNQuadsAlt1
public static final java.lang.String contentTypeNQuadsAlt1
- See Also:
- Constant Field Values
-
ctNQuadsAlt1
public static final ContentType ctNQuadsAlt1
-
contentTypeTriX
public static final java.lang.String contentTypeTriX
- See Also:
- Constant Field Values
-
ctTriX
public static final ContentType ctTriX
-
contentTypeTriXxml
public static final java.lang.String contentTypeTriXxml
- See Also:
- Constant Field Values
-
ctTriXxml
public static final ContentType ctTriXxml
-
contentTypeOctets
public static final java.lang.String contentTypeOctets
- See Also:
- Constant Field Values
-
ctOctets
public static final ContentType ctOctets
-
contentTypeMultipartMixed
public static final java.lang.String contentTypeMultipartMixed
- See Also:
- Constant Field Values
-
ctMultipartMixed
public static final ContentType ctMultipartMixed
-
contentTypeMultipartFormData
public static final java.lang.String contentTypeMultipartFormData
- See Also:
- Constant Field Values
-
ctMultipartFormData
public static final ContentType ctMultipartFormData
-
contentTypeMultiAlt
public static final java.lang.String contentTypeMultiAlt
- See Also:
- Constant Field Values
-
ctMultiAlt
public static final ContentType ctMultiAlt
-
contentTypeN3
public static final java.lang.String contentTypeN3
- See Also:
- Constant Field Values
-
ctTypeN3
public static final ContentType ctTypeN3
-
contentTypeN3Alt1
public static final java.lang.String contentTypeN3Alt1
- See Also:
- Constant Field Values
-
ctN3Alt1
public static final ContentType ctN3Alt1
-
contentTypeN3Alt2
public static final java.lang.String contentTypeN3Alt2
- See Also:
- Constant Field Values
-
ctN3Alt2
public static final ContentType ctN3Alt2
-
contentTypeResultsXML
public static final java.lang.String contentTypeResultsXML
- See Also:
- Constant Field Values
-
ctResultsXML
public static final ContentType ctResultsXML
-
contentTypeResultsJSON
public static final java.lang.String contentTypeResultsJSON
- See Also:
- Constant Field Values
-
ctResultsJSON
public static final ContentType ctResultsJSON
-
contentTypeJSON
public static final java.lang.String contentTypeJSON
- See Also:
- Constant Field Values
-
ctJSON
public static final ContentType ctJSON
-
contentTypeResultsProtobuf
public static final java.lang.String contentTypeResultsProtobuf
- See Also:
- Constant Field Values
-
ctResultsProtobuf
public static final ContentType ctResultsProtobuf
-
contentTypeResultsThrift
public static final java.lang.String contentTypeResultsThrift
- See Also:
- Constant Field Values
-
ctResultsThrift
public static final ContentType ctResultsThrift
-
contentTypeSPARQLQuery
public static final java.lang.String contentTypeSPARQLQuery
- See Also:
- Constant Field Values
-
ctSPARQLQuery
public static final ContentType ctSPARQLQuery
-
contentTypeSPARQLUpdate
public static final java.lang.String contentTypeSPARQLUpdate
- See Also:
- Constant Field Values
-
ctSPARQLUpdate
public static final ContentType ctSPARQLUpdate
-
contentTypeHTMLForm
public static final java.lang.String contentTypeHTMLForm
- See Also:
- Constant Field Values
-
ctHTMLForm
public static final ContentType ctHTMLForm
-
contentTypeTextCSV
public static final java.lang.String contentTypeTextCSV
- See Also:
- Constant Field Values
-
ctTextCSV
public static final ContentType ctTextCSV
-
contentTypeTextTSV
public static final java.lang.String contentTypeTextTSV
- See Also:
- Constant Field Values
-
ctTextTSV
public static final ContentType ctTextTSV
-
contentTypeSSE
public static final java.lang.String contentTypeSSE
- See Also:
- Constant Field Values
-
ctSSE
public static final ContentType ctSSE
-
charsetUTF8
public static final java.lang.String charsetUTF8
- See Also:
- Constant Field Values
-
charsetASCII
public static final java.lang.String charsetASCII
- See Also:
- Constant Field Values
-
langRDFXML
public static final java.lang.String langRDFXML
- See Also:
- Constant Field Values
-
langRDFXMLAbbrev
public static final java.lang.String langRDFXMLAbbrev
- See Also:
- Constant Field Values
-
langNTriple
public static final java.lang.String langNTriple
- See Also:
- Constant Field Values
-
langNTriples
public static final java.lang.String langNTriples
- See Also:
- Constant Field Values
-
langN3
public static final java.lang.String langN3
- See Also:
- Constant Field Values
-
langTurtle
public static final java.lang.String langTurtle
- See Also:
- Constant Field Values
-
langTTL
public static final java.lang.String langTTL
- See Also:
- Constant Field Values
-
langRdfJson
public static final java.lang.String langRdfJson
- See Also:
- Constant Field Values
-
langNQuads
public static final java.lang.String langNQuads
- See Also:
- Constant Field Values
-
langTriG
public static final java.lang.String langTriG
- See Also:
- Constant Field Values
-
encodingUTF8
public static final java.lang.String encodingUTF8
Java name for UTF-8 encoding- See Also:
- Constant Field Values
-
defaultGraphAcceptHeader
public static final java.lang.String defaultGraphAcceptHeader
Accept header when looking for a graph- See Also:
- Constant Field Values
-
defaultDatasetAcceptHeader
public static final java.lang.String defaultDatasetAcceptHeader
Accept header when looking for a dataset- See Also:
- Constant Field Values
-
defaultRDFAcceptHeader
public static final java.lang.String defaultRDFAcceptHeader
Accept header when looking for a graph or dataset- See Also:
- Constant Field Values
-
encodingGzip
public static final java.lang.String encodingGzip
- See Also:
- Constant Field Values
-
encodingDeflate
public static final java.lang.String encodingDeflate
- See Also:
- Constant Field Values
-
sparqlResults
public static final java.lang.String sparqlResults
-
defaultSparqlResultsHeader
public static final java.lang.String defaultSparqlResultsHeader
-
sparqlAsk
public static final java.lang.String sparqlAsk
-
defaultSparqlAskHeader
public static final java.lang.String defaultSparqlAskHeader
-
-
Method Detail
-
contentTypeCanonical
public static java.lang.String contentTypeCanonical(java.lang.String contentType)
Return our "canonical" name for a Content Type. This should be the standard one, no X-*, no alternative names.
-
matchContentType
public static boolean matchContentType(ContentType ct1, ContentType ct2)
Match content type (ignores charsets and other parameters)
-
matchContentType
public static boolean matchContentType(java.lang.String ct1, java.lang.String ct2)
-
isHtmlForm
public static boolean isHtmlForm(ContentType ct)
-
isMultiPartForm
public static boolean isMultiPartForm(ContentType ct)
-
determineCT
public static ContentType determineCT(java.lang.String contentTypeStr, Lang hintLang, java.lang.String target)
Determine the content type to be used, given the target URL, the content-type from Content Negotiation and a hint language. This is a pragmatic balance. A content-type of "text/plain" is ignored - it is too often wrong.
The decision is
Content type (but not text/plain) > hint > file extension.
We make content type (via content negotiation) strongest because a server may return something unexpected because that is all it can do. We are assuming servers don't lie. The "hint" is really a hint just for file extension override.In the case of no file extension, this reduces to the hint being the default choice if conneg does not produce anything useful.
- Parameters:
contentTypeStr
- Content-Type stringhintLang
- Default languagetarget
- The URL of the target (file extension may be used)- Returns:
- ContentType or null
-
contentTypeToLangResultSet
public static Lang contentTypeToLangResultSet(java.lang.String contentType)
Map content-type to lang for SPARQL results, with pragmatic adapters.
-
-