当前位置: 首页>>代码示例>>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;未经允许,请勿转载。