org.silverpeas.upload.web
Class FileUploadResource
java.lang.Object
com.silverpeas.web.RESTWebService
org.silverpeas.upload.web.FileUploadResource
@Service
@RequestScoped
@Authenticated
public class FileUploadResource
- extends RESTWebService
A REST Web resource that permits to upload files. It has to be used with one of the following
plugins:
- silverpeas-filUpload.js: useful to handle file upload on resource creation
- silverpeas-ddUpload.js: useful to handle drag & drop file upload on existing resources
- Author:
- Yohann Chastagnier
Method Summary |
javax.ws.rs.core.Response |
delete()
|
String |
getComponentId()
Gets the identifier of the component instance to which the requested resource belongs to. |
javax.ws.rs.core.Response |
uploadFile(InputStream inputStream)
Permits to upload one file from http request. |
javax.ws.rs.core.Response |
uploadFiles()
Permits to upload files from multipart http request. |
javax.ws.rs.core.Response |
verify()
Performs some verifications before starting a file upload. |
Methods inherited from class com.silverpeas.web.RESTWebService |
getBundle, getBundleLocation, getGreaterUserRole, getHttpRequest, getHttpServletRequest, getHttpServletResponse, getOrganisationController, getUriInfo, getUserDetail, getUserPreferences, getUserRoles, process, validateUserAuthentication, validateUserAuthorization |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
FileUploadResource
public FileUploadResource()
verify
public javax.ws.rs.core.Response verify()
- Performs some verifications before starting a file upload.
All the verifications are checked again on the effective upload (security).
- Returns:
uploadFiles
public javax.ws.rs.core.Response uploadFiles()
throws IOException
- Permits to upload files from multipart http request.
If the user isn't authenticated, a 401 HTTP code is returned.
If a problem occurs when processing the request, a 503 HTTP code is returned.
- Returns:
- the response in relation with jQuery plugins used on the client side: a html textarea
tag that contains a JSON array structure. Each line of this array contains
information of an uploaded file :
- fileId : the uploaded file identifier
- name : the name of the uploaded file (without its path)
- size : the byte size of the uploaded file
- formattedSize : the formatted file size according to the language of
user
- iconUrl : the url of the icon that represents the type of the uploaded
file
- Throws:
IOException
uploadFile
public javax.ws.rs.core.Response uploadFile(InputStream inputStream)
- Permits to upload one file from http request.
If the user isn't authenticated, a 401 HTTP code is returned.
If a problem occurs when processing the request, a 503 HTTP code is returned.
- Returns:
- the response in relation with jQuery plugins used on the client side: a html textarea
tag that contains a JSON array structure. Each line of this array contains
information of an uploaded file :
- fileId : the uploaded file identifier
- name : the name of the uploaded file (without its path)
- size : the byte size of the uploaded file
- formattedSize : the formatted file size according to the language of
user
- iconUrl : the url of the icon that represents the type of the uploaded
file
delete
public javax.ws.rs.core.Response delete()
getComponentId
public String getComponentId()
- Description copied from class:
RESTWebService
- Gets the identifier of the component instance to which the requested resource belongs to.
- Specified by:
getComponentId
in class RESTWebService
- Returns:
- the identifier of the Silverpeas component instance.
Copyright © 2016 Silverpeas. All Rights Reserved.