Package org.openjena.atlas.web

Examples of org.openjena.atlas.web.MediaType


    }
    public static String mapLangToContentType(Lang lang) { return mapLangToContentType.get(lang) ; }
   
    public static String getCharsetForContentType(String contentType)
    {
        MediaType ct = MediaType.create(contentType) ;
        if ( ct.getCharset() != null )
            return ct.getCharset() ;
       
        String mt = ct.getContentType() ;
        if ( contentTypeNTriples.equals(mt) )       return charsetASCII ;
        if ( contentTypeNTriplesAlt.equals(mt) )    return charsetASCII ;
        if ( contentTypeNQuads.equals(mt) )         return charsetASCII ;
        if ( contentTypeNQuadsAlt.equals(mt) )      return charsetASCII ;
        return charsetUTF8 ;
View Full Code Here


                choice = m ; 
            }
        }
        if ( choice == null )
            return null ;
        return new MediaType(choice);
    }
View Full Code Here

    /** Match a single media type against a header string */
    public static String match(String headerString, String mediaRangeStr)
    {
        AcceptList l = new AcceptList(headerString) ;
        MediaRange aItem = new MediaRange(mediaRangeStr) // MediaType
        MediaType m = l.match(aItem) ;
        if ( m == null )
            return null ;
        return m.toHeaderString() ;
    }
View Full Code Here

    {
        String a = httpRequest.getHeader(hAcceptCharset) ;
        if ( log.isDebugEnabled() )
            log.debug("Accept-Charset request: "+a) ;
       
        MediaType item = choose(a, myPrefs, defaultMediaType) ;
       
        if ( log.isDebugEnabled() )
            log.debug("Charset chosen: "+item) ;
   
        return item ;
View Full Code Here

    {
        String a = WebLib.getAccept(httpRequest) ;
        if ( log.isDebugEnabled() )
            log.debug("Accept request: "+a) ;
       
        MediaType item = choose(a, myPrefs, defaultMediaType) ;
   
        if ( log.isDebugEnabled() )
            log.debug("Content type chosen: "+item) ;
   
        return item ;
View Full Code Here

        AcceptList headerList = new AcceptList(headerString) ;
       
        if ( myPrefs == null )
            return headerList.first() ;
   
        MediaType i = AcceptList.match(headerList, myPrefs) ;
        if ( i == null )
            return defaultMediaType ;
        return i ;
    }
View Full Code Here

        HttpActionUpdate action = new HttpActionUpdate(id, desc, request, response, verbose_debug) ;
       
        // WebContent needs to migrate to using ContentType.
        String ctStr ;
        {
            MediaType incoming = FusekiLib.contentType(request) ;
            if ( incoming == null )
                ctStr = WebContent.contentTypeSPARQLUpdate ;
            else
                ctStr = incoming.getContentType() ;
        }
        // ----
       
        if (WebContent.contentTypeSPARQLUpdate.equals(ctStr))
        {
View Full Code Here

    private void validate(HttpServletRequest request)
    {
        // WebContent needs to migrate to using ContentType.
        String ctStr ;
        {
            MediaType incoming = FusekiLib.contentType(request) ;
            if ( incoming == null )
                ctStr = WebContent.contentTypeSPARQLUpdate ;
            else
                ctStr = incoming.getContentType() ;
        }
        // ----
       
        if ( WebContent.contentTypeSPARQLUpdate.equals(ctStr) )
        {
View Full Code Here

        {
            executeWithParameter(action) ;
            return ;
        }

        MediaType ct = FusekiLib.contentType(request) ;
        String incoming = ct.getContentType() ;
       
        // POST application/sparql-query
        if (WebContent.contentTypeSPARQLQuery.equals(incoming))
        {
            executeBody(action) ;
View Full Code Here

    protected abstract void validate(HttpServletRequest request) ;
   
    /** Helper for validating request */
    protected void validate(HttpServletRequest request, Set<String> params)
    {
        MediaType ct = FusekiLib.contentType(request) ;
        boolean mustHaveQueryParam = true ;
        if ( ct != null )
        {
            String incoming = ct.getContentType() ;
           
            if ( WebContent.contentTypeSPARQLQuery.equals(incoming) )
            {
                mustHaveQueryParam = false ;
                //error(HttpSC.UNSUPPORTED_MEDIA_TYPE_415, "Unofficial "+WebContent.contentTypeSPARQLQuery+" not supported") ;
View Full Code Here

TOP

Related Classes of org.openjena.atlas.web.MediaType

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.