From 7c76a9a7b310d06c2b8676de211afcde56361d1e Mon Sep 17 00:00:00 2001 From: dilanSachi Date: Tue, 13 Jun 2023 14:07:24 +0530 Subject: [PATCH] Add missing uri method --- .../org/ballerinalang/net/http/HttpDispatcher.java | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/stdlib/http/src/main/java/org/ballerinalang/net/http/HttpDispatcher.java b/stdlib/http/src/main/java/org/ballerinalang/net/http/HttpDispatcher.java index 656622242b38..60abbb114b17 100644 --- a/stdlib/http/src/main/java/org/ballerinalang/net/http/HttpDispatcher.java +++ b/stdlib/http/src/main/java/org/ballerinalang/net/http/HttpDispatcher.java @@ -34,6 +34,7 @@ import java.io.IOException; import java.io.UnsupportedEncodingException; +import java.net.URI; import java.net.URLDecoder; import java.util.HashMap; import java.util.List; @@ -108,6 +109,16 @@ private static void setInboundReqProperties(HttpCarbonMessage inboundReqMsg, Str inboundReqMsg.setProperty(HttpConstants.RAW_QUERY_STR, rawQuery); } + public static URI getValidatedURI(String uriStr) { + URI requestUri; + try { + requestUri = URI.create(uriStr); + } catch (IllegalArgumentException e) { + throw new BallerinaConnectorException(e.getMessage()); + } + return requestUri; + } + /** * This method finds the matching resource for the incoming request. *