From: Fulup Ar Foll Date: Tue, 26 Jan 2016 08:16:56 +0000 (+0100) Subject: GetPostPath Ongoing X-Git-Tag: blowfish_2.0.1~290 X-Git-Url: https://gerrit.automotivelinux.org/gerrit/gitweb?a=commitdiff_plain;h=b2247ca634420ed0d5ecc1743834ea4e0666aa2a;p=src%2Fapp-framework-binder.git GetPostPath Ongoing --- diff --git a/include/proto-def.h b/include/proto-def.h index 0f5ca048..65f34666 100644 --- a/include/proto-def.h +++ b/include/proto-def.h @@ -26,6 +26,7 @@ PUBLIC int getQueryAll(AFB_request * request, char *query, size_t len); PUBLIC AFB_PostHandle* getPostHandle (AFB_request *request); PUBLIC json_object* getPostFile (AFB_request *request, AFB_PostItem *item, char* destination) ; PUBLIC AFB_PostCtx* getPostContext (AFB_request *request); +PUBLIC char* getPostPath (AFB_request *request); // rest-api PUBLIC void endPostRequest(AFB_PostHandle *posthandle); diff --git a/plugins/samples/SamplePost.c b/plugins/samples/SamplePost.c index 13e1ad67..9828349a 100644 --- a/plugins/samples/SamplePost.c +++ b/plugins/samples/SamplePost.c @@ -53,7 +53,7 @@ STATIC json_object* UploadAppli (AFB_request *request, AFB_PostItem *item) { // Do something intelligent here to install application postFileCtx->errcode = MHD_HTTP_OK; // or error is something went wrong; - postFileCtx->jresp = jsonNewMessage(AFB_SUCCESS,"UploadFile Post Appli done"); + postFileCtx->jresp = jsonNewMessage(AFB_SUCCESS,"UploadFile Post Appli=%s done", getPostPath (request)); } } diff --git a/src/helper-api.c b/src/helper-api.c index a166027a..12539978 100644 --- a/src/helper-api.c +++ b/src/helper-api.c @@ -93,6 +93,18 @@ PUBLIC AFB_PostCtx* getPostContext (AFB_request *request) { return ((AFB_PostCtx*) postHandle->ctx); } +PUBLIC char* getPostPath (AFB_request *request) { + AFB_PostHandle *postHandle = getPostHandle(request); + AFB_PostCtx *postFileCtx; + + if (postHandle == NULL) return NULL; + + postFileCtx = (AFB_PostCtx*) postHandle->ctx; + if (postFileCtx == NULL) return NULL; + + return (postFileCtx->path); +} + PUBLIC json_object* getPostFile (AFB_request *request, AFB_PostItem *item, char* destination) { AFB_PostHandle *postHandle = getPostHandle(request);