Re: FileUpload with ERRest
Re: FileUpload with ERRest
- Subject: Re: FileUpload with ERRest
- From: André Rothe <email@hidden>
- Date: Tue, 13 Mar 2018 17:07:15 +0100
Hm, this results in a NullPointerException on response() and
errorResponse(). Is it mandatory to have an EO name within the route?
André
On 13.03.2018 15:58, André Rothe wrote:
> Maybe I can add a route in the Application class:
>
> routeRequestHandler.addRoute(new ERXRoute(null, "/upload",
> ERXRoute.Method.Post, UploadController.class, "uploadFile"));
>
> And then I could implement a controller class UploadController:
>
> public class UploadController extends ERXRouteController {
>
> private static final int HTTP_UNSUPPORTED_MEDIA_TYPE = 415;
>
> public UploadController(WORequest request) {
> super(request);
> }
>
> public WOActionResults uploadFileAction() throws Throwable {
>
> if (!request().isMultipartFormData()) {
> return errorResponse(HTTP_UNSUPPORTED_MEDIA_TYPE);
> }
>
> // TODO: get some form parameters and values,
> // store the file content into the temp folder,
> // process the file
>
> // TODO: maybe I can return the newly created EO id?
>
> return response(WOResponse.HTTP_STATUS_OK);
> }
> }
>
> ~André
>
> On 13.03.2018 14:07, André Rothe wrote:
>> Hi,
>>
>> Is it possible to use ERRest for a file upload with multipart-form-data?
>> I try to upload a file to the server to create an instance of an EO
>> (instead of the createAction()).
>>
>> Thank you
>> André
>>
>> _______________________________________________
>> Do not post admin requests to the list. They will be ignored.
>> Webobjects-dev mailing list (email@hidden)
>> Help/Unsubscribe/Update your Subscription:
>>
>> This email sent to email@hidden
>>
>
--
UNIVERSITÄT LEIPZIG
Medizinische Fakultät
Zentrum für Klinische Studien Leipzig – KKS
André Rothe
CIO
Härtelstr. 16-18, 04107 Leipzig
Tel: 0341/ 97 16118
Fax: 0341/ 97 16189
WWW: http://www.zks.uni-leipzig.de
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden