Get a handle to a service

@param url
@param tc
context to use
@return a DCERPC handle for the given url
@throws MalformedURLException
@throws DcerpcException
543243
public static DcerpcHandle getHandle ( String url, CIFSContext tc ) throws MalformedURLException, DcerpcException {
        return getHandle(url, tc, false);
    }
1234758
public static RemoteFileSystem create(String url) throws MalformedURLException, FileSystemException {
        // parse url into a URL object
        URL r = URLParser.parse(url);
        // delegate responsibility to other method
        return create(r);
    }
1334014
private InputStream getInputStream(String url) throws Exception {
        HttpGet getMethod = new HttpGet(url);
        DefaultHttpClient client = new DefaultHttpClient(m_cManager);
        client.getParams().setIntParameter(CoreConnectionPNames.CONNECTION_TIMEOUT, TIMEOUT_SECONDS * 1000);
        UsernamePasswordCredentials creds = getCreds(url);
        if (creds != null) {
            client.getCredentialsProvider().setCredentials(AuthScope.ANY, creds);
            client.addRequestInterceptor(new PreemptiveAuth());
        }
        client.getParams().setBooleanParameter(ClientPNames.HANDLE_REDIRECTS, true);
        HttpInputStream in = new HttpInputStream(client, getMethod);
        if (in.getStatusCode() != 200) {
            try {
                in.close();
            } catch (Exception e) {
            }
            throw new IOException("HTTP request failed.  Got status code "
                    + in.getStatusCode()
                    + " from remote server while attempting to GET " + url);
        } else {
            return in;
        }
    }
584488
@Deprecated
    public static Bundle parseUrl(String url) {
        // hack to prevent MalformedURLException
        url = url.replace("fbconnect", "http");
        try {
            URL u = new URL(url);
            Bundle b = decodeUrl(u.getQuery());
            b.putAll(decodeUrl(u.getRef()));
            return b;
        } catch (MalformedURLException e) {
            return new Bundle();
        }
    }
1031680
@SuppressWarnings("unchecked")
    private T getService(boolean throwException) {
        T svc = null;
        ReferenceTuple<T> current = null;
        ReferenceTuple<T> newTuple = null;

        do {
            // Get the current tuple
            current = tuple.get();

            // We have both a context and a service reference.. 
            svc = current.locatedService;
            if (svc != null) {
                break; // break out. We know the answer, yes
            }

            // If we're missing the required bits, bail... 
            if (current.context == null || current.serviceRef == null) {
                if (throwException)
                    throw new IllegalStateException("Required attribute is null," + toString());
                break; // break out. Nothing more to do here
            }

            // We have to locate / resolve the service from the reference 
            SecurityManager sm = System.getSecurityManager();
            if (sm != null) {
                final ReferenceTuple<T> finalCurrent = current;
                svc = AccessController.doPrivileged(new PrivilegedAction<T>() {

                    @Override
                    public T run() {
                        return finalCurrent.context.locateService(referenceName, finalCurrent.serviceRef);
                    }
                });
            } else {
                svc = current.context.locateService(referenceName, current.serviceRef);
            }

            // if we're asked to throw, throw if we couldn't find the service
            if (svc == null) {
                if (throwException)
                    throw new IllegalStateException("Located service is null," + toString());

                break; // break out. Nothing more to do here
            }

            // Create a new tuple: keep the context and reference, set the cached service 
            newTuple = new ReferenceTuple<T>(current.context, current.serviceRef, svc);

            // Try to save the new tuple: retry if someone changed the value meanwhile
        } while (!tuple.compareAndSet(current, newTuple));

        return svc;
    }
928525
public static Element getContentElementByUrl(String url) throws Exception {
//        HttpRequest request = new HttpRequest(url);
        String html = okHttpRequester.getResponse(url).html();
        return getContentElementByHtml(html, url);
    }
12680
public static Cursor fromUrlSafe(String urlSafe) {
    try {
      return Cursor.copyFrom(BaseEncoding.base64Url().decode(urlSafe));
    } catch (IllegalArgumentException e) {
      throw new IllegalStateException("Unexpected decoding exception", e);
    }
  }
243193
public static sslcrl_binding get(nitro_service service, String crlname) throws Exception{
		sslcrl_binding obj = new sslcrl_binding();
		obj.set_crlname(crlname);
		sslcrl_binding response = (sslcrl_binding) obj.get_resource(service);
		return response;
	}
675535
public URL getUrl() throws MalformedURLException {
        if (this.url == null) {
            Handler handler = new Handler(this);
            String file = this.rootFile.getFile().toURI() + this.pathFromRoot + "!/";
            file = file.replace("file:////", "file://"); // Fix UNC paths
            this.url = new URL("jar", "", -1, file, handler);
        }
        return this.url;
    }
1057819
@Override
    public StringBuffer getRequestURL() {
        // strip off any session id from the url here
        String rc = SessionInfo.stripURL(this.request.getURL(),
                                         this.sessionData);
        if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
            Tr.debug(tc, "getRequestURL: " + rc);
        }
        return new StringBuffer(rc);
    }
504766
private static URL toURL(String url, int port) throws MalformedURLException {
	URL u = HTTPUtil.toURL(url, true);
	if (port == -1) return u;
	return new URL(u.getProtocol(), u.getHost(), port, u.getFile());
    }
459489
@Trivial
    public static URL createWSJPAURL(URL url) throws MalformedURLException {
        if (url == null) {
            return null;
        }

        // Encode the URL to be embedded into the wsjpa URL's path
        final String encodedURLPathStr = encode(url.toExternalForm());

        URL returnURL;
        try {
            returnURL = AccessController.doPrivileged(new PrivilegedExceptionAction<URL>() {
                @Override
                @Trivial
                public URL run() throws MalformedURLException {
                    return new URL(WSJPA_PROTOCOL_NAME + ":" + encodedURLPathStr);
                }
            });
        } catch (PrivilegedActionException e) {
            throw (MalformedURLException) e.getException();
        }

        return returnURL;
    }
328023
def url_to_resource(url, request=None):
    
    if request is None:
        request = get_current_request()
#    cnv = request.registry.getAdapter(request, IResourceUrlConverter)
    reg = get_current_registry()
    cnv = reg.getAdapter(request, IResourceUrlConverter)
    return cnv.url_to_resource(url)
280409
public String getProxyURLString(HttpServletRequest req) throws MalformedURLException
    {
    	String proxyUrlString = proxyURLPrefix;
    	if (req.getPathInfo() != null)
    		if (req.getPathInfo().length() > 0)
    			proxyUrlString += req.getPathInfo();
    	if (req.getQueryString() != null)
    		if (req.getQueryString().length() > 0)
    			proxyUrlString += "?" + req.getQueryString();
    	req.getContentType();
    	return proxyUrlString;
    }
988294
public String get(Context context, String url) {
        final Cursor cursor = context.getContentResolver().query(getUri(OfflinerDBHelper.TABLE_CACHE),
                OfflinerDBHelper.PARAMS_CACHE, OfflinerDBHelper.REQUEST_URL
                        + " = '" + url + "'", null, null);
        String result = null;

        if (cursor != null) {
            if (cursor.getCount() != 0) {
                cursor.moveToFirst();
                result = cursor.getString(cursor.getColumnIndex(OfflinerDBHelper.REQUEST_RESULT));
            }
            cursor.close();
        }

        return result;
    }
737033
private URL createURL(final String urlString) throws MalformedURLException {

        URL url;
        try {
            url = AccessController.doPrivileged(new PrivilegedExceptionAction<URL>() {

                @Override
                public URL run() throws MalformedURLException {
                    return new URL(urlString);
                }
            });
        } catch (PrivilegedActionException e) {
            throw (MalformedURLException) e.getCause();
        }

        return url;
    }
632357
protected URL buildURL(Map<String,String> headers, String instanceHostPort) throws MalformedURLException {
        String origUrl = headers.get(Listener.METAINFO_REQUEST_URL);
        if (origUrl == null || !origUrl.startsWith("http")) {
            // other protocol: forward to standard services url
            return new URL("http://" + instanceHostPort + "/" + getServicesRoot() + "/Services");
        }
        else {
            URL origHttpUrl = new URL(origUrl);
            String path = origHttpUrl.getPath();
            // Re-route from SOAP to REST since MDW only cares about message Payload, plus we no longer have the SOAP Envelope in the request
            if (path != null && (path.contains("/SOAP") || path.contains("/MDWWebService")))
                path = "/" + getServicesRoot() + "/Services";

            String destUrl = origHttpUrl.getProtocol() + "://" + instanceHostPort + path;
            if (!StringHelper.isEmpty(headers.get(Listener.METAINFO_REQUEST_QUERY_STRING)))
                destUrl += "?" + headers.get(Listener.METAINFO_REQUEST_QUERY_STRING);
            return new URL(destUrl);
        }
    }