06-05-2017 10:22 AM
como logro agregar archivos al Alfresco a travez de java?
he realizado este codigo, pero aun no logro insertar documentos
mi correo es :hernandez.jorge51@gmail.com
Gracias
public void uploadDocument(String authTicket, File fileobj, String filename, String filetype, String description, String destination) {
try {
String urlString = "http://172.16.0.222:8080/alfresco/s/api/upload?alf_ticket=" + authTicket;
System.out.println("The upload url:::" + urlString);
HttpClient client = new HttpClient();
PostMethod mPost = new PostMethod(urlString);
Part[] parts = {
new FilePart("filedata", filename, fileobj, filetype, null),
new StringPart("filename", filename),
new StringPart("description", "description"),
new StringPart("siteid", "demo"),
new StringPart("containerid", "documentlibrary"),
};
mPost.setRequestEntity(
new MultipartRequestEntity(parts, mPost.getParams())
);
int statusCode1 = client.executeMethod(mPost);
System.out.println("statusLine>>>" + statusCode1 + "......" + mPost.getStatusLine() + mPost.getResponseBodyAsString());
mPost.releaseConnection();
} catch (Exception e) {
System.out.println(e);
}
}
06-06-2017 03:30 AM
¿Este código produce algún error? En cliente o en servidor.
06-06-2017 09:37 AM
Alfresco es la version 5
run:
<?xml version="1.0" encoding="UTF-8"?>
<ticket>TICKET_18fd97bc07172a581bd85bbac85dacb3fc242c7b</ticket>
: <?xml version="1.0" encoding="UTF-8"?>
<ticket>TICKET_18fd97bc07172a581bd85bbac85dacb3fc242c7b</ticket>
numero : 47 -- 94
The upload url:::http://172.16.0.222:8080/alfresco/s/api/upload?alf_ticket=TICKET_18fd97bc07172a581bd85bbac85dacb3fc2...
statusLine>>>404......HTTP/1.1 404 Not Found{
"status" :
{
"code" : 404,
"name" : "Not Found",
"description" : "Requested resource is not available."
},
"message" : "Site (demo) not found.",
"exception" : "",
"callstack" :
[
],
"server" : "Community v5.2.0 (r135134-b14) schema 10,005",
"time" : "Jun 6, 2017 9:29:33 AM"
}
BUILD SUCCESSFUL (total time: 0 seconds)
Gracias por tu ayuda Angel
06-06-2017 01:24 PM
¿Tienes un sitio con el shortname demo creado en Alfresco?
06-06-2017 01:43 PM
te envio la Imagen Angel
06-06-2017 01:56 PM
Eso no es un sitio, pero si una carpeta normal.
Usted necesita crear un sitio usando el menu sitios en el menú principal.
Para veer los sitios creados, usted puede acceder la carpeta Sites.
06-06-2017 02:15 PM
Gracias Douglas y Angel, me salio graciassssssssssss
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.