Package org.restlet.representation

Examples of org.restlet.representation.InputRepresentation


        contentType = contentType.substring(0, contentType.indexOf(";"));
      }
      mediatType = MediaType.valueOf(contentType);
    }
    InputStream resource = ActivitiUtil.getTaskService().getAttachmentContent(attachmentId);
    InputRepresentation output = new InputRepresentation(resource, mediatType);
    getResponse().getCacheDirectives().add(CacheDirective.maxAge(28800));
    return output;
  }
View Full Code Here


        .getDeployedProcessDefinition(pi.getProcessDefinitionId());

    if (pde != null && pde.isGraphicalNotationDefined()) {
      InputStream resource = ProcessDiagramGenerator.generateDiagram(pde, "png", ActivitiUtil.getRuntimeService().getActiveActivityIds(processInstanceId));

      InputRepresentation output = new InputRepresentation(resource, MediaType.IMAGE_PNG);
      return output;
     
    } else {
      throw new ActivitiException("Process instance with id " + processInstanceId + " has no graphic description");
    }
View Full Code Here

            response.setEntity("", MediaType.TEXT_PLAIN);
        } else if (body instanceof Response) {
            // its already a restlet response, so dont do anything
            LOG.debug("Using existing Restlet Response from exchange body: {}", body);
        } else if (body instanceof InputStream) {
            response.setEntity(new InputRepresentation(out.getBody(InputStream.class), mediaType));
        } else if (body instanceof File) {
            response.setEntity(new FileRepresentation(out.getBody(File.class), mediaType));
        } else {
            // fallback and use string
            String text = out.getBody(String.class);
View Full Code Here

public class PluginRestResource extends ServerResource {
 
  @Get
  public InputRepresentation getPlugins() {
    InputStream pluginStream = this.getClass().getClassLoader().getResourceAsStream("plugins.xml");
    InputRepresentation pluginResultRepresentation = new InputRepresentation(pluginStream);
    pluginResultRepresentation.setMediaType(MediaType.APPLICATION_XML);
    return pluginResultRepresentation;
  }
View Full Code Here

public class StencilsetRestResource extends ServerResource {
 
  @Get
  public InputRepresentation getStencilset() {
    InputStream stencilsetStream = this.getClass().getClassLoader().getResourceAsStream("stencilset.json");
    InputRepresentation stencilsetResultRepresentation = new InputRepresentation(stencilsetStream);
    stencilsetResultRepresentation.setMediaType(MediaType.APPLICATION_JSON);
    return stencilsetResultRepresentation;
  }
View Full Code Here

public class EditorRestResource extends ServerResource {
 
  @Get
  public InputRepresentation getEditorPage() {
    InputStream editorStream = this.getClass().getClassLoader().getResourceAsStream("editor.html");
    InputRepresentation editorResultRepresentation = new InputRepresentation(editorStream);
    editorResultRepresentation.setMediaType(MediaType.APPLICATION_XHTML);
    return editorResultRepresentation;
  }
View Full Code Here

    if(path.contains("/deployment") && path.contains("/resource")) {
      String deploymentId = path.substring(path.indexOf("/deployment/") + 12, path.indexOf("/", path.indexOf("/deployment/") + 12));
      String resourceName = path.substring(path.indexOf("/resource/") + 10);
      InputStream resource = ActivitiUtil.getRepositoryService().getResourceAsStream(deploymentId, resourceName);
      if (resource != null) {
        InputRepresentation output = new InputRepresentation(resource);
        return output;
      } else {
        throw new ActivitiException("There is no resource with name '" + resourceName + "' for deployment with id '" + deploymentId + "'.");
      }
    } else {
View Full Code Here

   
    } else {
      mediaType = MediaType.APPLICATION_ALL;
    }
   
    InputRepresentation output = new InputRepresentation(resourceStream, mediaType);
    return output;
  }
View Full Code Here

            response.setEntity("", MediaType.TEXT_PLAIN);
        } else if (body instanceof Response) {
            // its already a restlet response, so dont do anything
            LOG.debug("Using existing Restlet Response from exchange body: {}", body);
        } else if (body instanceof InputStream) {
            response.setEntity(new InputRepresentation(out.getBody(InputStream.class), mediaType));
        } else if (body instanceof File) {
            response.setEntity(new FileRepresentation(out.getBody(File.class), mediaType));
        } else {
            // fallback and use string
            String text = out.getBody(String.class);
View Full Code Here

            response.setEntity("", MediaType.TEXT_PLAIN);
        } else if (body instanceof Response) {
            // its already a restlet response, so dont do anything
            LOG.debug("Using existing Restlet Response from exchange body: {}", body);
        } else if (body instanceof InputStream) {
            response.setEntity(new InputRepresentation(out.getBody(InputStream.class), mediaType));
        } else if (body instanceof File) {
            response.setEntity(new FileRepresentation(out.getBody(File.class), mediaType));
        } else {
            // fallback and use string
            String text = out.getBody(String.class);
View Full Code Here

TOP

Related Classes of org.restlet.representation.InputRepresentation

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.