this.provisionEditSession = provisionEditSession;
}
@Override
public void handle(final Message<JsonObject> message) {
final GetFileContentsImpl request = GetFileContentsImpl.fromJsonString(Dto.get(message));
// Resolve the resource IDs from the requested path.
vertx.eventBus().send("tree.getResourceIds",
new JsonObject().putArray("paths", new JsonArray().addString(request.getPath())),
new Handler<Message<JsonObject>>() {
/**
* Sends the contents of a file to the requester. The files will be served out of the
* FileEditSession if the contents are being edited, otherwise they will simply be
* served from disk.
*/
@Override
public void handle(Message<JsonObject> event) {
JsonArray resourceIdArr = event.body.getArray("resourceIds");
Object[] resourceIds = resourceIdArr.toArray();
String resourceId = (String) resourceIds[0];
String currentPath = stripLeadingSlash(request.getPath());
FileEditSession editSession = editSessions.get(resourceId);
// Create the DTO for the file contents response. We will build it up later in the
// method.
String mimeType = MimeTypes.guessMimeType(currentPath, false);