Package org.apache.wink.common.internal.http

Examples of org.apache.wink.common.internal.http.Accept


            if (mediaRange.length() == 0) {
                continue;
            }
            list.add(MediaType.valueOf(mediaRange));
        }
        return new Accept(list);
    }
View Full Code Here


        return acceptableLanguages;
    }

    public List<MediaType> getAcceptableMediaTypes() {
        if (acceptableMediaTypes == null) {
            Accept acceptHeader = getAcceptHeader();
            acceptableMediaTypes = acceptHeader.getSortedMediaTypes();
        }
        return acceptableMediaTypes;
    }
View Full Code Here

                acceptValue = null;
            } else {
                acceptValue = requestHeader.get(0);
            }
        }
        Accept acceptHeader = Accept.valueOf(acceptValue);
        return acceptHeader;
    }
View Full Code Here

public class AcceptHeaderDelegate implements HeaderDelegate<Accept> {

    private static final SoftConcurrentMap<String, Accept> cache = new SoftConcurrentMap<String, Accept>();
   
    public Accept fromString(String value) throws IllegalArgumentException {
        Accept cached = cache.get(value);
        if (cached != null) {
            return cached;
        }
       
        // if there is no Accept header it means that all media types are
        // acceptable
        if (value == null) {
            value = MediaType.WILDCARD;
        }
        List<MediaType> list = new LinkedList<MediaType>();
        String[] mediaTypes = StringUtils.fastSplit(value, ",");
        for (String mediaRange : mediaTypes) {
            mediaRange = mediaRange.trim();
            if (mediaRange.length() == 0) {
                continue;
            }
            list.add(MediaType.valueOf(mediaRange));
        }
        return cache.put(value, new Accept(list));
    }
View Full Code Here

        return acceptableLanguages;
    }

    public List<MediaType> getAcceptableMediaTypes() {
        if (acceptableMediaTypes == null) {
            Accept acceptHeader = getAcceptHeader();
            acceptableMediaTypes = acceptHeader.getSortedMediaTypes();
        }
        logger.debug("getAcceptableMediaTypes() returns {}", acceptableMediaTypes);
        return acceptableMediaTypes;
    }
View Full Code Here

                acceptValue = requestHeader.get(0);
            }
        }
        try {
            logger.debug("Accept header is: {}", acceptValue);
            Accept acceptHeader = Accept.valueOf(acceptValue);
            logger.debug("getAcceptHeader() returns {}", acceptHeader);
            return acceptHeader;
        } catch (IllegalArgumentException e) {
            logger.debug("Illegal Accept request header: {}", e);
            throw new WebApplicationException(e, 400);
View Full Code Here

        return acceptableLanguages;
    }

    public List<MediaType> getAcceptableMediaTypes() {
        if (acceptableMediaTypes == null) {
            Accept acceptHeader = getAcceptHeader();
            acceptableMediaTypes = acceptHeader.getSortedMediaTypes();
        }
        logger.debug("getAcceptableMediaTypes() returns {}", acceptableMediaTypes); //$NON-NLS-1$
        return acceptableMediaTypes;
    }
View Full Code Here

                acceptValue = requestHeader.get(0);
            }
        }
        try {
            logger.debug("Accept header is: {}", acceptValue); //$NON-NLS-1$
            Accept acceptHeader = Accept.valueOf(acceptValue);
            logger.debug("getAcceptHeader() returns {}", acceptHeader); //$NON-NLS-1$
            return acceptHeader;
        } catch (IllegalArgumentException e) {
            logger.debug("Illegal Accept request header: {}", e); //$NON-NLS-1$
            throw new WebApplicationException(e, 400);
View Full Code Here

        return acceptableLanguages;
    }

    public List<MediaType> getAcceptableMediaTypes() {
        if (acceptableMediaTypes == null) {
            Accept acceptHeader = getAcceptHeader();
            acceptableMediaTypes = acceptHeader.getSortedMediaTypes();
        }
        logger.trace("getAcceptableMediaTypes() returns {}", acceptableMediaTypes); //$NON-NLS-1$
        return acceptableMediaTypes;
    }
View Full Code Here

                acceptValue = requestHeader.get(0);
            }
        }
        try {
            logger.trace("Accept header is: {}", acceptValue); //$NON-NLS-1$
            Accept acceptHeader = Accept.valueOf(acceptValue);
            logger.trace("getAcceptHeader() returns {}", acceptHeader); //$NON-NLS-1$
            return acceptHeader;
        } catch (IllegalArgumentException e) {
            logger.trace("Illegal Accept request header: {}", e); //$NON-NLS-1$
            throw new WebApplicationException(e, 400);
View Full Code Here

TOP

Related Classes of org.apache.wink.common.internal.http.Accept

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.