// nre: TODO: Why not guess by extension?
@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);
    }
  }
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"))
@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();
}
// 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);
}
}