Class WebContent


  • public class WebContent
    extends java.lang.Object
    • Field Detail

      • contentTypeTurtle

        public static final java.lang.String contentTypeTurtle
        See Also:
        Constant Field Values
      • 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
      • contentTypeRDFJSON

        public static final java.lang.String contentTypeRDFJSON
        See Also:
        Constant Field Values
      • contentTypeJSONLD

        public static final java.lang.String contentTypeJSONLD
        See Also:
        Constant Field Values
      • 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
      • contentTypeXMLAlt

        public static final java.lang.String contentTypeXMLAlt
        See Also:
        Constant Field Values
      • contentTypeNQuads

        public static final java.lang.String contentTypeNQuads
        See Also:
        Constant Field Values
      • 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
      • contentTypeTriXxml

        public static final java.lang.String contentTypeTriXxml
        See Also:
        Constant Field Values
      • contentTypeOctets

        public static final java.lang.String contentTypeOctets
        See Also:
        Constant Field Values
      • 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
      • contentTypeN3Alt1

        public static final java.lang.String contentTypeN3Alt1
        See Also:
        Constant Field Values
      • contentTypeN3Alt2

        public static final java.lang.String contentTypeN3Alt2
        See Also:
        Constant Field Values
      • 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
      • 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
      • contentTypeTextTSV

        public static final java.lang.String contentTypeTextTSV
        See Also:
        Constant Field Values
      • langRDFXMLAbbrev

        public static final java.lang.String langRDFXMLAbbrev
        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
      • 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
    • Constructor Detail

      • WebContent

        public WebContent()
    • 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 string
        hintLang - Default language
        target - 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.