星期四, 4月 07, 2011

[Alfresco] upload user avatar using resetful api

Build a uploadavatar.jsp page to test uploadavatar restful api.
The page content is shown as the below:

<form id="avatar" enctype="multipart/form-data"
action="http://ideas-cosa.dyndns.org/alfresco/service/slingshot/profile/uploadavatar?alf_ticket=TICKET_32178fa17bcf3b975e76129dccb78d646466e88d" method="post">
<input type="text" name="username" value="ken"/>
Select a file:
<input type="file" name="filedata" />
<input type="submit" name="button" value="upload" />
</form>



Http Request

POST /alfresco/service/slingshot/profile/uploadavatar?alf_ticket=TICKET_32178fa17bcf3b975e76129dccb78d646466e88d HTTP/1.1
Host: ideas-cosa.dyndns.org
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.1; zh-TW; rv:1.9.2.16) Gecko/20110319 AskTbPTV2/3.11.3.15590 Firefox/3.6.16
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Language: zh-tw,en-us;q=0.7,en;q=0.3
Accept-Encoding: gzip,deflate
Accept-Charset: UTF-8,*
Keep-Alive: 115
Connection: keep-alive
Referer: http://localhost:8080/MyCOSA/testing/uploadavatar.jsp
Cookie: alfUser0=S2Vu
Content-Type: multipart/form-data; boundary=---------------------------41184676334
Content-Length: 18444
-----------------------------41184676334
Content-Disposition: form-data; name="username"

ken
-----------------------------41184676334
Content-Disposition: form-data; name="filedata"; filename="187175_100000493351741_4868577_n.jpg"
Content-Type: image/jpeg

ÿØÿà
HTTP/1.1 200 OK
Server: Apache-Coyote/1.1
Set-Cookie: JSESSIONID=1406ED3E9857805A3C121151D6391762; Path=/alfresco
Cache-Control: no-cache
Pragma: no-cache
Content-Type: application/json;charset=UTF-8
Content-Length: 250
Date: Fri, 08 Apr 2011 01:42:21 GMT
----------------------------------------------------------


Return Json
{
"nodeRef": "workspace://SpacesStore/db608282-f0b5-40eb-8a40-d4dce5a3a2b9",
"fileName": "187175_100000493351741_4868577_n.jpg",
"status":
{
"code": 200,
"name": "OK",
"description" : "File uploaded successfully"
}
}

沒有留言:

張貼留言

留個話吧:)

其他你感興趣的文章

Related Posts with Thumbnails