@@ -65,18 +65,36 @@ public Response handleGet(
65
65
}
66
66
67
67
68
+ /**
69
+ * Accepts a POST request. The service accepts 2 variations for a POST request. One as a <code>form</code> parameter
70
+ * and the other as a <code>json</code> parameter. A <code>json</code> parameter is given first preference and a
71
+ * <code>form</code> parameter is given a second preference.
72
+ * @param datastore
73
+ * @param version
74
+ * @param url
75
+ * @param queryJson
76
+ * @param formJson
77
+ * @param formParamQuery
78
+ * @param formParamJson
79
+ * @return
80
+ */
68
81
@ POST
69
82
@ Produces ("application/json" )
70
83
public Response handlePost (
71
84
@ PathParam (value ="ds" ) final String datastore ,
72
85
@ PathParam (value = "version" ) final String version ,
73
86
@ PathParam (value = "url" ) final String url ,
74
87
@ QueryParam (value = "json" ) final String queryJson ,
75
- @ FormParam (value = "json" ) final String formJson
88
+ @ FormParam (value = "json" ) final String formJson ,
89
+ @ QueryParam (value = "form" ) final String formParamQuery ,
90
+ @ FormParam (value = "form" ) final String formParamJson
76
91
) {
77
92
final String wsPath = "/" + version + "/" + url ;
78
93
logger .debug ("Webservice called [POST]: " + wsPath );
79
94
JSONObject jsonRequest = queryJson != null ? new JSONObject (queryJson ) : formJson != null ? new JSONObject (formJson ) : new JSONObject ();
95
+ if (jsonRequest .isEmpty ()) {
96
+ jsonRequest = formParamQuery != null ? new JSONObject (formParamQuery ) : formParamJson != null ? new JSONObject (formParamJson ) : new JSONObject ();
97
+ }
80
98
return Response .ok ().header ("Access-Control-Allow-Origin" , "*" ).entity (webServiceExecutor .executeGet (datastore , wsPath , jsonRequest ).toString ()).build ();
81
99
}
82
100
}
0 commit comments