03-21-2014 11:23 AM
/alfresco/service/script/org/alfresco/cmis/content.put
webscript complains about an non-existent file or directory (server side, just in case).ThresholdOutputStream
class. It creates some temporary files in a given directory to do its job, if the file to be processed is over 4MB (by default) in size. Although I haven't found the exact place where it's attempting to create those files, I noticed that the TempFileProvider
class is used to provide the directory. This directory is, in fact, $CATALINA_TEMP.TempFileProvider
has over $CATALINA_TEMP. The script showed that all permissions (read, write, execute) were enabled. So, this is not a permissions problem. 03-21-2014 11:48 AM
03-21-2014 02:22 PM
sudo service alfresco start
. Nothing out of the ordinary.
03-21-2014 10:04 PM
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);
03-24-2014 02:30 PM
03-24-2014 04:51 PM
04-02-2014 04:55 AM
webscripts.tempDirectoryName=WebScripts
# 4mb
webscripts.memoryThreshold=4194304
# 4gb
webscripts.setMaxContentSize=4294967296
03-24-2014 10:03 PM
Tags
Find what you came for
We want to make your experience in Hyland Connect as valuable as possible, so we put together some helpful links.