当前位置: 首页>>代码示例>>Java>>正文


Java Representation.getMediaType方法代码示例

本文整理汇总了Java中org.restlet.representation.Representation.getMediaType方法的典型用法代码示例。如果您正苦于以下问题:Java Representation.getMediaType方法的具体用法?Java Representation.getMediaType怎么用?Java Representation.getMediaType使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.restlet.representation.Representation的用法示例。


在下文中一共展示了Representation.getMediaType方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: JacksonRepresentation

import org.restlet.representation.Representation; //导入方法依赖的package包/类
/**
 * Constructor.
 * 
 * @param representation
 *            The representation to parse.
 * @param objectClass
 *            The object class to instantiate.
 */
public JacksonRepresentation(Representation representation,
        Class<T> objectClass) {
    super(representation.getMediaType());
    this.object = null;
    this.objectClass = objectClass;
    this.representation = representation;
    this.objectMapper = null;
    this.objectReader = null;
    this.objectWriter = null;
    this.csvSchema = null;
    // [ifndef android] instruction
    this.expandingEntityRefs = XML_EXPANDING_ENTITY_REFS;
    // [ifndef android] instruction
    this.validatingDtd = XML_VALIDATING_DTD;
}
 
开发者ID:restlet,项目名称:restlet-framework,代码行数:24,代码来源:JacksonRepresentation.java

示例2: SaxRepresentation

import org.restlet.representation.Representation; //导入方法依赖的package包/类
/**
 * Constructor.
 * 
 * @param xmlRepresentation
 *            A source XML representation to parse.
 */
public SaxRepresentation(Representation xmlRepresentation) {
    super((xmlRepresentation == null) ? null : xmlRepresentation
            .getMediaType());
    this.secureProcessing = XML_SECURE_PROCESSING;
    this.xmlRepresentation = xmlRepresentation;
}
 
开发者ID:restlet,项目名称:restlet-framework,代码行数:13,代码来源:SaxRepresentation.java

示例3: GsonRepresentation

import org.restlet.representation.Representation; //导入方法依赖的package包/类
/**
 * Constructor.
 * 
 * @param representation
 *            The representation to parse.
 * @param objectClass
 *            The object class to instantiate.
 */
public GsonRepresentation(Representation representation,
        Class<T> objectClass) {
    super(representation.getMediaType());
    this.object = null;
    this.objectClass = objectClass;
    this.jsonRepresentation = representation;
    this.builder = null;
}
 
开发者ID:restlet,项目名称:restlet-framework,代码行数:17,代码来源:GsonRepresentation.java

示例4: checkMetadataConsistency

import org.restlet.representation.Representation; //导入方法依赖的package包/类
/**
 * Checks that the URI and the representation are compatible. The whole set
 * of metadata of the representation must be included in the set of those of
 * the URI
 * 
 * @param fileName
 *            The name of the resource
 * @param representation
 *            The provided representation.
 * @return True if the metadata of the representation are compatible with
 *         the metadata extracted from the filename
 */
private boolean checkMetadataConsistency(String fileName, Representation representation) {
    if (representation != null) {
        Variant var = new Variant();
        Entity.updateMetadata(fileName, var, false, getMetadataService());

        // "var" contains the theoretical correct metadata
        if (!var.getLanguages().isEmpty()
                && !representation.getLanguages().isEmpty()
                && !var.getLanguages().containsAll(representation.getLanguages())) {
            return false;
        }

        if ((var.getMediaType() != null)
                && (representation.getMediaType() != null)
                && !(var.getMediaType().includes(representation.getMediaType()))) {
            return false;
        }

        if (!var.getEncodings().isEmpty()
                && !representation.getEncodings().isEmpty()
                && !var.getEncodings().containsAll(representation.getEncodings())) {
            return false;
        }
    }
    return true;
}
 
开发者ID:restlet,项目名称:restlet-framework,代码行数:39,代码来源:FileClientHelper.java

示例5: GsonRepresentation

import org.restlet.representation.Representation; //导入方法依赖的package包/类
public GsonRepresentation(Representation representation, Class<T> objectClass) {
    super(representation.getMediaType());
    iObject = null;
    iObjectClass = objectClass;
    iRepresentation = representation;
}
 
开发者ID:Jenner4S,项目名称:unitimes,代码行数:7,代码来源:GsonRepresentation.java

示例6: addEntityHeaders

import org.restlet.representation.Representation; //导入方法依赖的package包/类
/**
 * Adds the entity headers based on the {@link Representation} to the {@link Series}.
 * 
 * @param entity
 *            The source entity {@link Representation}.
 * @param headers
 *            The target headers {@link Series}.
 */
public static void addEntityHeaders(Representation entity,
        Series<Header> headers) {
    if (entity == null || !entity.isAvailable()) {
        addHeader(HeaderConstants.HEADER_CONTENT_LENGTH, "0", headers);
    } else if (entity.getAvailableSize() != Representation.UNKNOWN_SIZE) {
        addHeader(HeaderConstants.HEADER_CONTENT_LENGTH,
                Long.toString(entity.getAvailableSize()), headers);
    }

    if (entity != null) {
        addHeader(HeaderConstants.HEADER_CONTENT_ENCODING,
                EncodingWriter.write(entity.getEncodings()), headers);
        addHeader(HeaderConstants.HEADER_CONTENT_LANGUAGE,
                LanguageWriter.write(entity.getLanguages()), headers);

        if (entity.getLocationRef() != null) {
            addHeader(HeaderConstants.HEADER_CONTENT_LOCATION, entity
                    .getLocationRef().getTargetRef().toString(), headers);
        }

        if (entity.getDigest() != null
                && Digest.ALGORITHM_MD5.equals(entity.getDigest()
                        .getAlgorithm())) {
            addHeader(
                    HeaderConstants.HEADER_CONTENT_MD5,
                    new String(org.restlet.engine.util.Base64.encode(entity
                            .getDigest().getValue(), false)),
                    headers);
        }

        if (entity.getRange() != null) {
            Range range = entity.getRange();
            if (isBytesRange(range)) {
                addHeader(HeaderConstants.HEADER_CONTENT_RANGE,
                        RangeWriter.write(range, entity.getSize()),
                        headers);
            } else {
                addHeader(HeaderConstants.HEADER_CONTENT_RANGE,
                        RangeWriter.write(range, range.getInstanceSize()),
                        headers);
            }
        }

        if (entity.getMediaType() != null) {
            addHeader(HeaderConstants.HEADER_CONTENT_TYPE,
                    ContentType.writeHeader(entity), headers);
        }

        if (entity.getExpirationDate() != null) {
            addHeader(HeaderConstants.HEADER_EXPIRES,
                    DateWriter.write(entity.getExpirationDate()), headers);
        }

        if (entity.getModificationDate() != null) {
            addHeader(HeaderConstants.HEADER_LAST_MODIFIED,
                    DateWriter.write(entity.getModificationDate()), headers);
        }

        if (entity.getTag() != null) {
            addHeader(HeaderConstants.HEADER_ETAG,
                    TagWriter.write(entity.getTag()), headers);
        }

        if (entity.getDisposition() != null
                && !Disposition.TYPE_NONE.equals(entity.getDisposition()
                        .getType())) {
            addHeader(HeaderConstants.HEADER_CONTENT_DISPOSITION,
                    DispositionWriter.write(entity.getDisposition()),
                    headers);
        }
    }
}
 
开发者ID:restlet,项目名称:restlet-framework,代码行数:81,代码来源:HeaderUtils.java

示例7: JaxbRepresentation

import org.restlet.representation.Representation; //导入方法依赖的package包/类
/**
 * Creates a new JAXB representation, converting the input XML into a Java
 * content tree. The XML is validated.
 *
 * @param xmlRepresentation
 *            The XML wrapped in a representation.
 * @param contextPath
 *            The list of Java package names for JAXB.
 * @param validationHandler
 *            A handler for dealing with validation failures.
 * @param classLoader
 *            The classloader to use for JAXB annotated classes.
 * @throws JAXBException
 *             If the incoming XML does not validate against the schema.
 * @throws IOException
 *             If unmarshalling XML fails.
 */
public JaxbRepresentation(Representation xmlRepresentation,
                          String contextPath, ValidationEventHandler validationHandler,
                          ClassLoader classLoader) {
    super((xmlRepresentation == null) ? null : xmlRepresentation
            .getMediaType());
    this.classLoader = classLoader;
    this.contextPath = contextPath;
    this.object = null;
    this.secureProcessing = true;
    this.validationEventHandler = validationHandler;
    this.xmlRepresentation = xmlRepresentation;
}
 
开发者ID:restlet,项目名称:restlet-framework,代码行数:30,代码来源:JaxbRepresentation.java

示例8: DomRepresentation

import org.restlet.representation.Representation; //导入方法依赖的package包/类
/**
 * Constructor.
 * 
 * @param xmlRepresentation
 *            A source XML representation to parse.
 */
public DomRepresentation(Representation xmlRepresentation) {
    super((xmlRepresentation == null) ? null : xmlRepresentation.getMediaType());
    this.setAvailable((xmlRepresentation == null) ? false : xmlRepresentation.isAvailable());
    this.xmlRepresentation = xmlRepresentation;
}
 
开发者ID:restlet,项目名称:restlet-framework,代码行数:12,代码来源:DomRepresentation.java

示例9: ContentType

import org.restlet.representation.Representation; //导入方法依赖的package包/类
/**
 * Constructor.
 * 
 * @param representation
 *            The representation.
 */
public ContentType(Representation representation) {
    this(representation.getMediaType(), representation.getCharacterSet());
}
 
开发者ID:restlet,项目名称:restlet-framework,代码行数:10,代码来源:ContentType.java


注:本文中的org.restlet.representation.Representation.getMediaType方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。