Changed duration type to long

This commit is contained in:
2023-06-07 11:19:17 +02:00
parent 3c8f3f4d41
commit aead1109c7
2 changed files with 7 additions and 7 deletions

View File

@@ -28,7 +28,7 @@ public class XPathController implements RestController {
}
private XMLResponseBody prepareErrorResponse(String message, String processor) {
return new XMLResponseBody(message, "ERR", processor, "N/A");
return new XMLResponseBody(message, "ERR", processor, -1);
}
@ScopedControllerManifest(method = HandlerType.POST, path = "/xpath")
@@ -71,7 +71,7 @@ public class XPathController implements RestController {
response.status(200);
long duration = System.currentTimeMillis() - timeStart;
responseBody = new XMLResponseBody(xPathQueryResult.getData().trim(),
"OK", xalan.getVersion(), String.valueOf(duration));
"OK", xalan.getVersion(),duration);
responseBody.setType(xPathQueryResult.getType());
this.logger.info("Request (XPath, Xalan) processed in " + duration + " ms.");
@@ -98,7 +98,7 @@ public class XPathController implements RestController {
long duration = System.currentTimeMillis() - timeStart;
String processor = "Saxon " + saxon.getVersion() + " " + requestBody.getVersion() + " over s9api";
responseBody = new XMLResponseBody(result, "OK", processor, String.valueOf(duration));
responseBody = new XMLResponseBody(result, "OK", processor, duration);
this.logger.info("Request (XPath, Saxon) processed in " + duration + " ms.");
} catch (Exception ex) {

View File

@@ -5,12 +5,12 @@ public class XMLResponseBody {
private String result;
private String status;
private String processor;
private String duration;
private long duration;
// Optional
private String type;
public XMLResponseBody(String result, String status, String processor, String duration) {
public XMLResponseBody(String result, String status, String processor, long duration) {
this.result = result;
this.status = status;
this.processor = processor;
@@ -41,11 +41,11 @@ public class XMLResponseBody {
this.processor = processor;
}
public String getDuration() {
public long getDuration() {
return duration;
}
public void setDuration(String duration) {
public void setDuration(long duration) {
this.duration = duration;
}