@GET
  @Path("{connectorId}/contents")
  public Response getTypedContent(@PathParam("connectorId") long connectorId, @QueryParam("nodeId") String nodeId, @QueryParam("type") ConnectorNodeType type) {
    Connector connector = getConnector(connectorId);
    InputStream content = connector.getContent(new ConnectorNode(nodeId, null, type));
    if (content == null) {
      return JaxRsUtil.createResponse().status(Response.Status.NOT_FOUND).build();
    }
    // nre: TODO: Why not guess by extension?
    try {
      return JaxRsUtil.createResponse().status(Status.OK).entity(IoUtil.readInputStream(content, connectorId + "-" + nodeId + "-content-stream"))
              .header("Content-Type", type.getMimeType())
              .build();
    } finally {
      IoUtil.closeSilently(content);
    }
  }
@GET
  @Path("{connectorId}/contents")
  public Response getTypedContent(@PathParam("connectorId") long connectorId, @QueryParam("nodeId") String nodeId, @QueryParam("type") ConnectorNodeType type) {
    Connector connector = getConnector(connectorId);
    InputStream content = connector.getContent(new ConnectorNode(nodeId, null, type));
    if (content == null) {
      return JaxRsUtil.createResponse().status(Response.Status.NOT_FOUND).build();
    }
   
    try {
      return JaxRsUtil.createResponse().status(Status.OK).entity(IoUtil.readInputStream(content, connectorId + "-" + nodeId + "-content-stream"))
              .header("Content-Type", type.getMimeType())
              .build();
    } finally {
      IoUtil.closeSilently(content);
    }
  }
@get @path("{connectorid}/contents") public response gettypedcontent(@pathparam("connectorid") long connectorid, @queryparam("nodeid") string nodeid, @queryparam("type") connectornodetype type) { connector connector = getconnector(connectorid); inputstream content = connector.getcontent(new connectornode(nodeid, null, type)); if (content == null) { return jaxrsutil.createresponse().status(response.status.not_found).build(); } try { return jaxrsutil.createresponse().status(status.ok).entity(ioutil.readinputstream(content, connectorid + "-" + nodeid + "-content-stream")) .header("content-type", type.getmimetype()) .build(); } finally { ioutil.closesilently(content); } }