Class THttpService
- java.lang.Object
-
- com.linecorp.armeria.server.AbstractHttpService
-
- com.linecorp.armeria.server.thrift.THttpService
-
- All Implemented Interfaces:
com.linecorp.armeria.server.HttpService,com.linecorp.armeria.server.Service<com.linecorp.armeria.common.HttpRequest,com.linecorp.armeria.common.HttpResponse>
public final class THttpService extends com.linecorp.armeria.server.AbstractHttpServiceAServicethat handles a Thrift call.- See Also:
ThriftProtocolFactories
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description Set<com.linecorp.armeria.common.SerializationFormat>allowedSerializationFormats()Returns the allowed serialization formats of this service.com.linecorp.armeria.common.SerializationFormatdefaultSerializationFormat()Returns the default serialization format of this service.protected com.linecorp.armeria.common.HttpResponsedoPost(com.linecorp.armeria.server.ServiceRequestContext ctx, com.linecorp.armeria.common.HttpRequest req)Map<String,ThriftServiceEntry>entries()Returns the information about the Thrift services being served.static Function<com.linecorp.armeria.server.Service<com.linecorp.armeria.common.RpcRequest,com.linecorp.armeria.common.RpcResponse>,THttpService>newDecorator()Creates a new decorator that supports all thrift protocols and defaults toTBinaryprotocol when the client doesn't specify one.static Function<com.linecorp.armeria.server.Service<com.linecorp.armeria.common.RpcRequest,com.linecorp.armeria.common.RpcResponse>,THttpService>newDecorator(com.linecorp.armeria.common.SerializationFormat defaultSerializationFormat)Creates a new decorator that supports all thrift protocols and defaults to the specifieddefaultSerializationFormatwhen the client doesn't specify one.static Function<com.linecorp.armeria.server.Service<com.linecorp.armeria.common.RpcRequest,com.linecorp.armeria.common.RpcResponse>,THttpService>newDecorator(com.linecorp.armeria.common.SerializationFormat defaultSerializationFormat, com.linecorp.armeria.common.SerializationFormat... otherAllowedSerializationFormats)Creates a new decorator that supports only the formats specified and defaults to the specifieddefaultSerializationFormatwhen the client doesn't specify one.static Function<com.linecorp.armeria.server.Service<com.linecorp.armeria.common.RpcRequest,com.linecorp.armeria.common.RpcResponse>,THttpService>newDecorator(com.linecorp.armeria.common.SerializationFormat defaultSerializationFormat, Iterable<com.linecorp.armeria.common.SerializationFormat> otherAllowedSerializationFormats)Creates a new decorator that supports the protocols specified inallowedSerializationFormatsand defaults to the specifieddefaultSerializationFormatwhen the client doesn't specify one.static THttpServiceof(Object implementation)Creates a newTHttpServicewith the specified service implementation, supporting all thrift protocols and defaulting toTBinaryprotocol when the client doesn't specify one.static THttpServiceof(Object implementation, com.linecorp.armeria.common.SerializationFormat defaultSerializationFormat)Creates a newTHttpServicewith the specified service implementation, supporting all thrift protocols and defaulting to the specifieddefaultSerializationFormatwhen the client doesn't specify one.static THttpServiceof(Map<String,?> implementations)Creates a new multiplexedTHttpServicewith the specified service implementations, supporting all thrift protocols and defaulting toTBinaryprotocol when the client doesn't specify one.static THttpServiceof(Map<String,?> implementations, com.linecorp.armeria.common.SerializationFormat defaultSerializationFormat)Creates a new multiplexedTHttpServicewith the specified service implementations, supporting all thrift protocols and defaulting to the specifieddefaultSerializationFormatwhen the client doesn't specify one.static THttpServiceofFormats(Object implementation, com.linecorp.armeria.common.SerializationFormat defaultSerializationFormat, com.linecorp.armeria.common.SerializationFormat... otherAllowedSerializationFormats)Creates a newTHttpServicewith the specified service implementation, supporting only the formats specified and defaulting to the specifieddefaultSerializationFormatwhen the client doesn't specify one.static THttpServiceofFormats(Object implementation, com.linecorp.armeria.common.SerializationFormat defaultSerializationFormat, Iterable<com.linecorp.armeria.common.SerializationFormat> otherAllowedSerializationFormats)Creates a newTHttpServicewith the specified service implementation, supporting the protocols specified inallowedSerializationFormatsand defaulting to the specifieddefaultSerializationFormatwhen the client doesn't specify one.static THttpServiceofFormats(Map<String,?> implementations, com.linecorp.armeria.common.SerializationFormat defaultSerializationFormat, com.linecorp.armeria.common.SerializationFormat... otherAllowedSerializationFormats)Creates a new multiplexedTHttpServicewith the specified service implementations, supporting only the formats specified and defaulting to the specifieddefaultSerializationFormatwhen the client doesn't specify one.static THttpServiceofFormats(Map<String,?> implementations, com.linecorp.armeria.common.SerializationFormat defaultSerializationFormat, Iterable<com.linecorp.armeria.common.SerializationFormat> otherAllowedSerializationFormats)Creates a new multiplexedTHttpServicewith the specified service implementations, supporting the protocols specified inallowedSerializationFormatsand defaulting to the specifieddefaultSerializationFormatwhen the client doesn't specify one.-
Methods inherited from class com.linecorp.armeria.server.AbstractHttpService
doDelete, doDelete, doGet, doGet, doHead, doHead, doOptions, doOptions, doPatch, doPatch, doPost, doPut, doPut, doTrace, doTrace, serve
-
-
-
-
Method Detail
-
of
public static THttpService of(Object implementation)
Creates a newTHttpServicewith the specified service implementation, supporting all thrift protocols and defaulting toTBinaryprotocol when the client doesn't specify one.Currently, the only way to specify a serialization format is by using the HTTP session protocol and setting the Content-Type header to the appropriate
SerializationFormat.mediaType().- Parameters:
implementation- an implementation of*.Ifaceor*.AsyncIfaceservice interface generated by the Apache Thrift compiler
-
of
public static THttpService of(Map<String,?> implementations)
Creates a new multiplexedTHttpServicewith the specified service implementations, supporting all thrift protocols and defaulting toTBinaryprotocol when the client doesn't specify one.Currently, the only way to specify a serialization format is by using the HTTP session protocol and setting the Content-Type header to the appropriate
SerializationFormat.mediaType().- Parameters:
implementations- aMapwhose key is service name and value is the implementation of*.Ifaceor*.AsyncIfaceservice interface generated by the Apache Thrift compiler
-
of
public static THttpService of(Object implementation, com.linecorp.armeria.common.SerializationFormat defaultSerializationFormat)
Creates a newTHttpServicewith the specified service implementation, supporting all thrift protocols and defaulting to the specifieddefaultSerializationFormatwhen the client doesn't specify one.Currently, the only way to specify a serialization format is by using the HTTP session protocol and setting the Content-Type header to the appropriate
SerializationFormat.mediaType().- Parameters:
implementation- an implementation of*.Ifaceor*.AsyncIfaceservice interface generated by the Apache Thrift compilerdefaultSerializationFormat- the default serialization format to use when not specified by the client
-
of
public static THttpService of(Map<String,?> implementations, com.linecorp.armeria.common.SerializationFormat defaultSerializationFormat)
Creates a new multiplexedTHttpServicewith the specified service implementations, supporting all thrift protocols and defaulting to the specifieddefaultSerializationFormatwhen the client doesn't specify one.Currently, the only way to specify a serialization format is by using the HTTP session protocol and setting the Content-Type header to the appropriate
SerializationFormat.mediaType().- Parameters:
implementations- aMapwhose key is service name and value is the implementation of*.Ifaceor*.AsyncIfaceservice interface generated by the Apache Thrift compilerdefaultSerializationFormat- the default serialization format to use when not specified by the client
-
ofFormats
public static THttpService ofFormats(Object implementation, com.linecorp.armeria.common.SerializationFormat defaultSerializationFormat, com.linecorp.armeria.common.SerializationFormat... otherAllowedSerializationFormats)
Creates a newTHttpServicewith the specified service implementation, supporting only the formats specified and defaulting to the specifieddefaultSerializationFormatwhen the client doesn't specify one.Currently, the only way to specify a serialization format is by using the HTTP session protocol and setting the Content-Type header to the appropriate
SerializationFormat.mediaType().- Parameters:
implementation- an implementation of*.Ifaceor*.AsyncIfaceservice interface generated by the Apache Thrift compilerdefaultSerializationFormat- the default serialization format to use when not specified by the clientotherAllowedSerializationFormats- other serialization formats that should be supported by this service in addition to the default
-
ofFormats
public static THttpService ofFormats(Map<String,?> implementations, com.linecorp.armeria.common.SerializationFormat defaultSerializationFormat, com.linecorp.armeria.common.SerializationFormat... otherAllowedSerializationFormats)
Creates a new multiplexedTHttpServicewith the specified service implementations, supporting only the formats specified and defaulting to the specifieddefaultSerializationFormatwhen the client doesn't specify one.Currently, the only way to specify a serialization format is by using the HTTP session protocol and setting the Content-Type header to the appropriate
SerializationFormat.mediaType().- Parameters:
implementations- aMapwhose key is service name and value is the implementation of*.Ifaceor*.AsyncIfaceservice interface generated by the Apache Thrift compilerdefaultSerializationFormat- the default serialization format to use when not specified by the clientotherAllowedSerializationFormats- other serialization formats that should be supported by this service in addition to the default
-
ofFormats
public static THttpService ofFormats(Object implementation, com.linecorp.armeria.common.SerializationFormat defaultSerializationFormat, Iterable<com.linecorp.armeria.common.SerializationFormat> otherAllowedSerializationFormats)
Creates a newTHttpServicewith the specified service implementation, supporting the protocols specified inallowedSerializationFormatsand defaulting to the specifieddefaultSerializationFormatwhen the client doesn't specify one.Currently, the only way to specify a serialization format is by using the HTTP session protocol and setting the Content-Type header to the appropriate
SerializationFormat.mediaType().- Parameters:
implementation- an implementation of*.Ifaceor*.AsyncIfaceservice interface generated by the Apache Thrift compilerdefaultSerializationFormat- the default serialization format to use when not specified by the clientotherAllowedSerializationFormats- other serialization formats that should be supported by this service in addition to the default
-
ofFormats
public static THttpService ofFormats(Map<String,?> implementations, com.linecorp.armeria.common.SerializationFormat defaultSerializationFormat, Iterable<com.linecorp.armeria.common.SerializationFormat> otherAllowedSerializationFormats)
Creates a new multiplexedTHttpServicewith the specified service implementations, supporting the protocols specified inallowedSerializationFormatsand defaulting to the specifieddefaultSerializationFormatwhen the client doesn't specify one.Currently, the only way to specify a serialization format is by using the HTTP session protocol and setting the Content-Type header to the appropriate
SerializationFormat.mediaType().- Parameters:
implementations- aMapwhose key is service name and value is the implementation of*.Ifaceor*.AsyncIfaceservice interface generated by the Apache Thrift compilerdefaultSerializationFormat- the default serialization format to use when not specified by the clientotherAllowedSerializationFormats- other serialization formats that should be supported by this service in addition to the default
-
newDecorator
public static Function<com.linecorp.armeria.server.Service<com.linecorp.armeria.common.RpcRequest,com.linecorp.armeria.common.RpcResponse>,THttpService> newDecorator()
Creates a new decorator that supports all thrift protocols and defaults toTBinaryprotocol when the client doesn't specify one.Currently, the only way to specify a serialization format is by using the HTTP session protocol and setting the Content-Type header to the appropriate
SerializationFormat.mediaType().
-
newDecorator
public static Function<com.linecorp.armeria.server.Service<com.linecorp.armeria.common.RpcRequest,com.linecorp.armeria.common.RpcResponse>,THttpService> newDecorator(com.linecorp.armeria.common.SerializationFormat defaultSerializationFormat)
Creates a new decorator that supports all thrift protocols and defaults to the specifieddefaultSerializationFormatwhen the client doesn't specify one. Currently, the only way to specify a serialization format is by using the HTTP session protocol and setting the Content-Type header to the appropriateSerializationFormat.mediaType().- Parameters:
defaultSerializationFormat- the default serialization format to use when not specified by the client
-
newDecorator
public static Function<com.linecorp.armeria.server.Service<com.linecorp.armeria.common.RpcRequest,com.linecorp.armeria.common.RpcResponse>,THttpService> newDecorator(com.linecorp.armeria.common.SerializationFormat defaultSerializationFormat, com.linecorp.armeria.common.SerializationFormat... otherAllowedSerializationFormats)
Creates a new decorator that supports only the formats specified and defaults to the specifieddefaultSerializationFormatwhen the client doesn't specify one. Currently, the only way to specify a serialization format is by using the HTTP session protocol and setting the Content-Type header to the appropriateSerializationFormat.mediaType().- Parameters:
defaultSerializationFormat- the default serialization format to use when not specified by the clientotherAllowedSerializationFormats- other serialization formats that should be supported by this service in addition to the default
-
newDecorator
public static Function<com.linecorp.armeria.server.Service<com.linecorp.armeria.common.RpcRequest,com.linecorp.armeria.common.RpcResponse>,THttpService> newDecorator(com.linecorp.armeria.common.SerializationFormat defaultSerializationFormat, Iterable<com.linecorp.armeria.common.SerializationFormat> otherAllowedSerializationFormats)
Creates a new decorator that supports the protocols specified inallowedSerializationFormatsand defaults to the specifieddefaultSerializationFormatwhen the client doesn't specify one. Currently, the only way to specify a serialization format is by using the HTTP session protocol and setting the Content-Type header to the appropriateSerializationFormat.mediaType().- Parameters:
defaultSerializationFormat- the default serialization format to use when not specified by the clientotherAllowedSerializationFormats- other serialization formats that should be supported by this service in addition to the default
-
entries
public Map<String,ThriftServiceEntry> entries()
Returns the information about the Thrift services being served.- Returns:
- a
Mapwhose key is a service name, which could be an empty string if this service is not multiplexed
-
allowedSerializationFormats
public Set<com.linecorp.armeria.common.SerializationFormat> allowedSerializationFormats()
Returns the allowed serialization formats of this service.
-
defaultSerializationFormat
public com.linecorp.armeria.common.SerializationFormat defaultSerializationFormat()
Returns the default serialization format of this service.
-
doPost
protected com.linecorp.armeria.common.HttpResponse doPost(com.linecorp.armeria.server.ServiceRequestContext ctx, com.linecorp.armeria.common.HttpRequest req)- Overrides:
doPostin classcom.linecorp.armeria.server.AbstractHttpService
-
-