comparison Plugins/OrthancCPlugin/OrthancCPlugin.h @ 1137:d9c27f9f1a51

OrthancPluginSetHttpHeader
author Sebastien Jodogne <s.jodogne@gmail.com>
date Tue, 09 Sep 2014 17:33:46 +0200
parents 208dc67b9bab
children 2ff467bcfb98
comparison
equal deleted inserted replaced
1136:208dc67b9bab 1137:d9c27f9f1a51
249 _OrthancPluginService_Redirect = 2002, 249 _OrthancPluginService_Redirect = 2002,
250 _OrthancPluginService_SendHttpStatusCode = 2003, 250 _OrthancPluginService_SendHttpStatusCode = 2003,
251 _OrthancPluginService_SendUnauthorized = 2004, 251 _OrthancPluginService_SendUnauthorized = 2004,
252 _OrthancPluginService_SendMethodNotAllowed = 2005, 252 _OrthancPluginService_SendMethodNotAllowed = 2005,
253 _OrthancPluginService_SetCookie = 2006, 253 _OrthancPluginService_SetCookie = 2006,
254 _OrthancPluginService_SetHttpHeader = 2007,
254 255
255 /* Access to the Orthanc database and API */ 256 /* Access to the Orthanc database and API */
256 _OrthancPluginService_GetDicomForInstance = 3000, 257 _OrthancPluginService_GetDicomForInstance = 3000,
257 _OrthancPluginService_RestApiGet = 3001, 258 _OrthancPluginService_RestApiGet = 3001,
258 _OrthancPluginService_RestApiPost = 3002, 259 _OrthancPluginService_RestApiPost = 3002,
1192 1193
1193 1194
1194 typedef struct 1195 typedef struct
1195 { 1196 {
1196 OrthancPluginRestOutput* output; 1197 OrthancPluginRestOutput* output;
1197 const char* cookie; 1198 const char* key;
1198 const char* value; 1199 const char* value;
1199 } _OrthancPluginSetCookie; 1200 } _OrthancPluginSetHttpHeader;
1200 1201
1201 /** 1202 /**
1202 * @brief Set a cookie. 1203 * @brief Set a cookie.
1203 * 1204 *
1204 * This function sets a cookie in the HTTP client. 1205 * This function sets a cookie in the HTTP client.
1212 OrthancPluginContext* context, 1213 OrthancPluginContext* context,
1213 OrthancPluginRestOutput* output, 1214 OrthancPluginRestOutput* output,
1214 const char* cookie, 1215 const char* cookie,
1215 const char* value) 1216 const char* value)
1216 { 1217 {
1217 _OrthancPluginSetCookie params; 1218 _OrthancPluginSetHttpHeader params;
1218 params.output = output; 1219 params.output = output;
1219 params.cookie = cookie; 1220 params.key = cookie;
1220 params.value = value; 1221 params.value = value;
1221 context->InvokeService(context, _OrthancPluginService_SetCookie, &params); 1222 context->InvokeService(context, _OrthancPluginService_SetCookie, &params);
1223 }
1224
1225
1226 /**
1227 * @brief Set some HTTP header.
1228 *
1229 * This function sets a HTTP header in the HTTP answer.
1230 *
1231 * @param context The Orthanc plugin context, as received by OrthancPluginInitialize().
1232 * @param output The HTTP connection to the client application.
1233 * @param key The HTTP header to be set.
1234 * @param value The value of the HTTP header.
1235 **/
1236 ORTHANC_PLUGIN_INLINE void OrthancPluginSetHttpHeader(
1237 OrthancPluginContext* context,
1238 OrthancPluginRestOutput* output,
1239 const char* key,
1240 const char* value)
1241 {
1242 _OrthancPluginSetHttpHeader params;
1243 params.output = output;
1244 params.key = key;
1245 params.value = value;
1246 context->InvokeService(context, _OrthancPluginService_SetHttpHeader, &params);
1222 } 1247 }
1223 1248
1224 1249
1225 typedef struct 1250 typedef struct
1226 { 1251 {
1508 params.create_ = create; 1533 params.create_ = create;
1509 params.read_ = read; 1534 params.read_ = read;
1510 params.remove_ = remove; 1535 params.remove_ = remove;
1511 1536
1512 #ifdef __cplusplus 1537 #ifdef __cplusplus
1538 params.free_ = ::free;
1539 #else
1513 params.free_ = free; 1540 params.free_ = free;
1514 #else
1515 params.free_ = ::free;
1516 #endif 1541 #endif
1517 1542
1518 context->InvokeService(context, _OrthancPluginService_RegisterStorageArea, &params); 1543 context->InvokeService(context, _OrthancPluginService_RegisterStorageArea, &params);
1519 } 1544 }
1520 1545