From e29b2749e6efedb7e5a6a1f36afe3a56f8384f0a Mon Sep 17 00:00:00 2001 From: constantine2nd Date: Thu, 1 Mar 2018 15:01:24 +0100 Subject: [PATCH 1/2] Added getServerPort and getServerName functions --- src/main/scala/code/api/util/APIUtil.scala | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/main/scala/code/api/util/APIUtil.scala b/src/main/scala/code/api/util/APIUtil.scala index ea4c65ffc..f0a6a355f 100644 --- a/src/main/scala/code/api/util/APIUtil.scala +++ b/src/main/scala/code/api/util/APIUtil.scala @@ -1697,6 +1697,14 @@ Returns a string showed to the developer * @return - the source port of the client or last seen proxy. */ def getRemotePort(): Int = S.containerRequest.map(_.remotePort).openOr(0) + /** + * @return - the server port + */ + def getServerPort(): Int = S.containerRequest.map(_.serverPort).openOr(0) + /** + * @return - the host name of the server + */ + def getServerName(): String = S.containerRequest.map(_.serverName).openOr("Unknown") /** From a45e1941154d198cc925add28fa1c860d63fddb2 Mon Sep 17 00:00:00 2001 From: constantine2nd Date: Fri, 2 Mar 2018 08:54:38 +0100 Subject: [PATCH 2/2] Added new props documented_root_url --- src/main/resources/props/sample.props.template | 6 +++++- src/main/scala/code/api/util/APIUtil.scala | 7 +++++++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/src/main/resources/props/sample.props.template b/src/main/resources/props/sample.props.template index 086d8b9c1..ba0d4a9fa 100644 --- a/src/main/resources/props/sample.props.template +++ b/src/main/resources/props/sample.props.template @@ -430,4 +430,8 @@ display_internal_errors=false # oauth2.jwt.use.ssl=false # URL of Public server JWK set used for validating bearer JWT access tokens # oauth2.jwk_set.url=http://localhost:8080/openid-connect-server-webapp/jwk.json -# ----------------------------------------------------------- OAuth 2 ----------- \ No newline at end of file +# ----------------------------------------------------------- OAuth 2 ----------- + +## This property is used for documenting at Resource Doc +## (this needs to be a URL) +documented_root_url=https://openbankproject.com \ No newline at end of file diff --git a/src/main/scala/code/api/util/APIUtil.scala b/src/main/scala/code/api/util/APIUtil.scala index b278fd4b9..af66187be 100644 --- a/src/main/scala/code/api/util/APIUtil.scala +++ b/src/main/scala/code/api/util/APIUtil.scala @@ -104,6 +104,7 @@ val dateformat = new java.text.SimpleDateFormat("yyyy-MM-dd") val ApiVersionNotSupported = "OBP-00008: The API version you called is not enabled on this server. Please contact your API administrator or use another version." val FirehoseViewsNotAllowedOnThisInstance = "OBP-00009: Firehose views not allowed on this instance. Please set allow_firehose_views = true in props files. " + val MissingPropsValueAtThisInstance = "OBP-00010: Missing props value at this API instance - " // General messages (OBP-10XXX) val InvalidJsonFormat = "OBP-10001: Incorrect json format." @@ -2495,6 +2496,12 @@ Versions are groups of endpoints in a file if(view.isFirehose && canUseFirehose(user)) true else false } + + /** + * This function is used to get property which is used for documenting at Resource Doc + * @return Value of property documented_root_url + */ + def getDocumentedRootUrl: String = getPropsValue("documented_root_url").openOr(MissingPropsValueAtThisInstance + "documented_root_url") }