aboutsummaryrefslogtreecommitdiffstats
path: root/container-core
diff options
context:
space:
mode:
authorHenning Baldersheim <balder@yahoo-inc.com>2022-11-29 17:40:00 +0100
committerHenning Baldersheim <balder@yahoo-inc.com>2022-11-29 17:40:00 +0100
commite807b7cab069732251d797a25f2bb6c8fd70c095 (patch)
tree19a421508950b5a00902bc6ee99fe0b99b83646c /container-core
parentdeaac2672dbf627a319b7ebaba808e7918bd0186 (diff)
Reduce need to access getJDiscRequest
Diffstat (limited to 'container-core')
-rw-r--r--container-core/abi-spec.json4
-rw-r--r--container-core/src/main/java/com/yahoo/container/jdisc/HttpRequest.java25
2 files changed, 29 insertions, 0 deletions
diff --git a/container-core/abi-spec.json b/container-core/abi-spec.json
index 9c2638a0a64..5f86db1d385 100644
--- a/container-core/abi-spec.json
+++ b/container-core/abi-spec.json
@@ -627,6 +627,10 @@
"public com.yahoo.jdisc.http.HttpRequest$Method getMethod()",
"public java.net.URI getUri()",
"public com.yahoo.jdisc.http.HttpRequest getJDiscRequest()",
+ "public java.util.Map context()",
+ "public long creationTime(java.util.concurrent.TimeUnit)",
+ "public long getConnectedAt(java.util.concurrent.TimeUnit)",
+ "public long relativeCreatedAtNanoTime()",
"public java.lang.String getProperty(java.lang.String)",
"public java.util.Map propertyMap()",
"public boolean getBooleanProperty(java.lang.String)",
diff --git a/container-core/src/main/java/com/yahoo/container/jdisc/HttpRequest.java b/container-core/src/main/java/com/yahoo/container/jdisc/HttpRequest.java
index 39f55cedff5..100fb053ecf 100644
--- a/container-core/src/main/java/com/yahoo/container/jdisc/HttpRequest.java
+++ b/container-core/src/main/java/com/yahoo/container/jdisc/HttpRequest.java
@@ -455,12 +455,37 @@ public class HttpRequest {
return parentRequest;
}
+ /**
+ * <p>Returns the named application context objects. This data is not intended for network transport, rather they
+ * are intended for passing shared data between components of an Application.</p>
+ *
+ * @return The context map.
+ */
+ public Map<String, Object> context() {
+ return parentRequest.context();
+ }
+
/** Returns the time at which this Request was created. */
public long creationTime(TimeUnit unit) {
return parentRequest.creationTime(unit);
}
/**
+ * <p>For server requests, this returns the timestamp of when the underlying HTTP channel was connected.
+ *
+ * @param unit the unit to return the time in
+ * @return the timestamp of when the underlying HTTP channel was connected, or request creation time
+ */
+ public long getConnectedAt(TimeUnit unit) {
+ return parentRequest.getConnectedAt(TimeUnit.MILLISECONDS);
+ }
+
+ /**
+ * @return the relative created timestamp (using {@link System#nanoTime()}
+ */
+ public long relativeCreatedAtNanoTime() { return parentRequest.relativeCreatedAtNanoTime(); }
+
+ /**
* Returns the value of a request property/parameter.
* Multi-value properties are not supported.
*