All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.wildfly.httpclient.common.HttpServiceConfig Maven / Gradle / Ivy

Go to download

This artifact provides a single jar that contains all classes required to use remote EJB and JMS, including all dependencies. It is intended for use by those not using maven, maven users should just import the EJB and JMS BOM's instead (shaded JAR's cause lots of problems with maven, as it is very easy to inadvertently end up with different versions on classes on the class path).

There is a newer version: 34.0.0.Final
Show newest version
/*
 * JBoss, Home of Professional Open Source.
 * Copyright 2022 Red Hat, Inc., and individual contributors
 * as indicated by the @author tags.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *       http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package org.wildfly.httpclient.common;

import io.undertow.server.HttpHandler;
import io.undertow.server.HttpServerExchange;

import java.util.function.Function;

/**
 * Mode configuration for http services.
 * 

* The http services are internal server services responsible for handling client requests, and they are * simple pojos conventionally named Http*Service. * * @author Flavia Rainone */ public enum HttpServiceConfig { /** * Default configuration. Used by both EE namespace interoperable and non-interoperable servers */ DEFAULT (EENamespaceInteroperability::createInteroperabilityHandler, EENamespaceInteroperability.getHttpMarshallerFactoryProvider()); /** * Returns the default configuration. * * @return the configuration for http services */ public static HttpServiceConfig getInstance() { return DEFAULT; } private final Function handlerWrapper; private final HttpMarshallerFactoryProvider marshallerFactoryProvider; HttpServiceConfig(Function handlerWrapper, HttpMarshallerFactoryProvider marshallerFactoryProvider) { this.handlerWrapper = handlerWrapper; this.marshallerFactoryProvider = marshallerFactoryProvider; } /** * Wraps the http service handler. Should be applied to all http handlers configured by * a http service. * * @param handler responsible for handling the HTTP service requests directed to a specific * URI * @return the HttpHandler that should be provided to Undertow and associated with the HTTP * service URI. The resulting handler is a wrapper that will add any necessary actions * before invoking the inner {@code handler}. */ public HttpHandler wrap(HttpHandler handler) { return handlerWrapper.apply(handler); } /** * Returns the http marshaller factory that must be used for unmarshalling the objects * from service requests bytes. * * @param exchange the server exchange * @return the HTTP marshaller factory for unmarshalling server request objects */ public HttpMarshallerFactory getHttpUnmarshallerFactory(HttpServerExchange exchange) { return marshallerFactoryProvider.getUnmarshallerFactory(exchange); } /** * Returns the http marshaller factory that must be used for marshalling the service * responses as bytes to be sent as a server response data. * * @param exchange the server exchange * @return the HTTP marshaller factory for marshalling server responses */ public HttpMarshallerFactory getHttpMarshallerFactory(HttpServerExchange exchange) { return marshallerFactoryProvider.getMarshallerFactory(exchange); } }





© 2015 - 2024 Weber Informatics LLC | Privacy Policy