You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@olingo.apache.org by ar...@apache.org on 2019/08/29 05:34:19 UTC

[olingo-odata4] branch master updated: [OLINGO-1390] Service Resolution variable for spring apps

This is an automated email from the ASF dual-hosted git repository.

archanarai pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/olingo-odata4.git


The following commit(s) were added to refs/heads/master by this push:
     new 73842ec  [OLINGO-1390] Service Resolution variable for spring apps
73842ec is described below

commit 73842ec07b617f125dd50e84236f2001da375139
Author: Archana Rai <ar...@sap.com>
AuthorDate: Thu Aug 29 11:04:04 2019 +0530

    [OLINGO-1390] Service Resolution variable for spring apps
---
 .../java/org/apache/olingo/server/core/ODataHttpHandlerImpl.java     | 5 +++--
 .../java/org/apache/olingo/server/core/ODataHttpHandlerImplTest.java | 2 +-
 2 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/lib/server-core/src/main/java/org/apache/olingo/server/core/ODataHttpHandlerImpl.java b/lib/server-core/src/main/java/org/apache/olingo/server/core/ODataHttpHandlerImpl.java
index bbd94e5..7a632b1 100644
--- a/lib/server-core/src/main/java/org/apache/olingo/server/core/ODataHttpHandlerImpl.java
+++ b/lib/server-core/src/main/java/org/apache/olingo/server/core/ODataHttpHandlerImpl.java
@@ -267,11 +267,13 @@ public class ODataHttpHandlerImpl implements ODataHttpHandler {
   static void fillUriInformation(final ODataRequest odRequest, 
 		  final HttpServletRequest httpRequest, final int split) {
     String rawRequestUri = httpRequest.getRequestURL().toString();
-
+    
+    String rawServiceResolutionUri = null;
     String rawODataPath;
     //Application need to set the request mapping attribute if the request is coming from a spring based application
     if(httpRequest.getAttribute(REQUESTMAPPING)!=null){
       String requestMapping = httpRequest.getAttribute(REQUESTMAPPING).toString();
+      rawServiceResolutionUri = requestMapping;
       int beginIndex = rawRequestUri.indexOf(requestMapping) + requestMapping.length();
       rawODataPath = rawRequestUri.substring(beginIndex);
     }else if(!"".equals(httpRequest.getServletPath())) {
@@ -286,7 +288,6 @@ public class ODataHttpHandlerImpl implements ODataHttpHandler {
       rawODataPath = httpRequest.getRequestURI();
     }
 
-    String rawServiceResolutionUri = null;
     if (split > 0) {
       rawServiceResolutionUri = rawODataPath;
       for (int i = 0; i < split; i++) {
diff --git a/lib/server-core/src/test/java/org/apache/olingo/server/core/ODataHttpHandlerImplTest.java b/lib/server-core/src/test/java/org/apache/olingo/server/core/ODataHttpHandlerImplTest.java
index 0645423..158cae6 100644
--- a/lib/server-core/src/test/java/org/apache/olingo/server/core/ODataHttpHandlerImplTest.java
+++ b/lib/server-core/src/test/java/org/apache/olingo/server/core/ODataHttpHandlerImplTest.java
@@ -212,7 +212,7 @@ public class ODataHttpHandlerImplTest {
       String rawODataPath = p[4];
       String rawQueryPath = "".equals(p[5]) ? null : p[5];
       String rawRequestUri = requestUrl + (queryString == null ? "" : "?" + queryString);
-      String rawServiceResolutionUri = "".equals(p[3]) ? null : p[3];
+      String rawServiceResolutionUri = ("0".equals(p[6])) ? p[2] : p[3];
 
       when(hr.getAttribute("requestMapping")).thenReturn(p[2]);
       ODataHttpHandlerImpl.fillUriInformation(odr, hr, Integer.parseInt(p[6]));