Esempio n. 1
0
        } // ParseURL

        internal static String GetObjectUriFromRequestUri(String uri)
        {
            // We assume uri may be in one of the following forms
            //   http://myhost.com/myobject.rem
            //   /myobject.rem
            //   /myobject
            //   myobject.rem
            // In all cases, myobject is considered to be the object URI (.rem might be absent)

            int start, end; // range of characters to use
            int index;

            start = 0;
            end   = uri.Length;

            // first see if uri starts with http://
            // and remove up to next slash if it does
            start = StartsWithHttp(uri);
            if (start != -1)
            {
                // remove domain name as well
                index = uri.IndexOf('/', start);
                if (index != -1)
                {
                    start = index + 1;
                }
                else
                {
                    start = end; // uri will end up being ""
                }
            }
            else
            {
                // remove "/" if this is an absolute path
                start = 0;
                if (uri[start] == '/')
                {
                    start++;
                }
            }

            // remove query string if present ('?' and everything past it)
            index = uri.IndexOf('?');
            if (index != -1)
            {
                end = index;
            }

            if (start < end)
            {
                return(CoreChannel.RemoveApplicationNameFromUri(uri.Substring(start, end - start)));
            }
            else
            {
                return("");
            }
        } // GetObjectURIFromRequestURI
Esempio n. 2
0
        internal static string GetObjectUriFromRequestUri(string uri)
        {
            int index;
            int startIndex = 0;
            int length     = uri.Length;

            startIndex = StartsWithHttp(uri);
            if (startIndex != -1)
            {
                index = uri.IndexOf('/', startIndex);
                if (index != -1)
                {
                    startIndex = index + 1;
                }
                else
                {
                    startIndex = length;
                }
            }
            else
            {
                startIndex = 0;
                if (uri[startIndex] == '/')
                {
                    startIndex++;
                }
            }
            index = uri.IndexOf('?');
            if (index != -1)
            {
                length = index;
            }
            if (startIndex < length)
            {
                return(CoreChannel.RemoveApplicationNameFromUri(uri.Substring(startIndex, length - startIndex)));
            }
            return("");
        }