Alfresco 露天:溪流已经关闭

Alfresco 露天:溪流已经关闭,alfresco,alfresco-share,opencmis,apache-chemistry,Alfresco,Alfresco Share,Opencmis,Apache Chemistry,我正在尝试在alfresco中使用apache chemistry创建文本文档。我的代码是用来创建文档的 Document Document=FileUtils.createTextDocument(“/”,“test.txt”,“test Document”,BaseTypeId.CMIS_Document.value(),VersioningState.MAJOR,session) 当我执行代码时,我得到以下异常 org.apache.chemistry.opencmis.commons.e

我正在尝试在alfresco中使用apache chemistry创建文本文档。我的代码是用来创建文档的

Document Document=FileUtils.createTextDocument(“/”,“test.txt”,“test Document”,BaseTypeId.CMIS_Document.value(),VersioningState.MAJOR,session)

当我执行代码时,我得到以下异常

org.apache.chemistry.opencmis.commons.exceptions.CmisConnectionException:无法访问“”:流已关闭! 位于org.apache.chemistry.opencmis.client.bindings.spi.http.DefaultHttpInvoker.invoke(DefaultHttpInvoker.java:233) 位于org.apache.chemistry.opencmis.client.bindings.spi.http.DefaultHttpInvoker.invokePOST(DefaultHttpInvoker.java:68) 在org.apache.chemistry.opencmis.client.bindings.spi.atompub.AbstractAtomSubservice.post上(AbstractAtomSubservice.java:713) 位于org.apache.chemistry.opencmis.client.bindings.spi.atompub.ObjectServiceImpl.createDocument(ObjectServiceImpl.java:122) 位于org.apache.chemistry.opencmis.client.runtime.SessionImpl.createDocument(SessionImpl.java:1165) 位于org.apache.chemistry.opencmis.client.runtime.FolderImpl.createDocument(FolderImpl.java:77) 位于org.apache.chemistry.opencmis.client.runtime.FolderImpl.createDocument(FolderImpl.java:460) 位于org.apache.chemistry.opencmis.client.util.FileUtils.createTextDocument(FileUtils.java:168)


试试这个对我很管用

public static void main(String args[]) {
String serverUrl = args[0];
String username = args[1];
String password = args[2];
Session session = getSession(serverUrl, username, password);
Folder root = session.getRootFolder();
Map<String, Object> properties = new HashMap<String, Object>();
properties.put(PropertyIds.OBJECT_TYPE_ID, BaseTypeId.CMIS_
DOCUMENT.value());
String name = "New Document (" + System.currentTimeMillis() +
").txt";
properties.put(PropertyIds.NAME, name);
List<Ace> addAces = new LinkedList<Ace>();
List<Ace> removeAces = new LinkedList<Ace>();
List<Policy> policies = new LinkedList<Policy>();
String content = "The quick brown fox jumps over the lazy dog.";
ContentStream contentStream = new ContentStreamImpl("text.txt",
BigInteger.valueOf(content.length()),
"text/plain", new ByteArrayInputStream(content.
getBytes()));
Document newDocument = root.createDocument(properties,
contentStream, VersioningState.MAJOR, policies, addAces, removeAces,
session.getDefaultContext());
System.out.println(newDocument.getId());
}                
publicstaticvoidmain(字符串参数[]){
字符串serverUrl=args[0];
字符串username=args[1];
字符串密码=args[2];
会话会话=getSession(服务器URL、用户名、密码);
Folder root=session.getRootFolder();
映射属性=新的HashMap();
properties.put(PropertyIds.OBJECT\u TYPE\u ID,BaseTypeId.CMIS_
DOCUMENT.value());
String name=“新文档(“+System.currentTimeMillis())+
“).txt”;
properties.put(PropertyIds.NAME,NAME);
List addAces=new LinkedList();
List Removeces=新建LinkedList();
列表策略=新建LinkedList();
String content=“敏捷的棕色狐狸跳过懒狗。”;
ContentStream ContentStream=new ContentStreamImpl(“text.txt”,
BigInteger.valueOf(content.length()),
“文本/普通”,新ByteArrayInputStream(内容。
getBytes());
Document newDocument=root.createDocument(属性,
contentStream、VersioningState.MAJOR、策略、添加、删除、,
session.getDefaultContext());
System.out.println(newDocument.getId());
}                

回复@rishthnx是否有任何问题,是的,代码运行正常,我有一个问题,我可以在alfresco中创建一个文件夹到另一个文件夹的链接,就像在windows机器中创建文件夹或文档的快捷方式一样。thnx再次打开一个新主题,我将尽力帮助您,请不要忘记给我一个关于
Alfresco:Failed to create directory
hi,thnx的反馈,谢谢您的帮助。我发布了这个问题[。请帮助查看以下页面:尝试我的示例并给我们反馈