use of annis.libgui.visualizers.IFrameResource in project ANNIS by korpling.
the class ResourceRequestHandler method handleRequest.
@Override
public boolean handleRequest(VaadinSession session, VaadinRequest request, VaadinResponse response) throws IOException {
if (request.getPathInfo() != null && request.getPathInfo().startsWith(prefix)) {
String uuidString = StringUtils.removeStart(request.getPathInfo(), prefix);
UUID uuid = UUID.fromString(uuidString);
IFrameResourceMap map = VaadinSession.getCurrent().getAttribute(IFrameResourceMap.class);
if (map == null) {
response.setStatus(404);
} else {
IFrameResource res = map.get(uuid);
if (res != null) {
response.setStatus(200);
response.setContentType(res.getMimeType());
response.getOutputStream().write(res.getData());
}
}
return true;
}
return false;
}
Aggregations