public ContentBean getContent(HttpServletRequest request) throws Exception { String path = RegistryUtil.getPath(request); ContentBean bean = null; try { bean = stub.getContentBean(path); } catch (Exception e) { String msg = "Failed to get content from the resource service. " + e.getMessage(); log.error(msg, e); throw e; } return bean; }
public PermissionBean getPermissions(HttpServletRequest request) throws Exception { String path = RegistryUtil.getPath(request); PermissionBean bean; try { bean = stub.getPermissions(path); } catch (Exception e) { String msg = "Failed to get permissions of the resource " + path + ". " + e.getMessage(); log.error(msg, e); throw e; } return bean; }
public MetadataBean getMetadata(HttpServletRequest request) throws Exception { String path = RegistryUtil.getPath(request); if (path == null) { path = getSessionResourcePath(); if (path == null) { path = RegistryConstants.ROOT_PATH; } request.setAttribute("path", path); } MetadataBean bean = null; try { bean = stub.getMetadata(path); } catch (Exception e) { String msg = "Failed to get resource metadata from the resource service. " + e.getMessage(); log.error(msg, e); throw e; } return bean; }
public String getTextContent(HttpServletRequest request) throws Exception { String path = RegistryUtil.getPath(request); if (path != null && path.contains("..")) { path = FilenameUtils.normalize(path); } String textContent = null; try { textContent = stub.getTextContent(path); MetadataBean metadataBean = stub.getMetadata(path); String resourceVersion = metadataBean.getResourceVersion(); request.getSession().setAttribute("resourceVersion",resourceVersion); } catch (Exception e) { String msg = "Failed get text content of the resource " + path + ". " + e.getMessage(); log.error(msg, e); throw e; } return textContent; }
public CollectionContentBean getCollectionContent(HttpServletRequest request) throws Exception { String path = RegistryUtil.getPath(request); CollectionContentBean bean = null; try { if(PaginationContext.getInstance() ==null){ bean = stub.getCollectionContent(path); }else { PaginationUtils.copyPaginationContext(stub._getServiceClient()); bean = stub.getCollectionContent(path); int rowCount = PaginationUtils.getRowCount(stub._getServiceClient()); session.setAttribute("row_count", Integer.toString(rowCount)); } } catch (Exception e) { String msg = "Failed to get collection content from the resource service. " + e.getMessage(); log.error(msg, e); throw e; } finally { PaginationContext.destroy(); } return bean; }