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 protected])
> Help/Unsubscribe/Update your Subscription:
> https://lists.apple.com/mailman/options/webobjects-dev/andre.rothe%40zks.uni-leipzig.de
>
> This email sent to [email protected]
>
--
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 protected])
Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com
This email sent to [email protected]