当前位置: 首页>>代码示例>>Java>>正文


Java Application类代码示例

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


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

示例1: configure

import javax.ws.rs.core.Application; //导入依赖的package包/类
@Override
public Application configure() {

    initMocks(this);

    final String baseUri = getBaseUri().toString();
    final String origin = baseUri.substring(0, baseUri.length() - 1);

    final ResourceConfig config = new ResourceConfig();
    config.register(new LdpResource(mockResourceService, ioService, mockBinaryService, BASE_URL));
    config.register(new TestAuthenticationFilter("testUser", ""));
    config.register(new WebAcFilter(emptyList(), mockAccessControlService));
    config.register(new AgentAuthorizationFilter(mockAgentService, asList("testUser")));
    config.register(new MultipartUploader(mockResourceService, mockBinaryResolver, BASE_URL));
    config.register(new CacheControlFilter(86400));
    config.register(new CrossOriginResourceSharingFilter(asList(origin),
                asList("PATCH", "POST", "PUT"),
                asList("Link", "Content-Type", "Accept", "Accept-Datetime"),
                asList("Link", "Content-Type", "Pragma", "Memento-Datetime"), true, 100));
    return config;
}
 
开发者ID:trellis-ldp,项目名称:trellis,代码行数:22,代码来源:LdpAdminResourceTest.java

示例2: configure

import javax.ws.rs.core.Application; //导入依赖的package包/类
@Override
protected Application configure() {
    enable(TestProperties.LOG_TRAFFIC);
    enable(TestProperties.DUMP_ENTITY);

    ResourceConfig config = new ResourceConfig();

    FastJsonProvider fastJsonProvider = new FastJsonProvider();
    FastJsonConfig fastJsonConfig = new FastJsonConfig();
    fastJsonConfig.setSerializerFeatures(SerializerFeature.DisableCircularReferenceDetect, SerializerFeature.BrowserSecure);
    fastJsonProvider.setFastJsonConfig(fastJsonConfig);

    config.register(fastJsonProvider);

    config.packages("com.alibaba.json.bvt.issue_1300");
    return config;
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:18,代码来源:Issue1341.java

示例3: configure

import javax.ws.rs.core.Application; //导入依赖的package包/类
@Override
public Application configure() {

    final String baseUri = getBaseUri().toString();
    final String origin = baseUri.substring(0, baseUri.length() - 1);

    // Junit runner doesn't seem to work very well with JerseyTest
    initMocks(this);

    final ResourceConfig config = new ResourceConfig();
    config.register(new LdpResource(mockResourceService, ioService, mockBinaryService, "http://example.org/"));
    config.register(new TestAuthenticationFilter("testUser", "group"));
    config.register(new WebAcFilter(asList(BASIC_AUTH, DIGEST_AUTH), mockAccessControlService));
    config.register(new CrossOriginResourceSharingFilter(asList(origin),
                asList("PATCH", "POST", "PUT"),
                asList("Link", "Content-Type", "Accept", "Accept-Datetime"),
                emptyList(), false, 0));
    return config;
}
 
开发者ID:trellis-ldp,项目名称:trellis,代码行数:20,代码来源:LdpUnauthorizedResourceTest.java

示例4: configure

import javax.ws.rs.core.Application; //导入依赖的package包/类
@Override
public Application configure() {

    // Junit runner doesn't seem to work very well with JerseyTest
    initMocks(this);

    final String baseUri = getBaseUri().toString();
    final String origin = baseUri.substring(0, baseUri.length() - 1);

    final ResourceConfig config = new ResourceConfig();
    config.register(new LdpResource(mockResourceService, ioService, mockBinaryService, BASE_URL));
    config.register(new MultipartUploader(mockResourceService, mockBinaryResolver, BASE_URL));
    config.register(new CacheControlFilter(86400));
    config.register(new CrossOriginResourceSharingFilter(asList(origin), asList("PATCH", "POST", "PUT"),
                    asList("Link", "Content-Type", "Accept-Datetime"),
                    asList("Link", "Content-Type", "Memento-Datetime"), true, 100));
    return config;
}
 
开发者ID:trellis-ldp,项目名称:trellis,代码行数:19,代码来源:LdpResourceNoAgentTest.java

示例5: configure

import javax.ws.rs.core.Application; //导入依赖的package包/类
@Override
public Application configure() {

    // Junit runner doesn't seem to work very well with JerseyTest
    initMocks(this);

    final String baseUri = getBaseUri().toString();
    final String origin = baseUri.substring(0, baseUri.length() - 1);

    final ResourceConfig config = new ResourceConfig();
    config.register(new LdpResource(mockResourceService, ioService, mockBinaryService, BASE_URL));
    config.register(new TestAuthenticationFilter("testUser", "group"));
    config.register(new WebAcFilter(emptyList(), mockAccessControlService));
    config.register(new AgentAuthorizationFilter(mockAgentService, emptyList()));
    config.register(new MultipartUploader(mockResourceService, mockBinaryResolver, BASE_URL));
    config.register(new CacheControlFilter(86400));
    config.register(new CrossOriginResourceSharingFilter(asList(origin), asList("PATCH", "POST", "PUT"),
                    asList("Link", "Content-Type", "Accept-Datetime"),
                    asList("Link", "Content-Type", "Memento-Datetime"), true, 100));
    return config;
}
 
开发者ID:trellis-ldp,项目名称:trellis,代码行数:22,代码来源:LdpUserResourceTest.java

示例6: configure

import javax.ws.rs.core.Application; //导入依赖的package包/类
@Override
public Application configure() {

    initMocks(this);

    final String baseUri = getBaseUri().toString();
    final String origin = baseUri.substring(0, baseUri.length() - 1);

    final ResourceConfig config = new ResourceConfig();
    config.register(new LdpResource(mockResourceService, ioService, mockBinaryService, BASE_URL));
    config.register(new AgentAuthorizationFilter(mockAgentService, emptyList()));
    config.register(new MultipartUploader(mockResourceService, mockBinaryResolver, BASE_URL));
    config.register(new CacheControlFilter(86400));
    config.register(new CrossOriginResourceSharingFilter(asList(origin), asList("PATCH", "POST", "PUT"),
                    asList("Link", "Content-Type", "Accept-Datetime"),
                    asList("Link", "Content-Type", "Memento-Datetime"), true, 100));
    return config;
}
 
开发者ID:trellis-ldp,项目名称:trellis,代码行数:19,代码来源:LdpResourceTest.java

示例7: configure

import javax.ws.rs.core.Application; //导入依赖的package包/类
@Override
protected Application configure() {
    registry = new SimpleMeterRegistry();
    longTaskRequestStartedLatch = new CountDownLatch(1);
    longTaskRequestReleaseLatch = new CountDownLatch(1);

    final MetricsApplicationEventListener listener = new MetricsApplicationEventListener(
        registry, new DefaultJerseyTagsProvider(), METRIC_NAME, false);

    final ResourceConfig config = new ResourceConfig();
    config.register(listener);
    config.register(
        new TimedResource(longTaskRequestStartedLatch, longTaskRequestReleaseLatch));
    config.register(TimedOnClassResource.class);

    return config;
}
 
开发者ID:micrometer-metrics,项目名称:micrometer,代码行数:18,代码来源:MetricsRequestEventListenerTimedTest.java

示例8: multipleRegisterToRouter

import javax.ws.rs.core.Application; //导入依赖的package包/类
/**
 * Convenience method to construct and register the routes to a Vert.x router
 * with a base Spring application context.
 *
 * @param router
 *            vert.x router
 * @param applicationClasses
 *            application classes
 * @return the handlers
 */
@SafeVarargs
public static SwaggerHandler[] multipleRegisterToRouter(final Router router,
    final Class<? extends Application>... applicationClasses) {

    final SwaggerHandler[] ret = new SwaggerHandler[applicationClasses.length];
    int i = 0;
    for (final Class<? extends Application> applicationClass : applicationClasses) {
        final SwaggerHandler requestHandler = new SwaggerHandler(applicationClass);
        router.route(requestHandler.baseUriRoute())
            .useNormalisedPath(true)
            .handler(requestHandler);
        ret[i++] = requestHandler;
    }
    return ret;

}
 
开发者ID:trajano,项目名称:app-ms,代码行数:27,代码来源:SwaggerHandler.java

示例9: activate

import javax.ws.rs.core.Application; //导入依赖的package包/类
@Activate
public void activate(BundleContext bundleContext) {
	Application application = bundleContext.getService(_serviceReference);

	Dictionary<String, Object> properties = new Hashtable<>();

	String[] propertyKeys = _serviceReference.getPropertyKeys();

	for (String key : propertyKeys) {
		Object value = _serviceReference.getProperty(key);

		properties.put(key, value);
	}

	properties.put("osgi.jaxrs.application.base", "/");
	properties.put("osgi.jaxrs.name", ".default");

	_serviceRegistration = bundleContext.registerService(
		Application.class, application, properties);
}
 
开发者ID:liferay,项目名称:com-liferay-apio-architect,代码行数:21,代码来源:ApioApplicationRegistrar.java

示例10: configure

import javax.ws.rs.core.Application; //导入依赖的package包/类
@Override
protected Application configure() {

	enable(TestProperties.LOG_TRAFFIC);
	enable(TestProperties.DUMP_ENTITY);

	MockitoAnnotations.initMocks(this);

	ResourceConfig rs = new ResourceConfig();
	rs.register(TestBinder.forAllMocksOf(this));
	rs.register(JacksonJaxbJsonProvider.class);
	rs.register(TestResource.class);
	rs.property(ServerProperties.BV_SEND_ERROR_IN_RESPONSE, Boolean.TRUE);
	LinkFactoryResourceConfig.configure(rs);
	linkMetaFactory = LinkMetaFactory.createInsecureFactoryForTest();
	return rs;
}
 
开发者ID:Mercateo,项目名称:rest-jersey-utils,代码行数:18,代码来源:AbstractListingResourceTest.java

示例11: configure

import javax.ws.rs.core.Application; //导入依赖的package包/类
@Override
protected Application configure() {
    //enable(TestProperties.LOG_TRAFFIC);
    //enable(TestProperties.DUMP_ENTITY);
    //
    // TODO: load web.xml directly
    // .property(
    //        "contextConfigLocation",
    //        "classpath:**/my-web-test-context.xml"
    //
    return new ResourceConfig(MyResource.class)
            .register(ParsecMoxyProvider.class)
            .register(JaxbExceptionMapper.class)
            .property(JaxbExceptionMapper.PROP_JAXB_DEFAULT_ERROR_CODE, JAXB_ERROR_CODE)
            .property(JaxbExceptionMapper.PROP_JAXB_DEFAULT_ERROR_MSG, JAXB_ERROR_MSG)
            .register(ValidationConfigurationContextResolver.class)
            .register(ParsecValidationExceptionMapper.class)
            .property(ParsecValidationExceptionMapper.PROP_VALIDATION_DEFAULT_ERROR_CODE, VALIDATION_ERROR_CODE)
            .property(ParsecValidationExceptionMapper.PROP_VALIDATION_DEFAULT_ERROR_MSG, VALIDATION_ERROR_MSG)
            .property(ServerProperties.METAINF_SERVICES_LOOKUP_DISABLE, true)
            .register(new MoxyJsonConfig().setFormattedOutput(true)
                    .property(MarshallerProperties.BEAN_VALIDATION_MODE, BeanValidationMode.NONE).resolver());

}
 
开发者ID:yahoo,项目名称:parsec-libraries,代码行数:25,代码来源:JerseyValidationTest.java

示例12: buildFailedApplicationDTO

import javax.ws.rs.core.Application; //导入依赖的package包/类
private static FailedApplicationDTO buildFailedApplicationDTO(
    int reason, CachingServiceReference<Application> serviceReference) {

    FailedApplicationDTO failedApplicationDTO = new FailedApplicationDTO();

    Object nameProperty = serviceReference.getProperty(
        JaxRSWhiteboardConstants.JAX_RS_NAME);

    failedApplicationDTO.name = nameProperty == null ?
        generateApplicationName(serviceReference::getProperty) :
        nameProperty.toString();
    failedApplicationDTO.serviceId =
        (long)serviceReference.getProperty("service.id");

    failedApplicationDTO.failureReason = reason;

    return failedApplicationDTO;
}
 
开发者ID:apache,项目名称:aries-jax-rs-whiteboard,代码行数:19,代码来源:AriesJaxRSServiceRuntime.java

示例13: configure

import javax.ws.rs.core.Application; //导入依赖的package包/类
@Override
protected Application configure() {
	ResourceConfig application = new ResourceConfig();
	application.register(new AbstractLambdaContextReferencingBinder() {
		@Override
		protected void configure() {
			bindReferencingLambdaContextFactory();
		}
	});
	testService = mock(TestService.class);

	lambdaContextProvider = mock(LambdaContextProvider.class);

	Binder binder = new InstanceBinder.Builder()
			.addInstance(testService, TestService.class, Singleton.class)
			.addInstance(lambdaContextProvider, LambdaContextProvider.class, Singleton.class)
			.build();
	application.register(binder);

	application.register(TestResource.class);
	application.register(LambdaContextSetter.class);
	return application;
}
 
开发者ID:bbilger,项目名称:jrestless,代码行数:24,代码来源:AbstractLambdaContextReferencingBinderIntTest.java

示例14: configure

import javax.ws.rs.core.Application; //导入依赖的package包/类
@Override
protected Application configure() {
	CorsFilter corsFilter = new CorsFilter.Builder()
			.allowMethod(HttpMethod.DELETE)
			.allowMethod(HttpMethod.OPTIONS)
			.allowHeader("ah0")
			.allowHeader("ah1")
			.allowOrigin(DEFAULT_ORIGIN)
			.allowOrigin("http://test.com")
			.exposeHeader("eh0")
			.exposeHeader("eh1")
			.build();
	ResourceConfig application = new ResourceConfig();
	application.register(corsFilter);
	application.register(TestResource.class);
	return application;
}
 
开发者ID:bbilger,项目名称:jrestless,代码行数:18,代码来源:CorsFilterIntTest.java

示例15: deployApplication

import javax.ws.rs.core.Application; //导入依赖的package包/类
private OSGi<ServiceTuple<Application>> deployApplication(
    ServiceTuple<Application> tuple) {

    return
        just(this::createBus).flatMap(bus ->
        just(() -> {
            CachingServiceReference<Application> serviceReference =
                tuple.getCachingServiceReference();

            Map<String, Object> properties = getProperties(
                serviceReference);

            properties.computeIfAbsent(
                JAX_RS_NAME, (__) -> generateApplicationName(
                    serviceReference::getProperty));

            return properties;
        }).flatMap(properties ->
        deployRegistrator(bus, tuple, properties).then(
        registerCXFServletService(bus, properties)).then(
        just(tuple)
    )));
}
 
开发者ID:apache,项目名称:aries-jax-rs-whiteboard,代码行数:24,代码来源:Whiteboard.java


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