Hi,
I\'ll put this message in my poor english and spanish, because I see some answers in spanish.
I have an application using Struts, and I want to create (upload) a document reading using Struts Action on the OpenKM repository.
This code is part from a method in a class that recieve a FormFile strutsFormFile parameter, where FormFile is a class from Struts.
OKMDocumentServiceLocator locatorDocument = new OKMDocumentServiceLocator();
OKMDocument document = null;
Document documento = new Document();
document = locatorDocument.getOKMDocumentPort();
Version version = new Version();
version.setActual(true);
version.setCreated(new GregorianCalendar());
version.setAuthor(\"david\");
version.setName(\"1.0\");
documento.setAuthor(\"david\");
documento.setKeywords(\"keywords\");
documento.setLanguage(\"ES\");
documento.setActualVersion(version);
documento.setMimeType(strutsFormFile.getContentType());
documento.setPath(\"/okm:root/A/Valid/Path\");
try {
document.create(token, documento, strutsFormFile.getFileData());
}
catch ( Exception e ) {
}
When I try to upload a PDF file, strutsFormFile.getContentType() is \"application/pdf\", but I get next Exception
es.git.openkm.core.UnsupportedMimeTypeException: application/octet-stream
I upload pdf files (with MIME/Type application/pdf using the web console without problems, but I cant using WebServices.
Any help?
Hola a todos, tengo un problema con el código que presento arriba. Tengo una aplicación hecha en Struts, que mediante ActionForms y FormFile obtiene un archivo. Quiero subir o crear este archivo en el gestor documental OpenKM. Para ello uso una función como la de arriba que recibe como parámetro el FormFile de Struts. Sin embargo, obtengo una excepción en el content type (el content type que devuelve struts para un archivo pdf es application/pdf)... ¿Qué se me escapa?
Gracias
I\'ll put this message in my poor english and spanish, because I see some answers in spanish.
I have an application using Struts, and I want to create (upload) a document reading using Struts Action on the OpenKM repository.
This code is part from a method in a class that recieve a FormFile strutsFormFile parameter, where FormFile is a class from Struts.
OKMDocumentServiceLocator locatorDocument = new OKMDocumentServiceLocator();
OKMDocument document = null;
Document documento = new Document();
document = locatorDocument.getOKMDocumentPort();
Version version = new Version();
version.setActual(true);
version.setCreated(new GregorianCalendar());
version.setAuthor(\"david\");
version.setName(\"1.0\");
documento.setAuthor(\"david\");
documento.setKeywords(\"keywords\");
documento.setLanguage(\"ES\");
documento.setActualVersion(version);
documento.setMimeType(strutsFormFile.getContentType());
documento.setPath(\"/okm:root/A/Valid/Path\");
try {
document.create(token, documento, strutsFormFile.getFileData());
}
catch ( Exception e ) {
}
When I try to upload a PDF file, strutsFormFile.getContentType() is \"application/pdf\", but I get next Exception
es.git.openkm.core.UnsupportedMimeTypeException: application/octet-stream
I upload pdf files (with MIME/Type application/pdf using the web console without problems, but I cant using WebServices.
Any help?
Hola a todos, tengo un problema con el código que presento arriba. Tengo una aplicación hecha en Struts, que mediante ActionForms y FormFile obtiene un archivo. Quiero subir o crear este archivo en el gestor documental OpenKM. Para ello uso una función como la de arriba que recibe como parámetro el FormFile de Struts. Sin embargo, obtengo una excepción en el content type (el content type que devuelve struts para un archivo pdf es application/pdf)... ¿Qué se me escapa?
Gracias