• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java UriBuilderException类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中javax.ws.rs.core.UriBuilderException的典型用法代码示例。如果您正苦于以下问题:Java UriBuilderException类的具体用法?Java UriBuilderException怎么用?Java UriBuilderException使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



UriBuilderException类属于javax.ws.rs.core包,在下文中一共展示了UriBuilderException类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: rewriteURL

import javax.ws.rs.core.UriBuilderException; //导入依赖的package包/类
@Override
public String rewriteURL(@Nullable RuntimeIdentity identity, @Nullable String name, String url)
    throws InfrastructureException {

  if (externalIpOfContainers != null) {
    try {
      URI uri = UriBuilder.fromUri(url).host(externalIpOfContainers).build();
      url = uri.toString();
    } catch (UriBuilderException | IllegalArgumentException e) {
      throw new InternalInfrastructureException(
          format(
              "Rewriting of host '%s' in URL '%s' failed. Error: %s",
              externalIpOfContainers, url, e.getMessage()));
    }
  }
  return url;
}
 
开发者ID:eclipse,项目名称:che,代码行数:18,代码来源:ExternalIpURLRewriter.java


示例2: configureClient

import javax.ws.rs.core.UriBuilderException; //导入依赖的package包/类
/**
 * Returns a Rest client configured with the specified properties.
 * 
 * @param path
 *          : path where the client is going to connect (e.g.
 *          /infrastructures/asdalk-asd34/vms)
 * @param parameters
 *          : extra parameters for the call (if needed)
 * @return : REST client
 */
public Builder configureClient(final String path,
    final RestParameter... parameters) throws ImClientException {
  try {
    WebTarget webtarget = getClient()
        .target(UriBuilder.fromUri(getTargetUrl()).build()).path(path);

    if (parameters != null && parameters.length > 0
        && parameters[0] != null) {
      for (RestParameter parameter : parameters) {
        webtarget.queryParam(parameter.getName(), parameter.getValues());
      }
    }

    return webtarget.request(MediaType.APPLICATION_JSON)
        .header(AUTH_HEADER_TAG, getParsedAuthFile());
  } catch (IllegalArgumentException | UriBuilderException exception) {
    ImJavaApiLogger.severe(this.getClass(), exception);
    throw exception;
  }
}
 
开发者ID:indigo-dc,项目名称:im-java-api,代码行数:31,代码来源:ImClient.java


示例3: prepareGETInvocationBuilder

import javax.ws.rs.core.UriBuilderException; //导入依赖的package包/类
/**
 * @param baseUri
 *
 * @return
 *
 * @throws UnsupportedEncodingException
 * @throws UriBuilderException
 * @throws IllegalArgumentException
 */
private Invocation prepareGETInvocationBuilder(final String mimeType, final String query)
				throws IllegalArgumentException, UriBuilderException, UnsupportedEncodingException {
	final UriBuilder baseBuilder = UriBuilder.fromUri(HOST).port(PORT);
	final URI targetUri = baseBuilder.path(QueryExecutor.ENDPOINT_NAME)
					.queryParam(QUERY_PARAM, URLEncoder.encode(query, "UTF-8").replace("+", "%20")).build();

	final Client client = ClientBuilder.newClient();
	final WebTarget resourceTarget = client.target(targetUri);
	final Builder invocationBuilder = resourceTarget.request(mimeType);
	final Invocation invocation = invocationBuilder.buildGet();

	return invocation;
}
 
开发者ID:opendatahacklab,项目名称:semanticoctopus,代码行数:23,代码来源:QueryExecutorTest.java


示例4: preparePOSTInvocationBuilder

import javax.ws.rs.core.UriBuilderException; //导入依赖的package包/类
/**
 * @param baseUri
 *
 * @return
 *
 * @throws UnsupportedEncodingException
 * @throws UriBuilderException
 * @throws IllegalArgumentException
 */
private Invocation preparePOSTInvocationBuilder(final String mimeType, final String contentType, final String query)
				throws IllegalArgumentException, UriBuilderException, UnsupportedEncodingException {
	final UriBuilder baseBuilder = UriBuilder.fromUri(HOST).port(PORT);
	final URI targetUri = baseBuilder.path(QueryExecutor.ENDPOINT_NAME).build();

	final Client client = ClientBuilder.newClient();
	final WebTarget resourceTarget = client.target(targetUri);
	final Builder invocationBuilder = resourceTarget.request(mimeType);

	final Entity<String> entity = Entity.entity(query,
					Variant.mediaTypes(MediaType.valueOf(contentType))
					.encodings("UTF-8")
					.build()
					.get(0),
					null);
	final Invocation invocation = invocationBuilder.buildPost(entity);

	return invocation;
}
 
开发者ID:opendatahacklab,项目名称:semanticoctopus,代码行数:29,代码来源:QueryExecutorTest.java


示例5: testQueryExecutionSuccessfulGET

import javax.ws.rs.core.UriBuilderException; //导入依赖的package包/类
/**
 * @throws IllegalMimeTypeException
 * @throws UnsupportedEncodingException
 * @throws UriBuilderException
 * @throws IllegalArgumentException
 */
@Test
public void testQueryExecutionSuccessfulGET()
				throws IllegalMimeTypeException, IllegalArgumentException, UriBuilderException,
				UnsupportedEncodingException {
	testSuccessfulMethod(Method.GET);
}
 
开发者ID:opendatahacklab,项目名称:semanticoctopus,代码行数:13,代码来源:QueryExecutorTest.java


示例6: testQueryExecutionSuccessfulURLPOST

import javax.ws.rs.core.UriBuilderException; //导入依赖的package包/类
/**
 * @throws IllegalMimeTypeException
 * @throws UnsupportedEncodingException
 * @throws UriBuilderException
 * @throws IllegalArgumentException
 */
@Test
public void testQueryExecutionSuccessfulURLPOST()
				throws IllegalMimeTypeException, IllegalArgumentException, UriBuilderException,
				UnsupportedEncodingException {
	testSuccessfulMethod(Method.URL_ENCODED_POST);
}
 
开发者ID:opendatahacklab,项目名称:semanticoctopus,代码行数:13,代码来源:QueryExecutorTest.java


示例7: asJson

import javax.ws.rs.core.UriBuilderException; //导入依赖的package包/类
/**
 * Returns the resource formatted as json
 * 
 * @return JSONObject * @throws JSONException
 */
@SuppressWarnings("unchecked")
public JSONObject asJson() throws JSONException {
	JSONObject messagesAsJson = super.asJson();

	// fill data
	JSONArray queuesArray = new JSONArray();
	List<?> items = getItems();
	if (items.size() > 0) {
		if (null != queueEntity){
			for (Object[] messageEntity : (List<Object[]>) items) {
				try {
					queuesArray.put(GroupMessageResource.asJson(
							messageEntity,
							isMessageInQueue,
							needsPayload,UriBuilder.fromPath(getUriInfo().getPath())
							.path(messageEntity[0].toString()).build()
							.getPath()));
				} catch (IllegalArgumentException | UriBuilderException
						| ParseException e) {
					// TODO Auto-generated catch block
				}
			}
		}
	}
	messagesAsJson.put("groupmessages", queuesArray);
	return messagesAsJson;
}
 
开发者ID:FinTP,项目名称:fintp_api,代码行数:33,代码来源:GroupMessagesResource.java


示例8: testCurlyBrackets

import javax.ws.rs.core.UriBuilderException; //导入依赖的package包/类
/**
 * Test http://dev.gbif.org/issues/browse/POR-2688
 * We expect a client handler or uniform interface exception cause we did not setup the entire jersey stack properly.
 * We only want to make sure there is no UriBuilderException thrown
 */
@Test
public void testCurlyBrackets() {
  try {
    WebResource api = Client.create().resource("http://api.gbif.org/v1/species/match");
    WebResource  q = api.queryParam("name", "Nereis southerni %7B%7Bnowrap Abdel-Moez & Humphries, 1955");
    assertEquals(
      "http://api.gbif.org/v1/species/match?name=Nereis+southerni+%7B%7Bnowrap+Abdel-Moez+%26+Humphries,+1955",
      q.toString());

    NameUsageMatchWsClient client = new NameUsageMatchWsClient(api);

    client.match("Nereis southerni {{nowrap Abdel-Moez & Humphries, 1955", null, null, false, false);
  } catch (RuntimeException e) {
    if (e instanceof UriBuilderException) {
      throw e;
    }
    System.out.println(e.toString());
  }
}
 
开发者ID:gbif,项目名称:checklistbank,代码行数:25,代码来源:NameUsageMatchWsClientTest.java


示例9: init

import javax.ws.rs.core.UriBuilderException; //导入依赖的package包/类
@Override
public void init() throws UriBuilderException, IllegalArgumentException {
    testCOPY = false;
    Command com = new Command();
    com.setName("Reaction Command");
    com.setHardwareLevel(false);
    
    Trigger t = new Trigger();
    t.setName("Reaction trigger");
    Trigger t2 = new Trigger();
    t2.setName("Second Trigger");
    
    getApi().triggers().create(t);
    getApi().triggers().create(t2);
    
    getApi().commands().create(com);
    
    Reaction r = new Reaction(t, com);
    setItem(new ReactionRepresentation(r));
    
    initPath(ReactionResource.class);
    setListType(new GenericType<List<ReactionRepresentation>>(){});
    setSingleType(new GenericType<ReactionRepresentation>(){});
}
 
开发者ID:freedomotic,项目名称:freedomotic,代码行数:25,代码来源:ReactionTest.java


示例10: init

import javax.ws.rs.core.UriBuilderException; //导入依赖的package包/类
@Override
public void init() throws UriBuilderException, IllegalArgumentException {
    setItem(new Zone());
    getItem().setName("Test Zone");
    getItem().setAsRoom(true);
    getItem().setDescription("Before editing");
    e.setName("Test env for zone");
    e.setUUID(getUuid());
    el.setPojo(e);
    el.init();
    getApi().environments().create(el);
   
    initPath(UriBuilder.fromResource(EnvironmentResource.class).path(e.getUUID()).path("/rooms").build().toString());
    setListType(new GenericType<List<Zone>>(){});
    setSingleType(new GenericType<Zone>(){});        
}
 
开发者ID:freedomotic,项目名称:freedomotic,代码行数:17,代码来源:ZoneTest.java


示例11: getCallbackUri

import javax.ws.rs.core.UriBuilderException; //导入依赖的package包/类
private String getCallbackUri() throws UriBuilderException, IllegalArgumentException {
    return uriInfo.getBaseUriBuilder()
            .path("auth")
            .path("callback")
            .build()
            .toASCIIString();
}
 
开发者ID:PacktPublishing,项目名称:Java-9-Programming-Blueprints,代码行数:8,代码来源:AuthenticationResource.java


示例12: getResponse

import javax.ws.rs.core.UriBuilderException; //导入依赖的package包/类
Response getResponse(boolean updated, UriInfo info) throws UriBuilderException, IllegalArgumentException {
    if (updated) {
        return Response.
                noContent().
                build();
    } else {
        URI uri = info.getAbsolutePathBuilder().
                build();
        return Response.
                created(uri).
                build();
    }
}
 
开发者ID:AdamBien,项目名称:firehose,代码行数:14,代码来源:ConfigurationResource.java


示例13: createURI

import javax.ws.rs.core.UriBuilderException; //导入依赖的package包/类
private URI createURI(String uri) {
    try {
        return new URI(uri);
    } catch (URISyntaxException ex) {
        throw new UriBuilderException(ex);
    }
}
 
开发者ID:bazaarvoice,项目名称:emodb,代码行数:8,代码来源:EmoUriBuilder.java


示例14: createHttpServer

import javax.ws.rs.core.UriBuilderException; //导入依赖的package包/类
private HttpServer createHttpServer()
    throws IOException, IllegalArgumentException, UriBuilderException, URISyntaxException {
    ResourceConfig resourceConfig = new ResourceConfig()
        .packages(true, Configuration.instance().getStrings("APP.Jersey.Resources").toArray(new String[0]))
        .register(FrontendFeature.class);
    EncodingFilter.enableFor(resourceConfig, GZipEncoder.class);
    return GrizzlyHttpServerFactory.createHttpServer(getURI(), resourceConfig, false);
}
 
开发者ID:MyCoRe-Org,项目名称:MyVidCoRe,代码行数:9,代码来源:EmbeddedHttpServer.java


示例15: build

import javax.ws.rs.core.UriBuilderException; //导入依赖的package包/类
@Override
public URI build(Object... values) throws IllegalArgumentException, UriBuilderException {
  String url = null;
  try {
    url = new Formatter().format(_pathFormat, values).toString();
  } catch (Exception ex) {
    throw new UriBuilderException("Problem building url from format[" + _pathFormat + "] and values[" + values + "]", ex);
  }
  return URI.create(url);
}
 
开发者ID:DevStreet,项目名称:FinanceAnalytics,代码行数:11,代码来源:MockUriBuilder.java


示例16: buildFromMap

import javax.ws.rs.core.UriBuilderException; //导入依赖的package包/类
@Override
public URI buildFromMap(Map<String, ?> values,
		boolean encodeSlashInPath) throws IllegalArgumentException,
		UriBuilderException {
	return rewrite(wrapped.buildFromEncoded(values,
			encodeSlashInPath));
}
 
开发者ID:apache,项目名称:incubator-taverna-server,代码行数:8,代码来源:Uri.java


示例17: testQueryExecutionSuccessfulDirectPOST

import javax.ws.rs.core.UriBuilderException; //导入依赖的package包/类
/**
 * @throws IllegalMimeTypeException
 * @throws UnsupportedEncodingException
 * @throws UriBuilderException
 * @throws IllegalArgumentException
 */
@Test
public void testQueryExecutionSuccessfulDirectPOST()
				throws IllegalMimeTypeException, IllegalArgumentException, UriBuilderException,
				UnsupportedEncodingException {
	testSuccessfulMethod(Method.DIRECT_POST);
}
 
开发者ID:opendatahacklab,项目名称:semanticoctopus,代码行数:13,代码来源:QueryExecutorTest.java


示例18: testQueryExecutionInvalidFormatOnGET

import javax.ws.rs.core.UriBuilderException; //导入依赖的package包/类
/**
 * @throws IllegalMimeTypeException
 * @throws UnsupportedEncodingException
 * @throws UriBuilderException
 * @throws IllegalArgumentException
 */
@Test
public void testQueryExecutionInvalidFormatOnGET()
				throws IllegalMimeTypeException, IllegalArgumentException, UriBuilderException,
				UnsupportedEncodingException {
	testUnsuccessfulMethod(Method.GET, QueryExecutor.INVALID_FORMAT_STATUS_CODE);
}
 
开发者ID:opendatahacklab,项目名称:semanticoctopus,代码行数:13,代码来源:QueryExecutorTest.java


示例19: testQueryExecutionInvalidFormatURLPOST

import javax.ws.rs.core.UriBuilderException; //导入依赖的package包/类
/**
 * @throws IllegalMimeTypeException
 * @throws UnsupportedEncodingException
 * @throws UriBuilderException
 * @throws IllegalArgumentException
 */
@Test
public void testQueryExecutionInvalidFormatURLPOST()
				throws IllegalMimeTypeException, IllegalArgumentException, UriBuilderException,
				UnsupportedEncodingException {
	testUnsuccessfulMethod(Method.URL_ENCODED_POST, QueryExecutor.INVALID_FORMAT_STATUS_CODE);
}
 
开发者ID:opendatahacklab,项目名称:semanticoctopus,代码行数:13,代码来源:QueryExecutorTest.java


示例20: testQueryExecutionInvalidFormatDirectPOST

import javax.ws.rs.core.UriBuilderException; //导入依赖的package包/类
/**
 * @throws IllegalMimeTypeException
 * @throws UnsupportedEncodingException
 * @throws UriBuilderException
 * @throws IllegalArgumentException
 */
@Test
public void testQueryExecutionInvalidFormatDirectPOST()
				throws IllegalMimeTypeException, IllegalArgumentException, UriBuilderException,
				UnsupportedEncodingException {
	testUnsuccessfulMethod(Method.DIRECT_POST, QueryExecutor.INVALID_FORMAT_STATUS_CODE);
}
 
开发者ID:opendatahacklab,项目名称:semanticoctopus,代码行数:13,代码来源:QueryExecutorTest.java



注:本文中的javax.ws.rs.core.UriBuilderException类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java CommandListener类代码示例发布时间:2022-05-21
下一篇:
Java X509V3CertificateGenerator类代码示例发布时间:2022-05-21
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap