Java HTTP Port Find getImportedXmlSchemaPath(String namespace, String portType, String operation)

Here you can find the source of getImportedXmlSchemaPath(String namespace, String portType, String operation)

Description

get Imported Xml Schema Path

License

Apache License

Declaration

public static String getImportedXmlSchemaPath(String namespace, String portType, String operation)
            throws URISyntaxException 

Method Source Code


//package com.java2s;
//License from project: Apache License 

import java.net.URI;
import java.net.URISyntaxException;
import java.util.regex.Pattern;

public class Main {
    private static final Pattern PATTERN_PUNCT_EXCEPT_SLASH = Pattern.compile("(?![/])\\p{Punct}");

    public static String getImportedXmlSchemaPath(String namespace, String portType, String operation)
            throws URISyntaxException {
        if (namespace == null || portType == null || operation == null) {
            throw new URISyntaxException(namespace + " " + portType + " " + operation,
                    "The arguments can't be empty, please check");
        }//from  w w w. ja  va2 s. c  o  m
        StringBuilder builder = new StringBuilder(replaceAllLimited(new URI(namespace).getRawSchemeSpecificPart()));
        if (builder.length() > 0) {
            while (builder.charAt(0) == '/') {
                builder.deleteCharAt(0);
            }
            if (builder.charAt(builder.length() - 1) != '/') {
                builder.append('/');
            }
        }
        builder.append(portType).append('/').append(operation);
        return builder.toString();
    }

    public static String replaceAllLimited(String input) {
        if (input == null) {
            return input;
        }
        return PATTERN_PUNCT_EXCEPT_SLASH.matcher(input).replaceAll("-");
    }
}

Related

  1. getFreePort(int port)
  2. getFreePort(int pPort)
  3. getFreePortNoSych()
  4. getFreePortNumber(int defaultPortNumber)
  5. getFreeServerPort(int port)
  6. getNextAvailable(int port)
  7. getNextAvailablePort()
  8. getNextAvailablePort(final int min, final int max, final Collection excepted)
  9. getNextAvailablePort(int port)