public String open() {
if (!isLoggedIn())
return redirect();
FacesContext fc = FacesContext.getCurrentInstance();
VariableResolver vr = fc.getApplication().getVariableResolver();
DcWebObjects objects = (DcWebObjects) vr.resolveVariable(fc, "webObjects");
List<?> data = (List<?>) objects.getData().getRowData();
DcWebObject wod = (DcWebObject) vr.resolveVariable(fc, "webObject");
int moduleIdx = objects.getModule();
if (!getUser().isAuthorized(DcModules.get(moduleIdx)))
return redirect();
wod.initialize(moduleIdx);
wod.setRowIdx(objects.getData().getRowIndex());
wod.setID((String) data.get(data.size() - 1));
wod.setName(wod.getDcObject().toString());
wod.load();
DcObject dco = wod.getDcObject();
String filename = dco.getFilename();
File file = new File(filename);
HttpServletResponse response = (HttpServletResponse) fc.getExternalContext().getResponse();
int read = 0;
byte[] bytes = new byte[1024];
response.setContentType("application/data");
response.setHeader("Content-Disposition", "attachment;filename=\"" + file.getName() + "\"");