public Object jsGet_stream() { try { return property.getStream(); } catch (RepositoryException re) { return Undefined.instance; } }
/** * @inheritDoc */ public InputStream getStream() throws ValueFormatException, RepositoryException { return property.getStream(); }
@Override public InputStream getStream() throws RepositoryException { return delegate.getStream(); }
public InputStream getStream() throws RepositoryException { return this.item.getStream(); }
private FlowExpression deserializeExpressionAsXml(final Node c) throws Exception { if (!c.hasProperty(WorkflowConstants.NODEDATA_VALUE)) { return null; } final InputStream is = c.getProperty(WorkflowConstants.NODEDATA_VALUE).getStream(); final SAXBuilder builder = new SAXBuilder(); final Document doc = builder.build(is); return (FlowExpression) XmlBeanCoder.xmlDecode(doc); }
@Override public void runTest() throws Exception { for (int i = 0; i < FILE_COUNT; i++) { Node file = root.getNode("file" + i); Node content = file.getNode("jcr:content"); InputStream stream = content.getProperty("jcr:data").getStream(); try { ByteStreams.copy(stream, ByteStreams.nullOutputStream()); } finally { stream.close(); } } }
protected static InputStream getFileNodeContent(Node node) throws RRepositoryException { try { return node.getNode(ArtefactProperties.PROP_RES_CONTENT).getProperty(ArtefactProperties.PROP_RES_DATA).getStream(); } catch (RepositoryException e) { throw new RRepositoryException("Failed to get Content!", e); } }
@Override public InputStream getStream() throws ValueFormatException, RepositoryException { return getWrappedProperty().getStream(); }
protected static InputStream getFileNodeContent(Node node) throws RRepositoryException { try { return node.getNode(ArtefactProperties.PROP_RES_CONTENT).getProperty(ArtefactProperties.PROP_RES_DATA).getStream(); } catch (RepositoryException e) { throw new RRepositoryException("Failed to get Content!", e); } }
public InputStream execute() throws Exception { return getDelegate().getStream(); } });
/** * Tests the failure of calling Property.getStream() on a multivalue * property. */ public void testMultiValue() throws RepositoryException, IOException { if (multiple) { InputStream in = null; try { in = prop.getStream(); fail("Calling getStream() on a multivalue property " + "should throw a ValueFormatException."); } catch (ValueFormatException vfe) { // ok } finally { if (in != null) { in.close(); } } } }
/** * Tests if adding a property with <code>Node.setProperty(String, * InputStream)</code> works with <code>Session.save()</code> */ public void testNewInputStreamPropertySession() throws Exception { testNode.setProperty(propertyName1, is1); superuser.save(); is1 = new ByteArrayInputStream(bytes1); InputStream in = testNode.getProperty(propertyName1).getStream(); try { assertTrue("Setting property with Node.setProperty(String, InputStream) and Session.save() not working", compareInputStreams(is1, in)); } finally { try { in.close(); } catch (IOException ignore) {} } }
/** * Tests if adding a property with <code>Node.setProperty(String, * InputStream)</code> works with <code>parentNode.save()</code> */ public void testNewInputStreamPropertyParent() throws Exception { testNode.setProperty(propertyName1, is1); testRootNode.getSession().save(); is1 = new ByteArrayInputStream(bytes1); InputStream in = testNode.getProperty(propertyName1).getStream(); try { assertTrue("Setting property with Node.setProperty(String, InputStream) and parentNode.save() not working", compareInputStreams(is1, in)); } finally { try { in.close(); } catch (IOException ignore) {} } }
/** * Tests if modifying a property with <code>Node.setProperty(String, * InputStream)</code> works with <code>parentNode.save()</code> */ public void testModifyInputStreamPropertyParent() throws Exception { testNode.setProperty(propertyName1, is1); testRootNode.getSession().save(); testNode.setProperty(propertyName1, is2); testRootNode.getSession().save(); is2 = new ByteArrayInputStream(bytes2); InputStream in = testNode.getProperty(propertyName1).getStream(); try { assertTrue("Modifying property with Node.setProperty(String, InputStream) and parentNode.save() not working", compareInputStreams(is2, in)); } finally { try { in.close(); } catch (IOException ignore) {} } }
/** * Checks if the given content node contains a jcr:data property * and spools its value to the output stream of the export context.<br> * Please note, that subclasses that define a different structure of the * content node should create their own * {@link #exportData(ExportContext, boolean, Node) exportData} method. * * @param context export context * @param isCollection <code>true</code> if collection * @param contentNode the content node * @throws IOException if an I/O error occurs */ protected void exportData(ExportContext context, boolean isCollection, Node contentNode) throws IOException, RepositoryException { if (contentNode.hasProperty(JcrConstants.JCR_DATA)) { Property p = contentNode.getProperty(JcrConstants.JCR_DATA); IOUtil.spool(p.getStream(), context.getOutputStream()); } // else: stream undefined -> content length was not set }
@Override public InputStream getStream() { if (isExist()) { try { return getJCRProperty().getStream(); } catch (RepositoryException e) { throw new RuntimeException("Can't read value of nodedata " + toString(), e); } } return null; }
@Override public InputStream getStream() { if (isExist()) { try { return getJCRProperty().getStream(); } catch (RepositoryException e) { throw new RuntimeException("Can't read value of node data " + toString(), e); } } return null; }
/** * @deprecated */ @Deprecated public InputStream getStream(Property property) throws RepositoryException { if (getPrevious() != null) { return getPrevious().getStream(property); } else { return property.getStream(); } }
public void removeXSSsecurityVulnerability(String parentFolder, String fileName) throws RepositoryException, Exception { if (!session.isLive()) session = repository.loginAdministrative(null); Node node = session.getRootNode().getNode(parentFolder+"/"+fileName); if (isValidMimeType(node)) { log.info("Removing XSS Vulnerability codes for node {}", node.getPath()); StringWriter sw = new StringWriter(); XMLWriter xmlWriter = new XMLWriter(sw); xmlWriter.setOutputProperty(XMLWriter.OMIT_XML_DECLARATION, "yes"); xmlWriter.setOutputProperty(XMLWriter.ENCODING, configurator.getEncoding()); parser.setContentHandler(xmlWriter); parser.parse(new InputSource(new InputStreamReader(node.getNode("jcr:content").getProperty("jcr:data").getStream(), configurator.getEncoding()))); node.getNode("jcr:content").setProperty("jcr:data", new ByteArrayInputStream(sw.toString().getBytes(configurator.getEncoding()))); } else { log.info("No XSS Vulnerability remove, not a HTML: {} - {}", node.getPath(), node.getNode("jcr:content").getProperty("jcr:mimeType")); } session.save(); }
public void testGetStream() throws RepositoryException, IOException { InputStream in = prop.getStream(); ByteArrayOutputStream out = new ByteArrayOutputStream(); IOUtils.copy(in, out); IOUtils.closeQuietly(in); assertEquals(prop.getString(), new String(out.toByteArray(), "UTF-8")); }