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

Java PropertiesDelegate类代码示例

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

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



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

示例1: testJmsBaseUrlDefault

import org.glassfish.jersey.internal.PropertiesDelegate; //导入依赖的package包/类
/**
 * Demonstrates that when the {@link FedoraBaseResource#JMS_BASEURL_PROP fcrepo.jms.baseUrl} system property is not
 * set, the url used for JMS messages is the same as the base url found in the {@code UriInfo}.
 * <p>
 * Implementation note: this test requires a concrete instance of {@link UriInfo}, because it is the interaction of
 * {@code javax.ws.rs.core.UriBuilder} and {@code FedoraBaseResource} that is being tested.
 * </p>
 */
@Test
public void testJmsBaseUrlDefault() {
    // Obtain a concrete instance of UriInfo
    final URI baseUri = create("http://localhost/fcrepo");
    final URI requestUri = create("http://localhost/fcrepo/foo");
    final ContainerRequest req = new ContainerRequest(baseUri, requestUri, "GET", mock(SecurityContext.class),
            mock(PropertiesDelegate.class));
    final UriInfo info = spy(req.getUriInfo());

    final String expectedBaseUrl = baseUri.toString();

    testObj.setUpJMSInfo(info, mockHeaders);

    verify(mockFedoraSession).addSessionData(BASE_URL, expectedBaseUrl);
    verify(info, times(0)).getBaseUriBuilder();
    verify(info).getBaseUri();
}
 
开发者ID:fcrepo4,项目名称:fcrepo4,代码行数:26,代码来源:FedoraLdpTest.java


示例2: testJmsBaseUrlOverrideHost

import org.glassfish.jersey.internal.PropertiesDelegate; //导入依赖的package包/类
/**
 * Demonstrates that the host supplied by the {@link FedoraBaseResource#JMS_BASEURL_PROP fcrepo.jms.baseUrl} system
 * property is used as the as the base url for JMS messages, and not the base url found in {@code UriInfo}.
 * <p>
 * Note: the path from the request is preserved, the host from the fcrepo.jms.baseUrl is used
 * </p>
 * <p>
 * Implementation note: this test requires a concrete instance of {@link UriInfo}, because it is the interaction of
 * {@code javax.ws.rs.core.UriBuilder} and {@code FedoraBaseResource} that is being tested.
 * </p>
 */
@Test
public void testJmsBaseUrlOverrideHost() {
    // Obtain a concrete implementation of UriInfo
    final URI baseUri = create("http://localhost/fcrepo");
    final URI requestUri = create("http://localhost/fcrepo/foo");
    final ContainerRequest req = new ContainerRequest(baseUri, requestUri, "GET", mock(SecurityContext.class),
            mock(PropertiesDelegate.class));
    final UriInfo info = spy(req.getUriInfo());

    final String baseUrl = "http://example.org";
    final String expectedBaseUrl = baseUrl + baseUri.getPath();
    System.setProperty(JMS_BASEURL_PROP, baseUrl);

    testObj.setUpJMSInfo(info, mockHeaders);

    verify(mockFedoraSession).addSessionData(BASE_URL, expectedBaseUrl);
    verify(info).getBaseUriBuilder();
    System.clearProperty(JMS_BASEURL_PROP);
}
 
开发者ID:fcrepo4,项目名称:fcrepo4,代码行数:31,代码来源:FedoraLdpTest.java


示例3: testJmsBaseUrlOverrideHostAndPort

import org.glassfish.jersey.internal.PropertiesDelegate; //导入依赖的package包/类
/**
 * Demonstrates that the host and port supplied by the {@link FedoraBaseResource#JMS_BASEURL_PROP
 * fcrepo.jms.baseUrl} system property is used as the as the base url for JMS messages, and not the base url found
 * in {@code UriInfo}.
 * <p>
 * Note: the path from the request is preserved, but the host and port from the request is overridden by the values
 * from fcrepo.jms.baseUrl
 * </p>
 * <p>
 * Implementation note: this test requires a concrete instance of {@link UriInfo}, because it is the interaction of
 * {@code javax.ws.rs.core.UriBuilder} and {@code FedoraBaseResource} that is being tested.
 * </p>
 */
@Test
public void testJmsBaseUrlOverrideHostAndPort() {
    // Obtain a concrete implementation of UriInfo
    final URI baseUri = create("http://localhost/fcrepo");
    final URI requestUri = create("http://localhost/fcrepo/foo");
    final ContainerRequest req = new ContainerRequest(baseUri, requestUri, "GET", mock(SecurityContext.class),
            mock(PropertiesDelegate.class));
    final UriInfo info = spy(req.getUriInfo());

    final String baseUrl = "http://example.org:9090";
    final String expectedBaseUrl = baseUrl + baseUri.getPath();
    System.setProperty(JMS_BASEURL_PROP, baseUrl);

    testObj.setUpJMSInfo(info, mockHeaders);

    verify(mockFedoraSession).addSessionData(BASE_URL, expectedBaseUrl);
    verify(info).getBaseUriBuilder();
    System.clearProperty(JMS_BASEURL_PROP);
}
 
开发者ID:fcrepo4,项目名称:fcrepo4,代码行数:33,代码来源:FedoraLdpTest.java


示例4: testJmsBaseUrlOverrideUrl

import org.glassfish.jersey.internal.PropertiesDelegate; //导入依赖的package包/类
/**
 * Demonstrates that the url supplied by the {@link FedoraBaseResource#JMS_BASEURL_PROP fcrepo.jms.baseUrl} system
 * property is used as the as the base url for JMS messages, and not the base url found in {@code UriInfo}.
 * <p>
 * Note: the host and path from the request is overridden by the values from fcrepo.jms.baseUrl
 * </p>
 * <p>
 * Implementation note: this test requires a concrete instance of {@link UriInfo}, because it is the interaction of
 * {@code javax.ws.rs.core.UriBuilder} and {@code FedoraBaseResource} that is being tested.
 * </p>
 */
@Test
public void testJmsBaseUrlOverrideUrl() {
    // Obtain a concrete implementation of UriInfo
    final URI baseUri = create("http://localhost/fcrepo");
    final URI requestUri = create("http://localhost/fcrepo/foo");
    final ContainerRequest req = new ContainerRequest(baseUri, requestUri, "GET", mock(SecurityContext.class),
            mock(PropertiesDelegate.class));
    final UriInfo info = spy(req.getUriInfo());

    final String expectedBaseUrl = "http://example.org/fcrepo/rest";
    System.setProperty(JMS_BASEURL_PROP, expectedBaseUrl);

    testObj.setUpJMSInfo(info, mockHeaders);

    verify(mockFedoraSession).addSessionData(BASE_URL, expectedBaseUrl);
    verify(info).getBaseUriBuilder();
    System.clearProperty(JMS_BASEURL_PROP);
}
 
开发者ID:fcrepo4,项目名称:fcrepo4,代码行数:30,代码来源:FedoraLdpTest.java


示例5: testJmsBaseUrlOverrideRequestUrlWithPort8080

import org.glassfish.jersey.internal.PropertiesDelegate; //导入依赖的package包/类
/**
 * Demonstrates that when the the base url in {@code UriInfo} contains a port number, and the base url defined by
 * {@link FedoraBaseResource#JMS_BASEURL_PROP fcrepo.jms.baseUrl} does <em>not</em> contain a port number, that the
 * base url for JMS messages does not contain a port number.
 * <p>
 * Note: the host, port, and path from the request is overridden by values from fcrepo.jms.baseUrl
 * </p>
 * <p>
 * Implementation note: this test requires a concrete instance of {@link UriInfo}, because it is the interaction of
 * {@code javax.ws.rs.core.UriBuilder} and {@code FedoraBaseResource} that is being tested.
 * </p>
 */
@Test
public void testJmsBaseUrlOverrideRequestUrlWithPort8080() {
    // Obtain a concrete implementation of UriInfo
    final URI baseUri = create("http://localhost:8080/fcrepo/rest");
    final URI reqUri = create("http://localhost:8080/fcrepo/rest/foo");
    final ContainerRequest req = new ContainerRequest(baseUri, reqUri, "GET", mock(SecurityContext.class),
            mock(PropertiesDelegate.class));
    final UriInfo info = spy(req.getUriInfo());

    final String expectedBaseUrl = "http://example.org/fcrepo/rest/";
    System.setProperty(JMS_BASEURL_PROP, expectedBaseUrl);

    testObj.setUpJMSInfo(info, mockHeaders);

    verify(mockFedoraSession).addSessionData(BASE_URL, expectedBaseUrl);
    verify(info).getBaseUriBuilder();
    System.clearProperty(JMS_BASEURL_PROP);
}
 
开发者ID:fcrepo4,项目名称:fcrepo4,代码行数:31,代码来源:FedoraLdpTest.java


示例6: channelRead0

import org.glassfish.jersey.internal.PropertiesDelegate; //导入依赖的package包/类
@Override
protected void channelRead0(ChannelHandlerContext ctx, HttpMessage msg) throws Exception {
    Writer w = new Writer(ctx);

    PropertiesDelegate properties = new MapPropertiesDelegate();
    SecurityContext securityContext = new SecurityContext() {
        @Override
        public Principal getUserPrincipal() {
            return null;
        }

        @Override
        public boolean isUserInRole(String s) {
            return false;
        }

        @Override
        public boolean isSecure() {
            return false;
        }

        @Override
        public String getAuthenticationScheme() {
            return null;
        }
    };
}
 
开发者ID:m0wfo,项目名称:netty-utils,代码行数:28,代码来源:NettyContainer.java


示例7: createContainerRequest

import org.glassfish.jersey.internal.PropertiesDelegate; //导入依赖的package包/类
private ContainerRequest createContainerRequest(URI baseUri, URI requestUri, String method, String content, Map<String, String> headers,
                                                SecurityContext securityContext, PropertiesDelegate propertiesDelegate) {
    URI uri = URI.create(baseUri.getPath() + "/");
    ContainerRequest containerRequest = new ContainerRequest(uri, requestUri, method, securityContext, propertiesDelegate);
    containerRequest.setEntityStream(new ByteArrayInputStream(content.getBytes()));
    for (Map.Entry<String, String> headerEntry : headers.entrySet()) {
        containerRequest.getHeaders().add(headerEntry.getKey(), headerEntry.getValue());
    }
    return containerRequest;
}
 
开发者ID:minnal,项目名称:minnal,代码行数:11,代码来源:BaseResourceTest.java


示例8: readRequest

import org.glassfish.jersey.internal.PropertiesDelegate; //导入依赖的package包/类
/**
 * Reads an request object generated by an AWS_PROXY integration in API Gateway and transforms it into a Jersey
 * <code>ContainerRequest</code> object.
 *
 * @param request The incoming request object
 * @param securityContext A jax-rs SecurityContext object (@see com.amazonaws.serverless.proxy.SecurityContextWriter)
 * @param lambdaContext The AWS Lambda context for the request
 * @param config The container config object, this is passed in by the LambdaContainerHandler
 * @return A populated ContainerRequest object
 * @throws InvalidRequestEventException When the method fails to parse the incoming request
 */
@Override
public ContainerRequest readRequest(AwsProxyRequest request, SecurityContext securityContext, Context lambdaContext, ContainerConfig config)
        throws InvalidRequestEventException {
    currentRequest = request;
    currentLambdaContext = lambdaContext;

    request.setPath(stripBasePath(request.getPath(), config));

    URI basePathUri;
    URI requestPathUri;
    String basePath = "/";

    try {
        basePathUri = new URI(basePath);
    } catch (URISyntaxException e) {
        log.error("Could not read base path URI", e);
        throw new InvalidRequestEventException("Error while generating base path URI: " + basePath, e);
    }


    UriBuilder uriBuilder = UriBuilder.fromPath(request.getPath());

    if (request.getQueryStringParameters() != null) {
        for (String paramKey : request.getQueryStringParameters().keySet()) {
            uriBuilder = uriBuilder.queryParam(paramKey, request.getQueryStringParameters().get(paramKey));
        }
    }

    requestPathUri = uriBuilder.build();

    PropertiesDelegate apiGatewayProperties = new MapPropertiesDelegate();
    apiGatewayProperties.setProperty(API_GATEWAY_CONTEXT_PROPERTY, request.getRequestContext());
    apiGatewayProperties.setProperty(API_GATEWAY_STAGE_VARS_PROPERTY, request.getStageVariables());
    apiGatewayProperties.setProperty(LAMBDA_CONTEXT_PROPERTY, lambdaContext);

    ContainerRequest requestContext = new ContainerRequest(basePathUri, requestPathUri, request.getHttpMethod(), securityContext, apiGatewayProperties);

    if (request.getBody() != null) {
        if (request.isBase64Encoded()) {
            requestContext.setEntityStream(new ByteArrayInputStream(Base64.getDecoder().decode(request.getBody())));
        } else {
            requestContext.setEntityStream(new ByteArrayInputStream(request.getBody().getBytes()));
        }
    }

    if (request.getHeaders() != null) {
        for (final String headerName : request.getHeaders().keySet()) {
            requestContext.headers(headerName, request.getHeaders().get(headerName));
        }
    }

    return requestContext;
}
 
开发者ID:awslabs,项目名称:aws-serverless-java-container,代码行数:65,代码来源:JerseyAwsProxyRequestReader.java


示例9: apply

import org.glassfish.jersey.internal.PropertiesDelegate; //导入依赖的package包/类
/**
 * {@inheritDoc}
 * <p/>
 * Transforms client-side request to server-side and invokes it on provided
 * application ({@link ApplicationHandler} instance).
 *
 * @param clientRequest
 *            client side request to be invoked.
 */
@Override
public ClientResponse apply(final ClientRequest clientRequest) {
	final PropertiesDelegate propertiesDelegate = new MapPropertiesDelegate();

	final ContainerRequest containerRequest = new ContainerRequest(this.baseUri, clientRequest.getUri(),
			clientRequest.getMethod(), null, propertiesDelegate);

	containerRequest.getHeaders().putAll(clientRequest.getStringHeaders());

	final ByteArrayOutputStream clientOutput = new ByteArrayOutputStream();
	if (clientRequest.getEntity() != null) {
		clientRequest.setStreamProvider(new OutboundMessageContext.StreamProvider() {
			@Override
			public OutputStream getOutputStream(final int contentLength) throws IOException {
				final MultivaluedMap<String, Object> clientHeaders = clientRequest.getHeaders();
				if (contentLength != -1 && !clientHeaders.containsKey(HttpHeaders.CONTENT_LENGTH)) {
					containerRequest.getHeaders().putSingle(HttpHeaders.CONTENT_LENGTH,
							String.valueOf(contentLength));
				}
				return clientOutput;
			}
		});
		clientRequest.enableBuffering();

		try {
			clientRequest.writeEntity();
		} catch (final IOException e) {
			final String msg = "Error while writing entity to the output stream.";
			CdiAwareInMemoryConnector.LOGGER.log(Level.SEVERE, msg, e);
			throw new ProcessingException(msg, e);
		}
	}

	containerRequest.setEntityStream(new ByteArrayInputStream(clientOutput.toByteArray()));

	final boolean followRedirects = ClientProperties.getValue(clientRequest.getConfiguration().getProperties(),
			ClientProperties.FOLLOW_REDIRECTS, true);

	final InMemoryResponseWriter inMemoryResponseWriter = new InMemoryResponseWriter();
	containerRequest.setWriter(inMemoryResponseWriter);
	containerRequest.setSecurityContext(new SecurityContext() {

		@Override
		public String getAuthenticationScheme() {
			return null;
		}

		@Override
		public Principal getUserPrincipal() {
			return null;
		}

		@Override
		public boolean isSecure() {
			return false;
		}

		@Override
		public boolean isUserInRole(final String role) {
			return false;
		}

	});
	this.appHandler.handle(containerRequest);

	return tryFollowRedirects(followRedirects,
			CdiAwareInMemoryConnector.createClientResponse(clientRequest, inMemoryResponseWriter),
			new ClientRequest(clientRequest));

}
 
开发者ID:gtcGroup,项目名称:jped-parent-project,代码行数:80,代码来源:CdiAwareInMemoryConnector.java


示例10: testFilter

import org.glassfish.jersey.internal.PropertiesDelegate; //导入依赖的package包/类
@Test
public void testFilter() throws Exception {
    DatabaseProvider.openConnection();

    String username = "testuser";

    User user = new User();
    user.setName(username);
    user.setLogin("testUserLogin");
    user.setPassHash("testUserPassHash");
    user.saveIt();


    HttpSession session = Mockito.mock(HttpSession.class);
    HttpServletRequest request = Mockito.mock(HttpServletRequest.class);

    Mockito.stub(request.getSession(true)).toReturn(session);
    Mockito.stub(session.getAttribute("userId")).toReturn(user.getId());

    AuthUserProvider provider = new AuthUserProvider();


    ContainerRequestContext containerRequest =
            new ContainerRequest(null, null, null, null, Mockito.mock(PropertiesDelegate.class));

    provider.setRequest(request);
    provider.filter(containerRequest);

    assertEquals(username, containerRequest.getSecurityContext().getUserPrincipal().getName());
}
 
开发者ID:autoschool,项目名称:twister,代码行数:31,代码来源:AuthUserProviderTest.java


示例11: Request

import org.glassfish.jersey.internal.PropertiesDelegate; //导入依赖的package包/类
/**
 * Create new Jersey container request context.
 *
 * @param baseUri            base application URI.
 * @param requestUri         request URI.
 * @param httpMethod         request HTTP method name.
 * @param securityContext    security context of the current request. Must not be {@code null}.
 *                           The {@link javax.ws.rs.core.SecurityContext#getUserPrincipal()} must return
 *                           {@code null} if the current request has not been authenticated
 *                           by the container.
 * @param propertiesDelegate custom {@link org.glassfish.jersey.internal.PropertiesDelegate properties delegate}
 */
public Request(URI baseUri, URI requestUri, String httpMethod, SecurityContext securityContext, PropertiesDelegate propertiesDelegate) {
    super(baseUri, requestUri, httpMethod, securityContext, propertiesDelegate);
}
 
开发者ID:icode,项目名称:ameba,代码行数:16,代码来源:Request.java


示例12: readEntity

import org.glassfish.jersey.internal.PropertiesDelegate; //导入依赖的package包/类
/**
 * <p>readEntity.</p>
 *
 * @param rawType            a {@link java.lang.Class} object.
 * @param type               a {@link java.lang.reflect.Type} object.
 * @param annotations        an array of {@link java.lang.annotation.Annotation} objects.
 * @param propertiesDelegate a {@link org.glassfish.jersey.internal.PropertiesDelegate} object.
 * @param <T>                a T object.
 * @return a T object.
 */
public static <T> T readEntity(Class<T> rawType, Type type, Annotation[] annotations, PropertiesDelegate propertiesDelegate) {
    return getRequest().readEntity(rawType, type, annotations, propertiesDelegate);
}
 
开发者ID:icode,项目名称:ameba,代码行数:14,代码来源:Requests.java


示例13: getPropertiesDelegate

import org.glassfish.jersey.internal.PropertiesDelegate; //导入依赖的package包/类
/**
 * <p>getPropertiesDelegate.</p>
 *
 * @return a {@link org.glassfish.jersey.internal.PropertiesDelegate} object.
 */
public static PropertiesDelegate getPropertiesDelegate() {
    return getRequest().getPropertiesDelegate();
}
 
开发者ID:icode,项目名称:ameba,代码行数:9,代码来源:Requests.java



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

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

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

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

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

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