本文整理匯總了Java中org.jboss.resteasy.spi.ResteasyProviderFactory類的典型用法代碼示例。如果您正苦於以下問題:Java ResteasyProviderFactory類的具體用法?Java ResteasyProviderFactory怎麽用?Java ResteasyProviderFactory使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
ResteasyProviderFactory類屬於org.jboss.resteasy.spi包,在下文中一共展示了ResteasyProviderFactory類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: contextInitialized
import org.jboss.resteasy.spi.ResteasyProviderFactory; //導入依賴的package包/類
public void contextInitialized(ServletContextEvent event) {
super.contextInitialized(event);
ResteasyProviderFactory dispatcher = ResteasyProviderFactory.getInstance();
dispatcher.registerProvider(OctetStreamWriter.class, false);
dispatcher.registerProvider(PlainTextReader.class, false);
restRuntime = new RestRuntime();
initPortalConfiguration(event);
restRuntime.start(dispatcher,
findConfigurationFile(event.getServletContext(), "log4j.properties"),
findConfigurationFile(event.getServletContext(),
File.separator + "config" + File.separator + "network" +
File.separator + "server.ini"));
}
示例2: contextInitialized
import org.jboss.resteasy.spi.ResteasyProviderFactory; //導入依賴的package包/類
@Override
public void contextInitialized(ServletContextEvent event) {
super.contextInitialized(event);
final ServletContext context = event.getServletContext();
final Registry registry = (Registry) context.getAttribute(Registry.class.getName());
final ResteasyProviderFactory providerFactory =
(ResteasyProviderFactory) context.getAttribute(ResteasyProviderFactory.class.getName());
final ModuleProcessor processor = new ModuleProcessor(registry, providerFactory);
final List<? extends Module> appModules = getModules(context);
List<Module> modules = Lists.newArrayList();
modules.addAll(appModules);
injector = GuiceLifecycleContainers.initialize(this, modules);
withInjector(injector);
processor.processInjector(injector);
}
示例3: getCorrelationId
import org.jboss.resteasy.spi.ResteasyProviderFactory; //導入依賴的package包/類
@Override
public String getCorrelationId() {
HttpHeaders headers = ResteasyProviderFactory.getContextData(HttpHeaders.class);
String correlationId;
if (headers != null) {
correlationId = headers.getHeaderString(headerName);
if (correlationId != null) {
return correlationId;
}
}
// Fall back to MDC to support beadledom-jaxrs 1.0. Retrieving from the headers is preferred.
correlationId = MDC.get(mdcName);
return correlationId;
}
示例4: filter
import org.jboss.resteasy.spi.ResteasyProviderFactory; //導入依賴的package包/類
public void filter(ContainerRequestContext requestContext) throws IOException {
HttpServletRequest request = ResteasyProviderFactory.getContextData(HttpServletRequest.class);
RpcContext.getContext().setRequest(request);
// this only works for servlet containers
if (request != null && RpcContext.getContext().getRemoteAddress() == null) {
RpcContext.getContext().setRemoteAddress(request.getRemoteAddr(), request.getRemotePort());
}
RpcContext.getContext().setResponse(ResteasyProviderFactory.getContextData(HttpServletResponse.class));
String headers = requestContext.getHeaderString(DUBBO_ATTACHMENT_HEADER);
if (headers != null) {
for (String header : headers.split(",")) {
int index = header.indexOf("=");
if (index > 0) {
String key = header.substring(0, index);
String value = header.substring(index + 1);
if (!StringUtils.isEmpty(key)) {
RpcContext.getContext().setAttachment(key.trim(), value.trim());
}
}
}
}
}
示例5: VertxHttpRequest
import org.jboss.resteasy.spi.ResteasyProviderFactory; //導入依賴的package包/類
public VertxHttpRequest(final RoutingContext context,
final ResteasyUriInfo uriInfo,
final ResteasyProviderFactory providerFactory) {
super(uriInfo);
this.context = context;
vertxRequest = context.request();
httpHeaders = new VertxRoutingContextHttpHeaders(context);
LOG.debug("vertxRequest.isEnded={}", vertxRequest.isEnded());
if (!vertxRequest.isEnded()) {
is = new VertxBlockingInputStream(vertxRequest);
} else {
is = NullInputStream.nullInputStream();
}
asynchronousContext = new VertxExecutionContext(context, providerFactory, this);
}
示例6: testEngineWithInjectedClientPost2
import org.jboss.resteasy.spi.ResteasyProviderFactory; //導入依賴的package包/類
@Test
public void testEngineWithInjectedClientPost2() {
final ResteasyDeployment deployment = new ResteasyDeployment();
deployment.start();
final ResteasyProviderFactory providerFactory = deployment.getProviderFactory();
final HttpClient httpClient = Vertx.vertx().createHttpClient(httpClientOptions);
final Client client = new ResteasyClientBuilder()
.providerFactory(providerFactory)
.httpEngine(new VertxClientEngine(httpClient))
.register(GsonMessageBodyHandler.class)
.build();
final Form xform = new Form();
xform.param("userName", "ca1\\\\meowmix");
xform.param("password", "mingnamulan");
xform.param("state", "authenticate");
xform.param("style", "xml");
xform.param("xsl", "none");
final Response response = client.target("https://httpbin.org/post").request(MediaType.APPLICATION_JSON)
.post(Entity.form(xform), Response.class);
assertFalse(response.getStringHeaders().isEmpty());
System.out.println(response.getStringHeaders());
assertFalse(response.getHeaders().isEmpty());
assertEquals(MediaType.APPLICATION_JSON_TYPE, response.getMediaType());
assertTrue(response.hasEntity());
final JsonObject arsString = response.readEntity(JsonObject.class);
assertEquals("xml", arsString.getAsJsonObject("form").get("style").getAsString());
}
示例7: sendInquiry
import org.jboss.resteasy.spi.ResteasyProviderFactory; //導入依賴的package包/類
public String sendInquiry(RentalOrder entityOrder, String processInstanceID) {
// parse RentalOrder object to Order object (which represents the agreed upon JSON format)
System.out.println("PARSING SENDING OBJECT");
User user = parseUser(entityOrder);
Collection<org.camunda.bpm.bvis.rest.send.dto.Car> cars = parseCars(entityOrder);
org.camunda.bpm.bvis.rest.send.dto.Insurance insurance = parseInsurance(entityOrder);
Order order = parseOrder(cars, insurance, user, entityOrder);
ContractDetailsDTO contractDetails = new ContractDetailsDTO();
contractDetails.setOrder(order);
contractDetails.setProcessinstance_id_bvis(processInstanceID);
System.out.println("SENDING OBJECT SUCCESSFULLY PARSED");
System.out.println("SENDING PARSED OBJECT ORDER ID: " + contractDetails.getOrder().getOrder_id());
RegisterBuiltin.register(ResteasyProviderFactory.getInstance());
ResteasyWebTarget target = new ResteasyClientBuilder().build().target(BASE_URI);
SendInquiryClient senderClient = target.proxy(SendInquiryClient.class);
String result = senderClient.sendInquiry(contractDetails);
return result;
}
示例8: sendContractConfirmation
import org.jboss.resteasy.spi.ResteasyProviderFactory; //導入依賴的package包/類
public String sendContractConfirmation(RentalOrder entityOrder, String processInstanceIDBVIS,
String processInstanceIDCapitol, int contractStatus) {
ContractConfirmationDTO contractConfirmation = new ContractConfirmationDTO();
contractConfirmation.setProcessinstance_id_capitol(processInstanceIDBVIS);
contractConfirmation.setProcessinstance_id_capitol(processInstanceIDCapitol);
ContractConfirmationOrder order = new ContractConfirmationOrder();
order.setOrder_id(entityOrder.getOrderID());
order.setRequest_date(entityOrder.getRequestDate());
order.setContract_status(contractStatus);
contractConfirmation.setOrder(order);
RegisterBuiltin.register(ResteasyProviderFactory.getInstance());
ResteasyWebTarget target = new ResteasyClientBuilder().build().target(BASE_URI);
SendContractConfirmationClient senderClient = target.proxy(SendContractConfirmationClient.class);
String result = senderClient.sendClaim(contractConfirmation);
return result;
}
示例9: ServerRuntime
import org.jboss.resteasy.spi.ResteasyProviderFactory; //導入依賴的package包/類
public ServerRuntime(Options options,
GuiceResteasyBootstrapServletContextListener resteasyContextListener,
SwaggerServletContextListener swaggerContextListener,
HttpServletDispatcher httpServletDispatcher,
SecurityHandler securityHandler,
@Named("system.environment") String environment,
@Named("systemRuntime.resourceDir") String resourceDir) {
this.options = options;
this.resteasyContextListener = resteasyContextListener;
this.swaggerContextListener = swaggerContextListener;
this.httpServletDispatcher = httpServletDispatcher;
this.securityHandler = securityHandler;
this.environment = environment;
this.resourceDir = resourceDir;
RegisterBuiltin.register(ResteasyProviderFactory.getInstance());
}
示例10: getValueInjector
import org.jboss.resteasy.spi.ResteasyProviderFactory; //導入依賴的package包/類
private ValueInjector getValueInjector(Class type, Annotation[] annotations,
ResteasyProviderFactory providerFactory) {
if (FindAnnotation.findAnnotation(annotations, Pac4JProfile.class) != null) {
if (type.equals(Optional.class)) {
return new Pac4JValueInjector(providerFactory, rc -> rc.context()
.flatMap(c -> new RequestCommonProfile(new RequestPac4JSecurityContext(c)).profile()));
} else {
return new Pac4JValueInjector(providerFactory,
rc -> rc.context()
.flatMap(c -> new RequestCommonProfile(new RequestPac4JSecurityContext(c)).profile())
.orElseThrow(() -> {
LOG.debug(
"Cannot inject a Pac4j profile into an unauthenticated request, responding with 401");
return new WebApplicationException(401);
}));
}
} else if (FindAnnotation.findAnnotation(annotations, Pac4JProfileManager.class) != null) {
return new Pac4JValueInjector(providerFactory, c -> new RequestProfileManager(c).profileManager());
} else {
return null;
}
}
示例11: directSecurityContext
import org.jboss.resteasy.spi.ResteasyProviderFactory; //導入依賴的package包/類
@POST
@Path("/securitycontext")
@Pac4JSecurity(clients = "DirectFormClient", authorizers = DefaultAuthorizers.IS_AUTHENTICATED)
public String directSecurityContext() {
// Note: SecurityContext injected via @Context can't be cast
SecurityContext context = ResteasyProviderFactory.getContextData(SecurityContext.class);
if (context != null) {
if (context instanceof Pac4JSecurityContext) {
return "ok";
} else {
return "fail";
}
} else {
return "error";
}
}
示例12: directContext
import org.jboss.resteasy.spi.ResteasyProviderFactory; //導入依賴的package包/類
@POST
@Path("/context")
@Pac4JSecurity(clients = "DirectFormClient", authorizers = DefaultAuthorizers.IS_AUTHENTICATED)
public String directContext() {
SecurityContext scontext = ResteasyProviderFactory.getContextData(SecurityContext.class);
if (scontext != null && scontext instanceof Pac4JSecurityContext) {
JaxRsContext context = ((Pac4JSecurityContext)scontext).getContext();
if (context != null) {
return "ok";
} else {
return "fail";
}
} else {
return "error";
}
}
示例13: getProducts
import org.jboss.resteasy.spi.ResteasyProviderFactory; //導入依賴的package包/類
public static List<String> getProducts(HttpServletRequest request)
{
SkeletonKeySession session = (SkeletonKeySession)request.getAttribute(SkeletonKeySession.class.getName());
ResteasyProviderFactory factory = new ResteasyProviderFactory();
RegisterBuiltin.register(factory);
ResteasyClient client = new ResteasyClientBuilder()
// .providerFactory(factory)
.trustStore(session.getMetadata().getTruststore())
.hostnameVerification(ResteasyClientBuilder.HostnameVerificationPolicy.ANY).build();
try
{
Response response = client.target("https://localhost:8443/database/products").request()
.header(HttpHeaders.AUTHORIZATION, "Bearer " + session.getToken()).get();
return response.readEntity(new GenericType<List<String>>(){});
}
finally
{
client.close();
}
}
示例14: doInit
import org.jboss.resteasy.spi.ResteasyProviderFactory; //導入依賴的package包/類
private void doInit(final ServletConfig servletConfig) throws ServletException {
deployment.start();
servletConfig.getServletContext().setAttribute(ResteasyDeployment.class.getName(), deployment);
super.init(servletConfig);
if (log.isDebugEnabled()) {
ResteasyProviderFactory providerFactory = getDispatcher().getProviderFactory();
log.debug("Provider factory: {}", providerFactory);
log.debug("Configuration: {}", providerFactory.getConfiguration());
log.debug("Runtime type: {}", providerFactory.getRuntimeType());
log.debug("Built-ins registered: {}", providerFactory.isBuiltinsRegistered());
log.debug("Properties: {}", providerFactory.getProperties());
log.debug("Dynamic features: {}", providerFactory.getServerDynamicFeatures());
log.debug("Enabled features: {}", providerFactory.getEnabledFeatures());
log.debug("Class contracts: {}", providerFactory.getClassContracts());
log.debug("Reader interceptor registry: {}", providerFactory.getServerReaderInterceptorRegistry());
log.debug("Writer interceptor registry: {}", providerFactory.getServerWriterInterceptorRegistry());
log.debug("Injector factory: {}", providerFactory.getInjectorFactory());
log.debug("Instances: {}", providerFactory.getInstances());
log.debug("Exception mappers: {}", providerFactory.getExceptionMappers());
}
}
示例15: removeComponent
import org.jboss.resteasy.spi.ResteasyProviderFactory; //導入依賴的package包/類
@Override
public void removeComponent(final BeanEntry<?, ?> entry) throws Exception {
Class<?> type = entry.getImplementationClass();
if (isResource(type)) {
getDispatcher().getRegistry().removeRegistrations(type);
String path = resourcePath(type);
log.debug("Removed resource: {} with path: {}", type.getName(), path);
}
else {
ResteasyProviderFactory providerFactory = getDispatcher().getProviderFactory();
if (providerFactory instanceof SisuResteasyProviderFactory) {
((SisuResteasyProviderFactory) providerFactory).removeRegistrations(type);
log.debug("Removed component: {}", type.getName());
}
else {
log.warn("Component removal not supported; Unable to remove component: {}", type.getName());
}
}
}