AnsweredAssumed Answered

Aceder a webscript(PUT) a partir de JAVA

Question asked by hpalma on Mar 16, 2009
Tenho um caso de uso onde quero aceder a partir de código JAVA ao webscript de actualização de propriedade de um nó:

Update properties (updateProperties)
PUT /alfresco/service/api/node/{store_type}/{store_id}/{id}
PUT /alfresco/service/api/path/{store_type}/{store_id}/{id}
Description:   This service updates properties of the specified object. As per the data model, content-streams are not properties

Inputs:

ID objectId
(Optional) String changeToken
Collection propertyCollection - Subset list of Properties to update

Outputs:

ID objectId

Notes:

Preserves the ID of the object
Subset of properties: Properties not specified in this list are not changed
To remove a property, specify property with no value
If an attempt is made to update a read-only property, throw ConstraintViolationException.
If a ChangeToken is provided by the repository when the object is retrieved, the change token MUST be included as-is when calling updateProperties.
For Multi-Value properties, the whole list of values MUST be provided on every update.
Use getAllowableActions to identify whether older version specified by ID is updatable.
If this is a private working copy, some repositories may not support updates.
Because repositories MAY automatically create new Document Versions on a user’s behalf, the objectId returned may not match the one provided as an input to this method.

Consigo aceder sem problemas a webscripts apenas de leitura baseados no método GET, mas neste não consigo perceber como consigo passar a lista de propriedades a actualizar ao webscript.
Criei o HttpURLConnection e fiz:

connection.setDoOutput(true);
connection.setDoInput(true);
connection.setRequestMethod("PUT");

Agora era suposto escrever para a outputstream retornada pela connection, mas não percebo o que tenho de escrever para a mesma.

Outcomes