public ParsedURLData parseURL(ParsedURL baseURL, String urlStr) { SourceResolver resolver = (SourceResolver)localResolver.get(); if (resolver == null) { // Fall back to the previous default handler return defaultHandler == null ? null : defaultHandler.parseURL(baseURL, urlStr); } else { return new SourceParsedURLData(urlStr, resolver); } }
/** * Registers a Protocol handler by adding it to the handlers map. * If the given protocol handler returns <code>null</code> as it's * supported protocol then it is registered as the default * protocol handler. * @param handler the new Protocol Handler to register */ public static synchronized void registerHandler (ParsedURLProtocolHandler handler) { if (handler.getProtocolHandled() == null) { defaultHandler = handler; return; } Map handlers = getHandlersMap(); handlers.put(handler.getProtocolHandled(), handler); }
public ParsedURLData parseURL(String urlStr) { SourceResolver resolver = (SourceResolver)localResolver.get(); if (resolver == null) { return defaultHandler == null ? null : defaultHandler.parseURL(urlStr); } else { return new SourceParsedURLData(urlStr, resolver); } }
/** * Registers a Protocol handler by adding it to the handlers map. * If the given protocol handler returns <code>null</code> as it's * supported protocol then it is registered as the default * protocol handler. * @param handler the new Protocol Handler to register */ public static synchronized void registerHandler (ParsedURLProtocolHandler handler) { if (handler.getProtocolHandled() == null) { defaultHandler = handler; return; } Map handlers = getHandlersMap(); handlers.put(handler.getProtocolHandled(), handler); }
/** * Factory method to construct an appropriate subclass of ParsedURLData * @param urlStr the string to parse. */ public static ParsedURLData parseURL(String urlStr) { if (urlStr != null && !urlStr.contains(":") && !urlStr.startsWith("#")) { // an URL needs a protocol; default to file:// if none set urlStr = "file:" + urlStr; } ParsedURLProtocolHandler handler = getHandler(getProtocol(urlStr)); return handler.parseURL(urlStr); }
/** * Registers a Protocol handler by adding it to the handlers map. * If the given protocol handler returns <code>null</code> as it's * supported protocol then it is registered as the default * protocol handler. * @param handler the new Protocol Handler to register */ public static synchronized void registerHandler (ParsedURLProtocolHandler handler) { if (handler.getProtocolHandled() == null) { defaultHandler = handler; return; } Map handlers = getHandlersMap(); handlers.put(handler.getProtocolHandled(), handler); }
/** * Factory method to construct an appropriate subclass of ParsedURLData * @param urlStr the string to parse. */ public static ParsedURLData parseURL(String urlStr) { if (urlStr != null && !urlStr.contains(":") && !urlStr.startsWith("#")) { // an URL needs a protocol; default to file:// if none set urlStr = "file:" + urlStr; } ParsedURLProtocolHandler handler = getHandler(getProtocol(urlStr)); return handler.parseURL(urlStr); }
/** * Factory method to construct an appropriate subclass of ParsedURLData * @param urlStr the string to parse. */ public static ParsedURLData parseURL(String urlStr) { if (urlStr != null && !urlStr.contains(":") && !urlStr.startsWith("#")) { // an URL needs a protocol; default to file:// if none set urlStr = "file:" + urlStr; } ParsedURLProtocolHandler handler = getHandler(getProtocol(urlStr)); return handler.parseURL(urlStr); }
/** * Factory method to construct an appropriate subclass of ParsedURLData, * for a sub url. * @param baseURL The base ParsedURL to parse. * @param urlStr the sub URL string to parse. */ public static ParsedURLData parseURL(ParsedURL baseURL, String urlStr) { if (baseURL == null) return parseURL(urlStr); String protocol = getProtocol(urlStr); if (protocol == null) protocol = baseURL.getProtocol(); ParsedURLProtocolHandler handler = getHandler(protocol); return handler.parseURL(baseURL, urlStr); } }
/** * Factory method to construct an appropriate subclass of ParsedURLData, * for a sub url. * @param baseURL The base ParsedURL to parse. * @param urlStr the sub URL string to parse. */ public static ParsedURLData parseURL(ParsedURL baseURL, String urlStr) { if (baseURL == null) return parseURL(urlStr); String protocol = getProtocol(urlStr); if (protocol == null) protocol = baseURL.getProtocol(); ParsedURLProtocolHandler handler = getHandler(protocol); return handler.parseURL(baseURL, urlStr); } }
/** * Factory method to construct an appropriate subclass of ParsedURLData, * for a sub url. * @param baseURL The base ParsedURL to parse. * @param urlStr the sub URL string to parse. */ public static ParsedURLData parseURL(ParsedURL baseURL, String urlStr) { if (baseURL == null) return parseURL(urlStr); String protocol = getProtocol(urlStr); if (protocol == null) protocol = baseURL.getProtocol(); ParsedURLProtocolHandler handler = getHandler(protocol); return handler.parseURL(baseURL, urlStr); } }