@Override public String createURI(String location) { return URIUtils.modifyURIScheme(location, newScheme); } }
/** * Method modifying uri port * @param newPort * @return - modified uri */ public String modifyURIPort(int newPort) { return buildURIFromTokens(scheme, host, newPort, path, query, fragment); }
public NetworkInterfaceURI(String uri) throws IllegalArgumentException { parser = new Parser(uri); parser.parse(); }
private String createResolvePath(String httpUri, final String suffixWithLeadingSlash) { return URIUtils.getPath(appendURI(ensureTrailingSlash(httpUri),suffixWithLeadingSlash)); }
/** * Helper method for performing resolve as String * @param uriInitial * @param uriString * @return */ public static String resolve(String uriInitial, String uriString) { try { return uriToString((new URI(uriInitial)).resolve(uriString)); } catch (URISyntaxException e) { try { return (new NetworkInterfaceURI(uriInitial)).resolve(uriString); } catch (IllegalArgumentException ne) { throw new IllegalArgumentException(ne.getMessage(), ne); } } }
/** * Helper method for modifying URI scheme * @param uri * @param newScheme * @return */ public static String modifyURIScheme(String uri, String newScheme) { try { URI uriObj = new URI(uri); return uriToString(URLUtils.modifyURIScheme(uriObj, newScheme)); } catch (URISyntaxException e) { try { return (new NetworkInterfaceURI(uri)).modifyURIScheme(newScheme); } catch (IllegalArgumentException ne) { throw new IllegalArgumentException(ne.getMessage(), ne); } } }
protected ResourceAddress(ResourceAddressFactorySpi factory, URI resourceURI) { this(factory, URIUtils.uriToString(resourceURI), resourceURI); }
@Override public String createURI(String location) { return format("%s://%s", newScheme, URIUtils.getAuthority(location)); } }
static String getTransportURI(String transportKey, String transport) { String transportURI = null; if (transport != null) { transportURI = transport; if (!URIUtils.isAbsolute(transportURI)) { throw new IllegalArgumentException(format( "%s must contain an absolute URI, not \"%s\"", transportKey, transport)); } transportURI = getCanonicalizedURI(transportURI, false); } return transportURI; }
/** * Create a canonical URI from a given URI. A canonical URI is a URI with:<ul> <li>the host part of the authority * lower-case since URI semantics dictate that hostnames are case insensitive <li>(optionally, NOT appropriate for Origin * headers) the path part set to "/" if there was no path in the input URI (this conforms to the WebSocket and HTTP protocol * specifications and avoids us having to do special handling for path throughout the server code). </ul> * * @param uriString the URI to canonicalize, in string form * @param canonicalizePath if true, append trailing '/' when missing * @return a URI with the host part of the authority lower-case and (optionally) trailing / added, or null if the uri is null * @throws IllegalArgumentException if the uriString is not valid syntax */ public static String getCanonicalURI(String uriString, boolean canonicalizePath) { if ((uriString != null) && !"".equals(uriString)) { return getCanonicalizedURI(uriString, canonicalizePath); } return null; }
public static boolean isAbsolute(String uri) { try { return (new URI(uri)).isAbsolute(); } catch (URISyntaxException e) { try { return (new NetworkInterfaceURI(uri)).isAbsolute(); } catch (IllegalArgumentException ne) { throw new IllegalArgumentException(ne.getMessage(), ne); } } }
/** * Helper method for building URI as String * @param scheme * @param authority * @param path * @param query * @param fragment * @return * @throws URISyntaxException */ public static String buildURIAsString(String scheme, String authority, String path, String query, String fragment) throws URISyntaxException { URI helperURI; try { helperURI = new URI(scheme, authority, path, query, fragment); } catch (URISyntaxException e) { return NetworkInterfaceURI.buildURIToString(scheme, authority, path, query, fragment); } return helperURI.toString(); }
/** * Create a descriptive string for the type of connection that this session has been created on. This is generally just used * in the Command Center. The following is the same as the insides of ResourceAddress.getProtocol(), which is private. NOTE: * we're using BridgeSession.LOCAL_ADDRESS.get(session) to retrieve the address to send to management. */ public static String getSessionTypeName(ResourceAddress address) { String externalURI = address.getExternalURI(); return URIUtils.getScheme(externalURI); }
private String resolve(String uriString) { return uriToString(mockNetworkInterfaceURI.resolve(uriString)).replace(HOST_TEMPLATE, matchedToken); }
/** * Method modifying UrI authority * @param newAuthority * @return - modified uri */ public String modifyURIAuthority(String newAuthority) { return buildURIFromTokens(scheme, newAuthority, path, query, fragment); }
/** * Helper method for building URI as String * @param scheme * @param userInfo * @param host * @param port * @param path * @param query * @param fragment * @return * @throws URISyntaxException */ public static String buildURIAsString(String scheme, String userInfo, String host, int port, String path, String query, String fragment) throws URISyntaxException { URI helperURI; try { helperURI = new URI(scheme, userInfo, host, port, path, query, fragment); } catch (URISyntaxException e) { return NetworkInterfaceURI.buildURIToString(scheme, userInfo, host, port, path, query, fragment); } return helperURI.toString(); }
public ResourceAddress newResourceAddress(String location, Map<String, Object> options) { ResourceAddressFactorySpi<?> resourceAddressFactory = findResourceAddressFactory(getScheme(location)); return resourceAddressFactory.newResourceAddress(location, options, ResourceOptions.FACTORY); }
/** * Method modifying URI scheme * @param newScheme * @return - modified uri */ public String modifyURIScheme(String newScheme) { return buildURIFromTokens(newScheme, host, port, path, query, fragment); }
/** * Method modifying uri path * @param newPath * @return - modified uri */ public String modifyURIPath(String newPath) { return buildURIFromTokens(scheme, host, port, newPath, query, fragment); }