Examples of CharacterSet


Examples of org.restlet.data.CharacterSet

            } else if (metadata instanceof MediaType) {
                MediaType mediaType = (MediaType) metadata;
                defaultMetadata = mediaType.equals(getMetadataService()
                        .getDefaultMediaType());
            } else if (metadata instanceof CharacterSet) {
                CharacterSet characterSet = (CharacterSet) metadata;
                defaultMetadata = characterSet.equals(getMetadataService()
                        .getDefaultCharacterSet());
            } else if (metadata instanceof Encoding) {
                Encoding encoding = (Encoding) metadata;
                defaultMetadata = encoding.equals(getMetadataService()
                        .getDefaultEncoding());
View Full Code Here

Examples of org.restlet.data.CharacterSet

                    }
                }

                // If no character set is defined, take the default one
                if (variant.getCharacterSet() == null) {
                    final CharacterSet defaultCharacterSet = metadataService
                            .getDefaultCharacterSet();

                    if ((defaultCharacterSet != null)
                            && !defaultCharacterSet.equals(CharacterSet.ALL)) {
                        variant.setCharacterSet(defaultCharacterSet);
                    }
                }
            }
        }
View Full Code Here

Examples of org.restlet.data.CharacterSet

     * @return The content type.
     */
    private ContentType createContentType(StringBuilder mediaType,
            Series<Parameter> parameters) {
        // Attempt to extract the character set
        CharacterSet characterSet = null;

        if (parameters != null) {
            String charSet = parameters.getFirstValue("charset");

            if (charSet != null) {
                parameters.removeAll("charset");
                characterSet = new CharacterSet(charSet);
            }

            return new ContentType(new MediaType(mediaType.toString(),
                    parameters), characterSet);
        }
View Full Code Here

Examples of org.restlet.data.CharacterSet

        Representation entity = Response.getCurrent().getEntity();

        if (entity == null)
            return null;

        CharacterSet characterSet = entity.getCharacterSet();

        if (characterSet == null)
            return null;

        return characterSet.toString();
    }
View Full Code Here

Examples of org.restlet.data.CharacterSet

     * @see HttpHeaders#getMediaType()
     */
    public MediaType getMediaType() {
        if (this.mediaType == null) {
            org.restlet.data.MediaType rmt = request.getEntity().getMediaType();
            CharacterSet rCharSet = request.getEntity().getCharacterSet();
            this.mediaType = Converter.toJaxRsMediaType(rmt, rCharSet);
        }
        return this.mediaType;
    }
View Full Code Here

Examples of org.restlet.data.CharacterSet

     * @see #getSupportedCharSet(MultivaluedMap)
     */
    public static String getCharsetName(
            MultivaluedMap<String, Object> httpHeaders, CharacterSet defaultCs) {
        String result = null;
        CharacterSet charSet = null;
        final Object contentType = httpHeaders.getFirst(CONTENT_TYPE);

        if (contentType == null) {
            charSet = defaultCs;
        } else {
            charSet = ContentType.readCharacterSet(contentType.toString());

            if (charSet == null) {
                charSet = defaultCs;
            }
        }

        if (charSet != null) {
            result = charSet.getName();
        }

        return result;
    }
View Full Code Here

Examples of org.restlet.data.CharacterSet

        super(mediaType);
        setDataModel(dataModel);
        this.engine = null;
        this.template = new Template();

        CharacterSet charSet = (templateRepresentation.getCharacterSet() == null) ? templateRepresentation
                .getCharacterSet() : CharacterSet.DEFAULT;
        this.template.setEncoding(charSet.getName());
        if (templateRepresentation.getModificationDate() != null) {
            this.template.setLastModified(templateRepresentation
                    .getModificationDate().getTime());
        }
        this.template.setName("org.restlet.resource.representation");
View Full Code Here

Examples of org.restlet.data.CharacterSet

            ParseErrorException, IOException {
        super(mediaType);
        this.engine = null;
        this.template = new Template();

        CharacterSet charSet = (templateRepresentation.getCharacterSet() == null) ? templateRepresentation
                .getCharacterSet() : CharacterSet.DEFAULT;
        this.template.setEncoding(charSet.getName());
        this.template.setLastModified((templateRepresentation
                .getModificationDate() == null) ? new Date().getTime()
                : templateRepresentation.getModificationDate().getTime());
        this.template.setName("org.restlet.resource.representation");
        this.template.setRuntimeServices(RuntimeSingleton.getRuntimeServices());
View Full Code Here

Examples of org.restlet.data.CharacterSet

            response.setEntity(text, mediaType);
        }
        LOG.debug("Populate Restlet response from exchange body: {}", body);

        if (exchange.getProperty(Exchange.CHARSET_NAME) != null) {
            CharacterSet cs = CharacterSet.valueOf(exchange.getProperty(Exchange.CHARSET_NAME, String.class));
            response.getEntity().setCharacterSet(cs);
        }

        // set headers at the end, as the entity must be set first
        for (Map.Entry<String, Object> entry : out.getHeaders().entrySet()) {
View Full Code Here

Examples of org.restlet.data.CharacterSet

            response.setEntity(text, mediaType);
        }
        LOG.debug("Populate Restlet response from exchange body: {}", body);

        if (exchange.getProperty(Exchange.CHARSET_NAME) != null) {
            CharacterSet cs = CharacterSet.valueOf(exchange.getProperty(Exchange.CHARSET_NAME, String.class));
            response.getEntity().setCharacterSet(cs);
        }

        // set headers at the end, as the entity must be set first
        for (Map.Entry<String, Object> entry : out.getHeaders().entrySet()) {
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.