Package ariba.util.core

Examples of ariba.util.core.StringArray


            // this is a full URL, we need to remove the beginning portion up to the third / character
            int firstSecondSlash = servletUrlPrefix.indexOf("//");
            servletUrlPrefix = servletUrlPrefix.substring(servletUrlPrefix.indexOf("/", firstSecondSlash + 2) + 1);
        }
        if ("".equals(servletUrlPrefix)) return 0;
        StringArray pathComponents = AWUtil.componentsSeparatedByString(servletUrlPrefix, "/");
        // subtract one here to account for preceeding slash.
        int servletUrlPrefixComponentCount = pathComponents.inUse();
        if (servletUrlPrefix.startsWith("/")) {
            servletUrlPrefixComponentCount--;
        }
        if (servletUrlPrefix.endsWith("/")) {
            servletUrlPrefixComponentCount--;
View Full Code Here


        //String requestHandlerPath = _servletRequest.getPathInfo();
        String requestHandlerPath = urlString;
        if (requestHandlerPath != null) {
            int requestHandlerPathLength = requestHandlerPath.length();
            if (requestHandlerPathLength > 0) {
                StringArray pathComponents = AWUtil.componentsSeparatedByString(requestHandlerPath, "/");
                // Note: first entry is always empty string since requestHandlerPath starts with "/".
                int pathComponentCount = pathComponents.inUse();
                int servletUrlPrefixComponentCount = ((AWServletApplication)AWConcreteApplication.SharedInstance).servletUrlPrefixComponentCount();
                int currentFieldIndex = servletUrlPrefixComponentCount + 1;
                if (requestHandlerPath.startsWith("/")) {
                    currentFieldIndex ++;
                }
                // aling: I don't not fully understand why for catalog login URL currentFieldIndex
                // could equal to array lenth, for buyer logic url it equals length - 1, which is correct

                if (pathComponentCount > currentFieldIndex) {
                    String[] pathComponentsArray = pathComponents.array();
                    String firstField = pathComponentsArray[currentFieldIndex];
                    // Note: when user types trailing "/" in their URL,
                    // say http://y:8001/Ariba/Buyer/, here we got "", so this if branch
                    // is to solve the trailing "/" problem
                    // Defect 81707 and 79077
View Full Code Here

        return bareTemplate.replace('/', '.');
    }

    private String initComponentNamePath (String componentName)
    {
        StringArray components = AWUtil.componentsSeparatedByString(componentName, ".");
        return AWUtil.componentsJoinedByString(components, File.separator);
    }
View Full Code Here

    private int _totalLength;

    public AWFastStringBuffer ()
    {
        super();
        _stringArray = new StringArray();
        _stringArray.makeRoomFor(128);
    }
View Full Code Here

    }

    public AWFastStringBuffer (int initialCapacity)
    {
        super();
        _stringArray = new StringArray();
        _stringArray.makeRoomFor(initialCapacity);
    }
View Full Code Here

        AWResource resource = _application.resourceManager().resourceNamed("AWStandardTagNames.txt");
        if (resource != null) {
            InputStream inputStream = resource.inputStream();
            String standardTagNamesString = AWUtil.stringWithContentsOfInputStream(inputStream);
            AWUtil.close(inputStream);
            StringArray standardTagNames = AWUtil.componentsSeparatedByString(standardTagNamesString, ",");
            String[] standardTagNamesArray = standardTagNames.array();
            for (int index = (standardTagNames.inUse() - 1); index >= 0; index--) {
                String currentTagName = standardTagNamesArray[index];
                currentTagName = currentTagName.trim();
                registerStandardTagName(currentTagName);
            }
        }
View Full Code Here

    public static String[] parseComponentsString (String receiver, String separator)
    {
        // uses componentsSeparatedByString but returns a Java array sized to the
        // actual length of elements with each element trimmed of whitespace.
        StringArray stringArray = componentsSeparatedByString(receiver, separator);
        // size the StringArray to # of contained elements
        stringArray.trim();
        String[] strings = stringArray.array();
        for (int index = strings.length - 1; index < -1; index--) {
            String alternate = strings[index];
            strings[index] = alternate.trim();
        }
        return strings;
View Full Code Here

        return strings;
    }

    public static StringArray componentsSeparatedByString (String receiver, String separator)
    {
        StringArray components = new StringArray();
        int receiverLength = receiver.length();
        int separatorLength = separator.length();
        int currentIndex = 0;
        while (currentIndex < receiverLength) {
            int separatorIndex = receiver.indexOf(separator, currentIndex);
            if (separatorIndex == -1) {
                separatorIndex = receiverLength;
            }
            String substring = receiver.substring(currentIndex, separatorIndex);
            components.add(substring);
            currentIndex = separatorIndex + separatorLength;
        }
        if (currentIndex == receiverLength) {
            components.add("");
        }
        return components;
    }
View Full Code Here

    public static String replaceAllOccurrences (String originalString, String stringToReplace, String replacementString)
    {
        String finalString = originalString;
        if (AWUtil.contains(originalString, stringToReplace)) {
            StringArray stringComponents = componentsSeparatedByString(originalString, stringToReplace);
            finalString = componentsJoinedByString(stringComponents, replacementString);
        }
        return finalString;
    }
View Full Code Here

    // Cookie Support

    protected static Map parseCookieHeader (String cookieHeaderString)
    {
        Map cookieValues = MapUtil.map();
        StringArray pairs = AWUtil.componentsSeparatedByString(cookieHeaderString, ";");
        String[] pairsArray = pairs.array();
        for (int pairIndex = (pairs.inUse() - 1); pairIndex > -1; pairIndex--) {
            String pair = pairsArray[pairIndex];
            pair = pair.trim();
            StringArray keyAndValue = AWUtil.componentsSeparatedByString(pair, "=");
            if (keyAndValue.inUse() != 2) {
                continue;
            }
            String[] keyAndValueArray = keyAndValue.array();
            String key = keyAndValueArray[0];
            String value = keyAndValueArray[1];
            Object existingValues = cookieValues.get(key);
            if (existingValues == null) {
                cookieValues.put(key, value);
View Full Code Here

TOP

Related Classes of ariba.util.core.StringArray

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.