@@ -62,23 +62,24 @@ public class EIRequestsController {
62
62
private EIRequestsControllerUtils eiRequestsControllerUtils ;
63
63
64
64
/**
65
- * Bridge all EI Http Requests with GET method. Used for fetching Subscription by id or all subscriptions and EI Env
66
- * Info.
65
+ * Bridge all Eiffel Intelligence HTTP GET requests.
67
66
*
68
67
* @param model
69
- * @param request
68
+ * @param incomingRequest
70
69
* @return
71
70
*/
72
71
@ CrossOrigin
73
- @ RequestMapping (value = { "/subscriptions" , "/subscriptions/*" , "/information" , "/download/*" , "/auth" , "/auth/*" ,
72
+ @ RequestMapping (value = { "/subscriptions" , "/subscriptions/*" ,
73
+ "/information" , "/templates/*" , "/auth" , "/auth/*" ,
74
74
"/queryAggregatedObject" , "/failed-notifications" , "/query" , "/rules" , "/status" ,
75
75
"/rules/rule-check/testRulePageEnabled" }, method = RequestMethod .GET )
76
76
public ResponseEntity <String > getRequests (Model model , HttpServletRequest incomingRequest ) {
77
77
String eiRequestUrl ;
78
78
try {
79
79
eiRequestUrl = eiRequestsControllerUtils .getEIRequestURL (incomingRequest );
80
80
} catch (EiBackendInstancesException e ) {
81
- LOG .info ("Some failure when forwarding request to EI Backend. Error: " + e .getMessage ());
81
+ LOG .error ("Some failure when forwarding request to EI Backend. "
82
+ + "Error: " + e .getMessage ());
82
83
String response = "{\" message\" : \" Internal Error: " + e .getMessage () + "\" }" ;
83
84
return new ResponseEntity <>(response , null , HttpStatus .INTERNAL_SERVER_ERROR );
84
85
}
@@ -90,7 +91,7 @@ public ResponseEntity<String> getRequests(Model model, HttpServletRequest incomi
90
91
}
91
92
92
93
/**
93
- * Bridge all EI Http Requests with POST method .
94
+ * Bridge all Eiffel Intelligence HTTP POST requests .
94
95
*
95
96
* @param model
96
97
* @param incomingRequest
@@ -104,7 +105,8 @@ public ResponseEntity<String> postRequests(Model model, HttpServletRequest incom
104
105
try {
105
106
eiRequestUrl = eiRequestsControllerUtils .getEIRequestURL (incomingRequest );
106
107
} catch (EiBackendInstancesException e ) {
107
- LOG .info ("Some failure when forwarding request to EI Backend. Error: " + e .getMessage ());
108
+ LOG .error ("Some failure when forwarding request to EI Backend. "
109
+ + "Error: " + e .getMessage ());
108
110
String response = "{\" message\" : \" Internal Error: " + e .getMessage () + "\" }" ;
109
111
return new ResponseEntity <>(response , null , HttpStatus .INTERNAL_SERVER_ERROR );
110
112
}
@@ -121,7 +123,7 @@ public ResponseEntity<String> postRequests(Model model, HttpServletRequest incom
121
123
LOG .error ("Forward Request Errors: " + e );
122
124
}
123
125
124
- LOG .debug ("Input Request JSON Content to be forwarded:\n " + requestBody );
126
+ LOG .debug ("Input request JSON content to be forwarded:\n " + requestBody );
125
127
126
128
HttpEntity inputReqJsonEntity = new ByteArrayEntity (requestBody .getBytes ());
127
129
@@ -135,7 +137,8 @@ public ResponseEntity<String> postRequests(Model model, HttpServletRequest incom
135
137
}
136
138
137
139
/**
138
- * Bridge all EI Http Requests with PUT method. E.g. Making Update Subscription Request.
140
+ * Bridge all Eiffel Intelligence HTTP PUT requests. For example updating
141
+ * an existing subscription.
139
142
*
140
143
* @param model
141
144
* @param incomingRequest
@@ -148,7 +151,8 @@ public ResponseEntity<String> putRequests(Model model, HttpServletRequest incomi
148
151
try {
149
152
eiRequestUrl = eiRequestsControllerUtils .getEIRequestURL (incomingRequest );
150
153
} catch (EiBackendInstancesException e ) {
151
- LOG .info ("Some failure when forwarding request to EI Backend. Error: " + e .getMessage ());
154
+ LOG .error ("Some failure when forwarding request to EI Backend. "
155
+ + "Error: " + e .getMessage ());
152
156
String response = "{\" message\" : \" Internal Error: " + e .getMessage () + "\" }" ;
153
157
return new ResponseEntity <>(response , null , HttpStatus .INTERNAL_SERVER_ERROR );
154
158
}
@@ -163,7 +167,7 @@ public ResponseEntity<String> putRequests(Model model, HttpServletRequest incomi
163
167
LOG .error ("Forward Request Errors: " + e );
164
168
}
165
169
166
- LOG .debug ("Input Request JSON Content to be forwarded:\n " + requestBody );
170
+ LOG .debug ("Input request JSON content to be forwarded:\n " + requestBody );
167
171
168
172
HttpEntity inputReqJsonEntity = new ByteArrayEntity (requestBody .getBytes ());
169
173
@@ -177,7 +181,8 @@ public ResponseEntity<String> putRequests(Model model, HttpServletRequest incomi
177
181
}
178
182
179
183
/**
180
- * Bridge all EI Http Requests with DELETE method. Used for DELETE subscriptions.
184
+ * Bridge all Eiffel Intelligence HTTP DELETE requests. For example to
185
+ * delete a subscription.
181
186
*
182
187
* @param model
183
188
* @param incomingRequest
@@ -190,7 +195,8 @@ public ResponseEntity<String> deleteRequests(Model model, HttpServletRequest inc
190
195
try {
191
196
eiRequestUrl = eiRequestsControllerUtils .getEIRequestURL (incomingRequest );
192
197
} catch (EiBackendInstancesException e ) {
193
- LOG .info ("Some failure when forwarding request to EI Backend. Error: " + e .getMessage ());
198
+ LOG .error ("Some failure when forwarding request to EI Backend. "
199
+ + "Error: " + e .getMessage ());
194
200
String response = "{\" message\" : \" Internal Error: " + e .getMessage () + "\" }" ;
195
201
return new ResponseEntity <>(response , null , HttpStatus .INTERNAL_SERVER_ERROR );
196
202
}
@@ -234,7 +240,7 @@ private ResponseEntity<String> executeHttpRequest(HttpRequestBase outgoingReques
234
240
statusCode = HttpStatus .INTERNAL_SERVER_ERROR .value ();
235
241
responseBody = "{\" statusCode\" : " + statusCode + ", \" error\" : \" Forward Request Error: "
236
242
+ String .valueOf (e ) + "\" }" ;
237
- LOG .error ("Forward Request Errors : " + e );
243
+ LOG .error ("Forward request errors : " + e );
238
244
}
239
245
240
246
headers .setContentType (MediaType .APPLICATION_JSON );
@@ -243,8 +249,8 @@ private ResponseEntity<String> executeHttpRequest(HttpRequestBase outgoingReques
243
249
}
244
250
245
251
/**
246
- * This function copies headers from the made request and puts it into the response. It also extracts any
247
- * x-path-tokens if found.
252
+ * This function copies headers from the made request and puts it into the response. It also
253
+ * extracts any x-path-tokens if found.
248
254
*
249
255
* @param headers
250
256
* @param eiResponse
@@ -284,7 +290,7 @@ private HttpHeaders getHeadersFromResponse(HttpHeaders headers, CloseableHttpRes
284
290
}
285
291
286
292
/**
287
- * This function copies headers from the incomming request into the outgoing request headers.
293
+ * This function copies headers from the incoming request into the outgoing request headers.
288
294
*
289
295
* @param outgoingRequest
290
296
* @param incomingRequest
@@ -316,8 +322,8 @@ private HttpRequestBase addHeadersToRequest(HttpRequestBase outgoingRequest, Htt
316
322
}
317
323
318
324
/**
319
- * This function adds an x-path-token to an outgoing request if it exists for the back-end the request is made
320
- * towards.
325
+ * This function adds an x-path-token to an outgoing request if it exists, for the back-end the
326
+ * request is made towards.
321
327
*
322
328
* @param outgoingRequest
323
329
* @param incomingRequest
@@ -348,7 +354,8 @@ private HttpRequestBase addXauthTokenToRequest(HttpRequestBase outgoingRequest,
348
354
}
349
355
350
356
/**
351
- * builds an xPathTokenKey, the token will be unique key for each http(s) host and port and stored for each session.
357
+ * builds an xPathTokenKey, the token will be unique key for each http(s) host and port and
358
+ * stored for each session.
352
359
*
353
360
* @param uri
354
361
* @return
0 commit comments