[OLINGO-1390] Service Resolution variable for spring apps
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 @@
   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 @@
       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 @@
       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]));