As we transition to the new Hyland Community, some post links may be temporarily disrupted as we finalize redirects. We apologize for the inconvenience and are working to resolve this as quickly as possible. Details.
/alfresco/service/script/org/alfresco/cmis/content.put
ThresholdOutputStream
TempFileProvider
sudo service alfresco start
String serverUrl = "http://localhost:8080/alfresco/api/-default-/public/cmis/versions/1.1/atom"; String userName = "admin"; String password = "admin"; SessionFactory sessionFactory = SessionFactoryImpl.newInstance(); Map<String, String> params = new HashMap<String, String>(); params.put(SessionParameter.USER, userName); params.put(SessionParameter.PASSWORD, password); params.put(SessionParameter.ATOMPUB_URL, serverUrl); params.put(SessionParameter.BINDING_TYPE, BindingType.ATOMPUB.value()); params.put(SessionParameter.OBJECT_FACTORY_CLASS, "org.alfresco.cmis.client.impl.AlfrescoObjectFactoryImpl"); List<Repository> repos = sessionFactory.getRepositories(params); if (repos.isEmpty()) { throw new RuntimeException("Server has no repositories!"); } Session session = repos.get(0).createSession(); Map<String, Object> properties = new HashMap<String, Object>(); properties.put(PropertyIds.OBJECT_TYPE_ID, "cmis:document,P:cm:titled"); properties.put(PropertyIds.NAME, "test8"); properties.put(PropertyIds.CREATED_BY, "admin"); properties.put("cm:title", "Title8"); properties.put("cm:description", "description8"); AlfrescoFolder folder1 = (AlfrescoFolder) session.getObjectByPath("/folder1"); File file = new File("C:\\filetoupload.pdf"); InputStream fis = new FileInputStream(file); VersioningState vs = VersioningState.MAJOR; DataInputStream dis = new DataInputStream(fis); byte[] bytes = new byte[(int) file.length()]; dis.readFully(bytes); ContentStream contentStream = new ContentStreamImpl(file .getAbsolutePath(), null, "application/pdf", new ByteArrayInputStream(bytes)); AlfrescoDocument newDocument = (AlfrescoDocument) folder1 .createDocument(properties, contentStream, vs);
webscripts.tempDirectoryName=WebScripts # 4mb webscripts.memoryThreshold=4194304 # 4gb webscripts.setMaxContentSize=4294967296