AnsweredAssumed Answered

Problema al descargar contenido

Question asked by amadorar on Feb 23, 2010
Latest reply on Mar 16, 2010 by mjuarez
Buenas,

Estoy utilizando la API de Webservices de Alfresco y tengo porblemas para descargar contenidos.

Mi código es este:

ContentServiceSoapBindingStub contentService = WebServiceFactory.getContentService();

            Reference contentReference = new Reference(STORE, null, ruta);
           
            Content[] readResult = contentService.read(
                    new Predicate(new Reference[]{contentReference}, STORE, null),
                    Constants.PROP_CONTENT);
            Content content = readResult[0];
           
            ByteArrayOutputStream out = new ByteArrayOutputStream();
            InputStream in = ContentUtils.getContentAsInputStream(content);
            byte[] buf = new byte[2048];
            int size;
            while ((size=in.read(buf)) != -1 ) {
               out.write(buf, 0, size);
            }
            byte [] array = out.toByteArray();
            return array;

En el array siempre se devuelve la cadena de bytes de la página de login de Alfresco:

<body bgcolor="#ffffff" style="background-image: url(/alfresco/images/logo/AlfrescoFadedBG.png); background-repeat: no-repeat; background-attachment: fixed">

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
    "http://www.w3.org/TR/html4/loose.dtd">
<html><head><title>Alfresco Web Client - Login</title>
<link rel="search" type="application/opensearchdescription+xml" href="/alfresco/wcservice/api/search/keyword/description.xml" title="Alfresco Keyword Search">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<link rel="stylesheet" href="/alfresco/css/main.css" type="text/css">
<link rel="stylesheet" href="/alfresco/css/picker.css" type="text/css">
<script type="text/javascript" src="/alfresco/scripts/menu.js"></script>
<script type="text/javascript" src="/alfresco/scripts/webdav.js"></script>
<script type="text/javascript" src="/alfresco/scripts/ajax/yahoo/yahoo/yahoo-min.js"></script>
<script type="text/javascript" src="/alfresco/scripts/ajax/yahoo/connection/connection-min.js"></script>
<script type="text/javascript" src="/alfresco/scripts/ajax/yahoo/event/event-min.js"></script>
<script type="text/javascript" src="/alfresco/scripts/ajax/mootools.v1.11.js"></script>
<script type="text/javascript" src="/alfresco/scripts/ajax/common.js"></script>
<script type="text/javascript" src="/alfresco/scripts/ajax/summary-info.js"></script>
<script type="text/javascript" src="/alfresco/scripts/ajax/picker.js"></script>
<script type="text/javascript" src="/alfresco/scripts/ajax/tagger.js"></script>
<script type="text/javascript">setContextPath('/alfresco');</script>
</head><body>








<form id="loginForm" name="loginForm" method="post" action="/alfresco/faces/jsp/login.jsp" accept-charset="UTF-8" enctype="application/x-www-form-urlencoded">

<table width=100% height=98% align=center>
<tr width=100% align=center>
<td valign=middle align=center width=100%>

<table cellspacing=0 cellpadding=0 border=0>
<tr><td width=7><img src='/alfresco/images/parts/white_01.gif' width=7 height=7 alt=''></td>
<td background='/alfresco/images/parts/white_02.gif'>
<img src='/alfresco/images/parts/white_02.gif' width=7 height=7 alt=''></td>
<td width=7><img src='/alfresco/images/parts/white_03.gif' width=7 height=7 alt=''></td>
</tr>
<tr><td background='/alfresco/images/parts/white_04.gif'>
<img src='/alfresco/images/parts/white_04.gif' width=7 height=7 alt=''></td><td bgcolor='white'>

<table border=0 cellspacing=4 cellpadding=2>
<tr>
<td colspan=2>
<img src='/alfresco/images/logo/AlfrescoLogo200.png' width=200 height=58 alt="Alfresco" title="Alfresco">
</td>
</tr>

<tr>
<td colspan=2>
<span class='mainSubTitle'>Enter Login details:</span>
</td>
</tr>

<tr>
<td>
User Name:
</td>
<td>

<input id="loginForm:user-name" name="loginForm:user-name" type="text" value="" style="width:150px" />
</td>
</tr>

<tr>
<td>
Password:
</td>
<td>


<input type="password" id="loginForm:user-password" name="loginForm:user-password" style="width:150px" />
</td>
</tr>

<tr>
<td>
Language:
</td>
<td>



<select id="loginForm:language" name="loginForm:language" size="1" style="width:150px" onchange="document.forms['loginForm'].submit(); return true;">   <option value="en_US" selected="selected">English</option>   <option value="es_ES">Spanish</option></select>
</td>
</tr>

<tr>
<td colspan=2 align=right>
<input id="loginForm:submit" name="loginForm:submit" type="submit" value="Login" onclick="if(typeof window.clearFormHiddenParams_loginForm!='undefined'){clearFormHiddenParams_loginForm('loginForm');}" />
</td>
</tr>

<tr>
<td colspan=2>


</td>
</tr>
</table>

</td><td background='/alfresco/images/parts/white_06.gif'>
<img src='/alfresco/images/parts/white_06.gif' width=7 height=7 alt=''></td></tr>
<tr><td width=7><img src='/alfresco/images/parts/white_07.gif' width=7 height=7 alt=''></td>
<td background='/alfresco/images/parts/white_08.gif'>
<img src='/alfresco/images/parts/white_08.gif' width=7 height=7 alt=''></td>
<td width=7><img src='/alfresco/images/parts/white_09.gif' width=7 height=7 alt=''></td></tr>
</table>

<div id="no-cookies" style="display:none">
<table cellpadding="0" cellspacing="0" border="0" style="padding-top:16px;">
<tr>
<td>
<table cellspacing='0' cellpadding='0' style='border-width: 0px; width: 100%'><tr><td style='width: 7px;'><img src='/alfresco/images/parts/yellowInner_01.gif' width='7' height='7' alt=''/></td><td style='background-image: url(/alfresco/images/parts/yellowInner_02.gif)'><img src='/alfresco/images/parts/yellowInner_02.gif' width='7' height='7' alt=''/></td><td style='width: 7px;'><img src='/alfresco/images/parts/yellowInner_03.gif' width='7' height='7' alt=''/></td></tr><tr><td style='background-image: url(/alfresco/images/parts/yellowInner_04.gif)'><img src='/alfresco/images/parts/yellowInner_04.gif' width='7' height='7' alt=''/></td><td style='background-color:#ffffcc;'>
<table cellpadding="0" cellspacing="0" border="0">
<tr>
<td valign=top style="padding-top:2px" width=20><img src="/alfresco/images/icons/info_icon.gif" height="16" width="16" /></td>
<td class="mainSubText">
Cookies must be enabled in your browser for the Alfresco Web-Client to function correctly.
</td>
</tr>
</table>
</td><td style='background-image: url(/alfresco/images/parts/yellowInner_06.gif)'><img src='/alfresco/images/parts/yellowInner_06.gif' width='7' height='7' alt=''/></td></tr><tr><td style='width: 7px;'><img src='/alfresco/images/parts/yellowInner_07.gif' width='7' height='7' alt=''/></td><td style='background-image: url(/alfresco/images/parts/yellowInner_08.gif)'><img src='/alfresco/images/parts/yellowInner_08.gif' width='7' height='7' alt=''/></td><td style='width: 7px;'><img src='/alfresco/images/parts/yellowInner_09.gif' width='7' height='7' alt=''/></td></tr></table>
</td>
</tr>
</table>
</div>
<script>
document.cookie="_alfTest=_alfTest"
var cookieEnabled = (document.cookie.indexOf("_alfTest") != -1);
if (cookieEnabled == false)
{
document.getElementById("no-cookies").style.display = 'inline';
}
</script>

</td>
</tr>

</table>

<input type="hidden" name="loginForm_SUBMIT" value="1" /><input type="hidden" name="loginForm:_idcl" /><input type="hidden" name="loginForm:_link_hidden_" /><script type="text/javascript"><!–

   function clear_loginForm()
   {
      clearFormHiddenParams_loginForm('loginForm');
   }
   
   function clearFormHiddenParams_loginForm(currFormName)
   {
      var f = document.forms['loginForm'];
      f.elements['loginForm:_idcl'].value='';
      f.elements['loginForm:_link_hidden_'].value='';
      f.target='';
   }
   
   clearFormHiddenParams_loginForm();
//–></script><input type="hidden" name="javax.faces.ViewState" id="javax.faces.ViewState" value="rO0ABXVyABNbTGphdmEubGFuZy5PYmplY3Q7kM5YnxBzKWwCAAB4cAAAAAN0AAExcHQADi9qc3AvbG9naW4uanNw" /></form>


<script>

if (document.getElementById("loginForm:user-name").value.length == 0)
{
document.getElementById("loginForm:user-name").focus();
}
else
{
document.getElementById("loginForm:user-password").focus();
}

</script>


</body></html>

</body>

Para subir contenido no tengo problemas, y he revisasdo el contenido que se intenta descargar y está perfectamente subido al servidor. Además, no me da error al iniciar la sesión.

¿Alguna idea de cuál podría ser la causa?

Gracias

Outcomes