Example usage for java.net URI toASCIIString

List of usage examples for java.net URI toASCIIString

Introduction

In this page you can find the example usage for java.net URI toASCIIString.

Prototype

public String toASCIIString() 

Source Link

Document

Returns the content of this URI as a US-ASCII string.

Usage

From source file:org.globus.security.stores.ResourceSecurityWrapperStore.java

private boolean loadResources(String locationPattern, Set<V> updatedList, Map<String, T> newWrapperMap)
        throws ResourceStoreException {
    boolean changed = false;
    try {/*ww w .  j  a  va2  s .co  m*/
        Resource[] resources = resolver.getResources(locationPattern);
        for (Resource resource : resources) {
            URI uri = resource.getURI();
            if (!resource.isReadable()) {
                getLogger().warning("Cannot read: " + uri.toASCIIString());
                continue;
            }
            changed = load(resource, updatedList, newWrapperMap);
        }
    } catch (IOException e) {
        throw new ResourceStoreException(e);
    }
    return changed;
}

From source file:ca.uhn.fhir.model.api.Tag.java

public Tag(URI theScheme, URI theTerm, String theLabel) {
    if (theScheme != null) {
        myScheme = theScheme.toASCIIString();
    }/* w w  w . j  av  a  2  s.  c o m*/
    if (theTerm != null) {
        myTerm = theTerm.toASCIIString();
    }
    myLabel = theLabel;
}

From source file:org.physical_web.physicalweb.PhysicalWebBroadcastService.java

private boolean checkAndHandleAsciiUrl(String url) {
    boolean isCompliant = false;
    try {/*  w w  w .  j  av a  2s .  co  m*/
        URI uri = new URI(url);
        String urlString = uri.toASCIIString();
        isCompliant = url.equals(urlString);
    } catch (URISyntaxException e) {
        Toast.makeText(this, getString(R.string.no_url_error), Toast.LENGTH_LONG).show();
    }
    return isCompliant;
}

From source file:com.artivisi.belajar.restful.ui.controller.ApplicationConfigController.java

@RequestMapping(value = "/config", method = RequestMethod.POST)
@ResponseStatus(HttpStatus.CREATED)// w  w w  . j  av a  2 s . c o  m
public void create(@RequestBody @Valid ApplicationConfig config, HttpServletRequest request,
        HttpServletResponse response) {
    belajarRestfulService.save(config);
    String requestUrl = request.getRequestURL().toString();
    URI uri = new UriTemplate("{requestUrl}/{id}").expand(requestUrl, config.getId());
    response.setHeader("Location", uri.toASCIIString());
}

From source file:org.globus.gsi.stores.ResourceSecurityWrapperStore.java

private boolean loadResources(String locationPattern, Set<V> updatedList, Map<String, T> newWrapperMap)
        throws ResourceStoreException {
    boolean changed = false;
    try {/*  ww w. j  a  va 2s .  co  m*/
        GlobusResource[] globusResources = globusResolver.getResources(locationPattern);
        for (GlobusResource globusResource : globusResources) {
            URI uri = globusResource.getURI();
            if (!globusResource.isReadable()) {
                getLog().warn("Cannot read: " + uri.toASCIIString());
                continue;
            }
            changed = load(globusResource, updatedList, newWrapperMap);
        }
    } catch (IOException e) {
        throw new ResourceStoreException(e);
    }
    return changed;
}

From source file:org.dspace.identifier.ezid.EZIDRequest.java

/**
 * Fetch the metadata bound to an identifier.
 *
 * @throws IdentifierException if the response is error or body malformed.
 * @throws IOException if the HTTP request fails.
 * @throws URISyntaxException//from www.  j  a v  a2  s  .  c om
 */
public EZIDResponse lookup(String name) throws IdentifierException, IOException, URISyntaxException {
    // GET path
    HttpGet request;
    URI uri = new URI(scheme, host, ID_PATH + authority + name, null);
    log.debug("EZID lookup {}", uri.toASCIIString());
    request = new HttpGet(uri);
    HttpResponse response = client.execute(request);
    return new EZIDResponse(response);
}

From source file:org.dspace.identifier.ezid.EZIDRequest.java

/**
 * Destroy a reserved identifier. Fails if ID was ever public.
 *//*from   w ww .j  a va2s  .c  o m*/
public EZIDResponse delete(String name) throws IOException, IdentifierException, URISyntaxException {
    // DELETE path
    HttpDelete request;
    URI uri = new URI(scheme, host, ID_PATH + authority + name, null);
    log.debug("EZID delete {}", uri.toASCIIString());
    request = new HttpDelete(uri);
    HttpResponse response = client.execute(request);
    return new EZIDResponse(response);
}

From source file:org.gatherdata.alert.dao.neo4j.internal.NeoAlertServiceDao.java

public boolean exists(URI uid) {
    Node foundNode = null;// www .  j av  a 2 s .  c o m
    if (uid != null) {
        try {
            foundNode = neo.indexService().getSingleNode(UniqueNodeWrapper.UID_PROPERTY, uid.toASCIIString());
        } catch (NotFoundException nfe) {
            ;
        } // not found means it doesn't exist
    }
    return (foundNode != null);
}

From source file:com.jaeksoft.searchlib.crawler.file.database.FileInfo.java

public FileInfo(FileInstanceAbstract fileInstance) throws SearchLibException {
    init();//  w  ww  .jav a2s  .co m
    setUriFileNameExtension(fileInstance.getURI());

    URI uri = fileInstance.getURI();
    setUri(uri.toASCIIString());

    setFileName(fileInstance.getFileName());
    setFileExtension(FilenameUtils.getExtension(fileName));

    setFileSystemDate(fileInstance.getLastModified());
    setFileSize(fileInstance.getFileSize());
    setFileType(fileInstance.getFileType());
}

From source file:org.dspace.identifier.ezid.EZIDRequest.java

/**
 * Ask EZID to create a unique identifier and return its name. NOTE: to
 * "reserve" a unique identifier, include "_status = reserved" in {@link metadata}.
 *
 * @param metadata ANVL-encoded key/value pairs.
 * @return/*from   w  w  w.  ja va  2 s.c  om*/
 */
public EZIDResponse mint(Map<String, String> metadata)
        throws IOException, IdentifierException, URISyntaxException {
    // POST path [+metadata]
    HttpPost request;
    URI uri = new URI(scheme, host, SHOULDER_PATH + authority, null);
    log.debug("EZID mint {}", uri.toASCIIString());
    request = new HttpPost(uri);
    if (null != metadata) {
        request.setEntity(new StringEntity(formatMetadata(metadata), UTF_8));
    }
    HttpResponse response = client.execute(request);
    EZIDResponse myResponse = new EZIDResponse(response);
    return myResponse;
}