當前位置: 首頁>>代碼示例>>Java>>正文


Java URI.create方法代碼示例

本文整理匯總了Java中java.net.URI.create方法的典型用法代碼示例。如果您正苦於以下問題:Java URI.create方法的具體用法?Java URI.create怎麽用?Java URI.create使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在java.net.URI的用法示例。


在下文中一共展示了URI.create方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: updateControllerConnections

import java.net.URI; //導入方法依賴的package包/類
@Override
public void updateControllerConnections(OFBsnControllerConnectionsReply controllerCxnsReply) {

	// Instantiate clean map, can't use a builder here since we need to call temp.get()
	Map<URI,Map<OFAuxId, OFBsnControllerConnection>> temp = new ConcurrentHashMap<URI,Map<OFAuxId, OFBsnControllerConnection>>();

	List<OFBsnControllerConnection> controllerCxnUpdates = controllerCxnsReply.getConnections();
	for(OFBsnControllerConnection update : controllerCxnUpdates) {
		URI uri = URI.create(update.getUri());

		Map<OFAuxId, OFBsnControllerConnection> cxns = temp.get(uri);

		// Add to nested map
		if(cxns != null){
			cxns.put(update.getAuxiliaryId(), update);
		} else{
			cxns = new ConcurrentHashMap<OFAuxId, OFBsnControllerConnection>();
			cxns.put(update.getAuxiliaryId(), update);
			temp.put(uri, cxns);
		}
	}

	this.controllerConnections = ImmutableMap.<URI,Map<OFAuxId, OFBsnControllerConnection>>copyOf(temp);
}
 
開發者ID:xuraylei,項目名稱:fresco_floodlight,代碼行數:25,代碼來源:OFSwitch.java

示例2: build

import java.net.URI; //導入方法依賴的package包/類
public MetadataDocumentMessage build() {
    // todo - here, we make link with DUMMY_BASE_URI and then take it out again so clients can fill in domain - must be a better way of doing this!
    RepositoryLinkBuilder rlb = new RepositoryLinkBuilder(mappings.getMetadataFor(documentType),
                                                          new BaseUri(URI.create(DUMMY_BASE_URI)));
    Link link = rlb
            .slash(metadataDocId)
            .withRel(mappings.getMetadataFor(documentType).getItemResourceRel());
    String callbackLink = link.withSelfRel().getHref().replace(DUMMY_BASE_URI, "");

    return new MetadataDocumentMessage(documentType.getSimpleName().toLowerCase(), metadataDocId, metadataDocUuid, callbackLink);
}
 
開發者ID:HumanCellAtlas,項目名稱:ingest-core,代碼行數:12,代碼來源:MetadataDocumentMessageBuilder.java

示例3: BinaryJedis

import java.net.URI; //導入方法依賴的package包/類
public BinaryJedis(final String host) {
	URI uri = URI.create(host);
	if (uri.getScheme() != null && uri.getScheme().equals("redis")) {
		initializeClientFromURI(uri);
	} else {
		client = new Client(host);
	}
}
 
開發者ID:qq1588518,項目名稱:JRediClients,代碼行數:9,代碼來源:BinaryJedis.java

示例4: search

import java.net.URI; //導入方法依賴的package包/類
@RequestMapping(path = "/search", method = RequestMethod.POST)
public String search(HttpServletRequest request, @RequestParam("access_token") String accessToken) throws IOException {
    UserDirectorySearchRequest searchQuery = parser.parse(request, UserDirectorySearchRequest.class);
    URI target = URI.create(request.getRequestURL().toString());
    UserDirectorySearchResult result = mgr.search(target, accessToken, searchQuery.getSearchTerm());
    return gson.toJson(result);
}
 
開發者ID:kamax-io,項目名稱:mxisd,代碼行數:8,代碼來源:UserDirectoryController.java

示例5: testGetRequest

import java.net.URI; //導入方法依賴的package包/類
@Test(expected = UnsupportedOperationException.class)
public void testGetRequest() throws IOException {
    final MockHttpServletRequest mockRequest = new MockHttpServletRequest("GET", URI.create("/"));
    try (final MinijaxRequestContext context = new MinijaxRequestContext(null, mockRequest, null)) {
        context.getRequest();
    }
}
 
開發者ID:minijax,項目名稱:minijax,代碼行數:8,代碼來源:ServletRequestContextTest.java

示例6: test2

import java.net.URI; //導入方法依賴的package包/類
public void test2() {
    Context context = new Context();
    DiagnosticCollector<JavaFileObject> diagnostics = new DiagnosticCollector<>();
    context.put(DiagnosticListener.class, diagnostics);
    Options.instance(context).put("allowStringFolding", "false");
    JCTree.JCCompilationUnit unit;
    JavacFileManager fileManager = new JavacFileManager(context, true, UTF_8);
    try {
        fileManager.setLocation(StandardLocation.PLATFORM_CLASS_PATH, ImmutableList.<File>of());
    } catch (IOException e) {
        // impossible
        throw new IOError(e);
    }
    SimpleJavaFileObject source =
            new SimpleJavaFileObject(URI.create("source"), JavaFileObject.Kind.SOURCE) {
                @Override
                public CharSequence getCharContent(boolean ignoreEncodingErrors) throws IOException {
                    return src;
                }
            };
    Log.instance(context).useSource(source);
    ParserFactory parserFactory = ParserFactory.instance(context);
    Parser parser =
            parserFactory.newParser(
                    src,
        /*keepDocComments=*/ true,
        /*keepEndPos=*/ true,
        /*keepLineMap=*/ true);
    unit = parser.parseCompilationUnit();
    unit.sourcefile = source;
}
 
開發者ID:tranleduy2000,項目名稱:javaide,代碼行數:32,代碼來源:TestJavacParser.java

示例7: testHsftpCustomUriPortWithDefaultPorts

import java.net.URI; //導入方法依賴的package包/類
@Test
public void testHsftpCustomUriPortWithDefaultPorts() throws IOException {
  Configuration conf = new Configuration();
  URI uri = URI.create("hsftp://localhost:123");
  HsftpFileSystem fs = (HsftpFileSystem) FileSystem.get(uri, conf);

  assertEquals(DFSConfigKeys.DFS_NAMENODE_HTTPS_PORT_DEFAULT,
      fs.getDefaultPort());

  assertEquals(uri, fs.getUri());
  assertEquals("127.0.0.1:123", fs.getCanonicalServiceName());
}
 
開發者ID:naver,項目名稱:hadoop,代碼行數:13,代碼來源:TestHftpFileSystem.java

示例8: _getSpecURI

import java.net.URI; //導入方法依賴的package包/類
private URI _getSpecURI(String spec) {
    URI specURI = URI.create(spec);

    if (_scheme.indexOf(':') == -1) {
        return specURI;
    }
    
    String schemeSpecificPart = specURI.getSchemeSpecificPart();
    return URI.create(schemeSpecificPart);
}
 
開發者ID:Datatellit,項目名稱:xlight_android_native,代碼行數:11,代碼來源:WsURLStreamHandlerImpl.java

示例9: sendUnsignedJsonAuthnResponseFromHub_shouldRespondWithNextLocation

import java.net.URI; //導入方法依賴的package包/類
@Test
public void sendUnsignedJsonAuthnResponseFromHub_shouldRespondWithNextLocation() throws Exception {
    SessionId sessionId = SessionId.createNewSessionId();
    URI nextLocationUri = URI.create("http://blah");
    String requestId = UUID.randomUUID().toString();

    Function<OutboundResponseFromHub, String> outboundResponseFromHubToStringTransformer =
            new HubTransformersFactory().getOutboundResponseFromHubToStringTransformer(
                    new HardCodedKeyStore(HUB_ENTITY_ID),
                    getKeyStore(),
                    new IdpHardCodedEntityToEncryptForLocator(),
                    SIGNATURE_ALGORITHM,
                    DIGEST_ALGORITHM);
    OutboundResponseFromHub authnResponseFromHub = anAuthnResponse()
            .withInResponseTo(requestId)
            .withIssuerId(HUB_ENTITY_ID)
            .withTransactionIdaStatus(TransactionIdaStatus.Success)
            .buildOutboundResponseFromHub();
    String samlString = outboundResponseFromHubToStringTransformer.apply(authnResponseFromHub);

    AuthnResponseFromHubContainerDto authnResponseFromHubContainerDto = new AuthnResponseFromHubContainerDto(
            samlString,
            nextLocationUri,
            com.google.common.base.Optional.absent(),
            authnResponseFromHub.getId());

    policyStubRule.anAuthnResponseFromHubToRp(sessionId, authnResponseFromHubContainerDto);

    javax.ws.rs.core.Response response = getResponseFromSamlProxy(Urls.SamlProxyUrls.SEND_RESPONSE_FROM_HUB_API_RESOURCE, sessionId);
    assertThat(response.readEntity(SamlMessageSenderHandler.SamlMessage.class).getPostEndpoint()).isEqualTo(nextLocationUri.toASCIIString());
}
 
開發者ID:alphagov,項目名稱:verify-hub,代碼行數:32,代碼來源:SamlMessageSenderApiResourceTest.java

示例10: testMiniClusterStore

import java.net.URI; //導入方法依賴的package包/類
@Test
public void testMiniClusterStore() throws EventDeliveryException, IOException {
  // setup a minicluster
  MiniDFSCluster cluster = new MiniDFSCluster
      .Builder(new Configuration())
      .build();

  FileSystem dfs = cluster.getFileSystem();
  Configuration conf = dfs.getConf();

  URI hdfsUri = URI.create(
      "dataset:" + conf.get("fs.defaultFS") + "/tmp/repo" + DATASET_NAME);
  try {
    // create a repository and dataset in HDFS
    Datasets.create(hdfsUri, DESCRIPTOR);

    // update the config to use the HDFS repository
    config.put(DatasetSinkConstants.CONFIG_KITE_DATASET_URI, hdfsUri.toString());

    DatasetSink sink = sink(in, config);

    // run the sink
    sink.start();
    sink.process();
    sink.stop();

    Assert.assertEquals(
        Sets.newHashSet(expected),
        read(Datasets.load(hdfsUri)));
    Assert.assertEquals("Should have committed", 0, remaining(in));

  } finally {
    if (Datasets.exists(hdfsUri)) {
      Datasets.delete(hdfsUri);
    }
    cluster.shutdown();
  }
}
 
開發者ID:moueimei,項目名稱:flume-release-1.7.0,代碼行數:39,代碼來源:TestDatasetSink.java

示例11: toMvnRepositoryURI

import java.net.URI; //導入方法依賴的package包/類
URI toMvnRepositoryURI() {
  var base = "https://mvnrepository.com/artifact/";
  return URI.create(base + String.join("/", group, artifact));
}
 
開發者ID:jodastephen,項目名稱:jpms-module-names,代碼行數:5,代碼來源:Generator.java

示例12: browseMeta

import java.net.URI; //導入方法依賴的package包/類
@Override
public DIDLObject browseMeta(YaaccContentDirectory contentDirectory,
                             String myId) {
    Item result = null;
    String[] projection = {MediaStore.Audio.Media._ID,
            MediaStore.Audio.Media.DISPLAY_NAME,
            MediaStore.Audio.Media.MIME_TYPE, MediaStore.Audio.Media.SIZE,
            MediaStore.Audio.Media.ALBUM, MediaStore.Audio.Media.ALBUM_ID,
            MediaStore.Audio.Media.TITLE, MediaStore.Audio.Media.ARTIST,
            MediaStore.Audio.Media.DURATION};
    String selection = MediaStore.Audio.Media._ID + "=?";
    String[] selectionArgs = new String[]{myId
            .substring(ContentDirectoryIDs.MUSIC_ALL_TITLES_ITEM_PREFIX
                    .getId().length())};
    Cursor mediaCursor = contentDirectory
            .getContext()
            .getContentResolver()
            .query(MediaStore.Audio.Media.EXTERNAL_CONTENT_URI, projection,
                    selection, selectionArgs, null);

    if (mediaCursor != null) {
        mediaCursor.moveToFirst();
        String id = mediaCursor.getString(mediaCursor
                .getColumnIndex(MediaStore.Audio.Media._ID));
        String name = mediaCursor.getString(mediaCursor
                .getColumnIndex(MediaStore.Audio.Media.DISPLAY_NAME));
        Long size = Long.valueOf(mediaCursor.getString(mediaCursor
                .getColumnIndex(MediaStore.Audio.Media.SIZE)));

        String album = mediaCursor.getString(mediaCursor
                .getColumnIndex(MediaStore.Audio.Media.ALBUM));
        String albumId = mediaCursor.getString(mediaCursor
                .getColumnIndex(MediaStore.Audio.Media.ALBUM_ID));
        String title = mediaCursor.getString(mediaCursor
                .getColumnIndex(MediaStore.Audio.Media.TITLE));
        String artist = mediaCursor.getString(mediaCursor
                .getColumnIndex(MediaStore.Audio.Media.ARTIST));
        String duration = mediaCursor.getString(mediaCursor
                .getColumnIndex(MediaStore.Audio.Media.DURATION));
        duration = contentDirectory.formatDuration(duration);
        Log.d(getClass().getName(),
                "Mimetype: "
                        + mediaCursor.getString(mediaCursor
                        .getColumnIndex(MediaStore.Audio.Media.MIME_TYPE)));

        MimeType mimeType = MimeType.valueOf(mediaCursor
                .getString(mediaCursor
                        .getColumnIndex(MediaStore.Audio.Media.MIME_TYPE)));
        // file parameter only needed for media players which decide
        // the
        // ability of playing a file by the file extension

        String uri = getUriString(contentDirectory, id, mimeType);
        URI albumArtUri = URI.create("http://"
                + contentDirectory.getIpAddress() + ":"
                + YaaccUpnpServerService.PORT + "/?album=" + albumId);
        Res resource = new Res(mimeType, size, uri);
        resource.setDuration(duration);
        MusicTrack musicTrack = new MusicTrack(
                ContentDirectoryIDs.MUSIC_ALL_TITLES_ITEM_PREFIX.getId()
                        + id,
                ContentDirectoryIDs.MUSIC_ALL_TITLES_FOLDER.getId(), title
                + "-(" + name + ")", "", album, artist, resource);
        musicTrack
                .replaceFirstProperty(new UPNP.ALBUM_ART_URI(albumArtUri));
        result = musicTrack;
        Log.d(getClass().getName(), "MusicTrack: " + id + " Name: " + name
                + " uri: " + uri);

        mediaCursor.close();
    } else {
        Log.d(getClass().getName(), "Item " + myId + "  not found.");
    }

    return result;
}
 
開發者ID:theopenbit,項目名稱:yaacc-code,代碼行數:77,代碼來源:MusicAllTitleItemBrowser.java

示例13: JavaSource

import java.net.URI; //導入方法依賴的package包/類
public JavaSource() {
    super(URI.create("myfo:/Test.java"), JavaFileObject.Kind.SOURCE);
    source = bodyTemplate.replace("#A1", a1.typeStr)
                     .replace("#A2", a2.typeStr).replace("#A3", a3.typeStr)
                     .replace("#MC", mck.invokeString);
}
 
開發者ID:AdoptOpenJDK,項目名稱:openjdk-jdk10,代碼行數:7,代碼來源:T7086601b.java

示例14: HttpPropFind

import java.net.URI; //導入方法依賴的package包/類
public HttpPropFind(final String uri)
{
	this(URI.create(uri));
}
 
開發者ID:starn,項目名稱:encdroidMC,代碼行數:5,代碼來源:HttpPropFind.java

示例15: resolve

import java.net.URI; //導入方法依賴的package包/類
@Override
public DDO resolve(String identifier) throws ResolutionException {

	// prepare HTTP request

	String uriString = this.getResolverUri().toString();
	if (! uriString.endsWith("/")) uriString += "/";
	uriString += identifier;

	HttpGet httpGet = new HttpGet(URI.create(uriString));

	// retrieve DDO

	DDO ddo;

	try (CloseableHttpResponse httpResponse = (CloseableHttpResponse) this.getHttpClient().execute(httpGet)) {

		if (httpResponse.getStatusLine().getStatusCode() == 404) return null;
		if (httpResponse.getStatusLine().getStatusCode() > 200) throw new ResolutionException("Cannot retrieve DDO for " + identifier + " from " + uriString + ": " + httpResponse.getStatusLine());

		HttpEntity httpEntity = httpResponse.getEntity();

		ddo = DDO.fromString(EntityUtils.toString(httpEntity));
		EntityUtils.consume(httpEntity);
	} catch (IOException ex) {

		throw new ResolutionException("Cannot retrieve DDO for " + identifier + " from " + uriString + ": " + ex.getMessage(), ex);
	}

	if (log.isDebugEnabled()) log.debug("Retrieved DDO for " + identifier + " (" + uriString + "): " + ddo);

	// done

	return ddo;
}
 
開發者ID:decentralized-identity,項目名稱:universal-resolver,代碼行數:36,代碼來源:ClientUniResolver.java


注:本文中的java.net.URI.create方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。