Examples of RepresentationInfo


Examples of org.restlet.ext.wadl.RepresentationInfo

    protected void describeGet(MethodInfo info) {
        info.setIdentifier("items");
        info.setDocumentation("Retrieve the list of current items.");

        ResponseInfo response = new ResponseInfo();
        RepresentationInfo repInfo = new RepresentationInfo(MediaType.TEXT_XML);
        repInfo.setXmlElement("items");
        repInfo.setDocumentation("List of items as XML file");
        response.getRepresentations().add(repInfo);

        info.getResponses().add(response);
    }
View Full Code Here

Examples of org.restlet.ext.wadl.RepresentationInfo

    @Override
    protected void describePost(MethodInfo info) {
        info.setIdentifier("create_item");
        info.setDocumentation("To create an item.");

        RepresentationInfo repInfo = new RepresentationInfo(
                MediaType.APPLICATION_WWW_FORM);
        ParameterInfo param = new ParameterInfo("name", ParameterStyle.PLAIN,
                "Name of the item");
        repInfo.getParameters().add(param);
        param = new ParameterInfo("description", ParameterStyle.PLAIN,
                "Description of the item");
        repInfo.getParameters().add(param);
        repInfo.setDocumentation("Web form.");
        info.getRequest().getRepresentations().add(repInfo);

        ResponseInfo response = new ResponseInfo();
        response.getStatuses().add(Status.SUCCESS_CREATED);
        info.getResponses().add(response);

        response = new ResponseInfo();
        response.getStatuses().add(Status.CLIENT_ERROR_NOT_FOUND);
        info.getResponses().add(response);

        repInfo = new RepresentationInfo(MediaType.TEXT_HTML);
        repInfo.setIdentifier("itemError");
        response.getRepresentations().add(repInfo);
    }
View Full Code Here

Examples of org.restlet.ext.wadl.RepresentationInfo

    protected void describeGet(MethodInfo info) {
        info.setIdentifier("item");
        info.setDocumentation("To retrieve details of a specific item");

        ResponseInfo response = new ResponseInfo();
        RepresentationInfo repInfo = new RepresentationInfo(MediaType.TEXT_XML);
        repInfo.setXmlElement("item");
        repInfo.setDocumentation("XML representation of the current item.");
        response.getRepresentations().add(repInfo);

        info.getResponses().add(response);

        response = new ResponseInfo("Item not found");
        repInfo = new RepresentationInfo(MediaType.TEXT_HTML);
        repInfo.setIdentifier("itemError");
        response.getStatuses().add(Status.CLIENT_ERROR_NOT_FOUND);
        response.getRepresentations().add(repInfo);
        info.getResponses().add(response);
    }
View Full Code Here

Examples of org.restlet.ext.wadl.RepresentationInfo

    @Override
    protected void describePut(MethodInfo info) {
        info.setDocumentation("Update or create the current item.");

        RepresentationInfo repInfo = new RepresentationInfo(
                MediaType.APPLICATION_WWW_FORM);
        ParameterInfo param = new ParameterInfo("name", ParameterStyle.PLAIN,
                "Name of the item");
        repInfo.getParameters().add(param);
        param = new ParameterInfo("description", ParameterStyle.PLAIN,
                "Description of the item");
        repInfo.getParameters().add(param);
        repInfo.setDocumentation("Web form.");
        info.getRequest().getRepresentations().add(repInfo);

        ResponseInfo response = new ResponseInfo();
        response.getStatuses().add(Status.SUCCESS_OK);
        response.getStatuses().add(Status.SUCCESS_CREATED);
View Full Code Here

Examples of org.restlet.representation.RepresentationInfo

    if (cacheInfo != null) {
      Date lastModified = cacheInfo.getLastModified();
      Tag entityTag = cacheInfo.getEntityTag();

      for (MediaType mediaType : mediaTypes) {
        getVariants().add(new RepresentationInfo(mediaType, lastModified, entityTag));
      }
    }
    else {
      for (MediaType mediaType : mediaTypes) {
        getVariants().add(new Variant(mediaType));
View Full Code Here

Examples of org.restlet.representation.RepresentationInfo

     */
    protected Representation doConditionalHandle() throws ResourceException {
        Representation result = null;

        if (getConditions().hasSome()) {
            RepresentationInfo resultInfo = null;

            if (existing) {
                if (isNegotiated()) {
                    resultInfo = doGetInfo(getPreferredVariant(getVariants(Method.GET)));
                } else {
View Full Code Here

Examples of org.restlet.representation.RepresentationInfo

     *
     * @return The response entity.
     * @throws ResourceException
     */
    private RepresentationInfo doGetInfo() throws ResourceException {
        RepresentationInfo result = null;
        AnnotationInfo annotationInfo = getAnnotation(Method.GET);

        if (annotationInfo != null) {
            result = doHandle(annotationInfo, null);
        } else {
View Full Code Here

Examples of org.restlet.representation.RepresentationInfo

     * @return The response entity descriptor.
     * @throws ResourceException
     */
    private RepresentationInfo doGetInfo(Variant variant)
            throws ResourceException {
        RepresentationInfo result = null;

        if (variant != null) {
            if (variant instanceof VariantInfo) {
                result = doHandle(((VariantInfo) variant).getAnnotationInfo(),
                        variant);
View Full Code Here

Examples of org.restlet.representation.RepresentationInfo

     * @see org.restlet.resource.ServerResource#getInfo(org.restlet.representation.Variant)
     */
    @Override
    protected RepresentationInfo getInfo(Variant variant)
            throws ResourceException {
        return new RepresentationInfo(variant, new Date(lastModification()));
    }
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.