Class Marshaller<A,​B>


  • public abstract class Marshaller<A,​B>
    extends java.lang.Object
    • Constructor Detail

      • Marshaller

        public Marshaller()
    • Method Detail

      • strict

        public static <A,​B> Marshaller<A,​B> strict​(scala.Function1<A,​Marshalling<B>> f)
        Helper for creating a Marshaller using the given function.
        Parameters:
        f - (undocumented)
        Returns:
        (undocumented)
      • oneOf

        public static <A,​B> Marshaller<A,​B> oneOf​(scala.collection.immutable.Seq<Marshaller<A,​B>> marshallers)
        Helper for creating a "super-marshaller" from a number of "sub-marshallers". Content-negotiation determines, which "sub-marshaller" eventually gets to do the job.

        Please note that all marshallers will actually be invoked in order to get the Marshalling object out of them, and later decide which of the marshallings should be returned. This is by-design, however in ticket as discussed in ticket https://github.com/akka/akka-http/issues/243 it MAY be changed in later versions of Akka HTTP.

        Parameters:
        marshallers - (undocumented)
        Returns:
        (undocumented)
      • oneOf

        public static <T,​A,​B> Marshaller<A,​B> oneOf​(scala.collection.immutable.Seq<T> values,
                                                                      scala.Function1<T,​Marshaller<A,​B>> f)
        Helper for creating a "super-marshaller" from a number of values and a function producing "sub-marshallers" from these values. Content-negotiation determines, which "sub-marshaller" eventually gets to do the job.

        Please note that all marshallers will actually be invoked in order to get the Marshalling object out of them, and later decide which of the marshallings should be returned. This is by-design, however in ticket as discussed in ticket https://github.com/akka/akka-http/issues/243 it MAY be changed in later versions of Akka HTTP.

        Parameters:
        values - (undocumented)
        f - (undocumented)
        Returns:
        (undocumented)
      • withFixedContentType

        public static <A,​B> Marshaller<A,​B> withFixedContentType​(ContentType contentType,
                                                                             scala.Function1<A,​B> marshal)
        Helper for creating a synchronous Marshaller to content with a fixed charset from the given function.
        Parameters:
        contentType - (undocumented)
        marshal - (undocumented)
        Returns:
        (undocumented)
      • withOpenCharset

        public static <A,​B> Marshaller<A,​B> withOpenCharset​(MediaType.WithOpenCharset mediaType,
                                                                        scala.Function2<A,​HttpCharset,​B> marshal)
        Helper for creating a synchronous Marshaller to content with a negotiable charset from the given function.
        Parameters:
        mediaType - (undocumented)
        marshal - (undocumented)
        Returns:
        (undocumented)
      • opaque

        public static <A,​B> Marshaller<A,​B> opaque​(scala.Function1<A,​B> marshal)
        Helper for creating a synchronous Marshaller to non-negotiable content from the given function.
        Parameters:
        marshal - (undocumented)
        Returns:
        (undocumented)
      • combined

        public static <A,​B,​C> Marshaller<A,​C> combined​(scala.Function1<A,​B> marshal,
                                                                         Marshaller<B,​C> m2)
        Helper for creating a Marshaller combined of the provided marshal function and an implicit Marshaller which is able to produce the required final type.
        Parameters:
        marshal - (undocumented)
        m2 - (undocumented)
        Returns:
        (undocumented)
      • fromEntityStreamingSupportAndByteStringSourceMarshaller

        public static <T,​M> Marshaller<akka.stream.scaladsl.Source<T,​M>,​HttpResponse> fromEntityStreamingSupportAndByteStringSourceMarshaller​(EntityStreamingSupport s,
                                                                                                                                                                Marshaller<T,​akka.stream.scaladsl.Source<akka.util.ByteString,​?>> m,
                                                                                                                                                                scala.reflect.ClassTag<T> evidence$2)
      • throwableMarshaller

        public static <T> Marshaller<java.lang.Throwable,​T> throwableMarshaller()
      • eitherMarshaller

        public static <A1,​A2,​B> Marshaller<scala.util.Either<A1,​A2>,​B> eitherMarshaller​(Marshaller<A1,​B> m1,
                                                                                                                Marshaller<A2,​B> m2)
      • futureMarshaller

        public static <A,​B> Marshaller<scala.concurrent.Future<A>,​B> futureMarshaller​(Marshaller<A,​B> m)
      • tryMarshaller

        public static <A,​B> Marshaller<scala.util.Try<A>,​B> tryMarshaller​(Marshaller<A,​B> m)
      • multipartMarshaller$default$1

        public static <T extends Multipart> akka.event.LoggingAdapter multipartMarshaller$default$1()
      • multipartBoundaryRandom

        protected static java.util.Random multipartBoundaryRandom()
      • multipartBoundaryLength

        protected static int multipartBoundaryLength()
      • randomBoundary

        protected static java.lang.String randomBoundary()
      • akka$http$scaladsl$marshalling$PredefinedToEntityMarshallers$_setter_$ByteArrayMarshaller_$eq

        protected abstract static void akka$http$scaladsl$marshalling$PredefinedToEntityMarshallers$_setter_$ByteArrayMarshaller_$eq​(Marshaller<byte[],​RequestEntity> x$1)
      • akka$http$scaladsl$marshalling$PredefinedToEntityMarshallers$_setter_$ByteStringMarshaller_$eq

        protected abstract static void akka$http$scaladsl$marshalling$PredefinedToEntityMarshallers$_setter_$ByteStringMarshaller_$eq​(Marshaller<akka.util.ByteString,​RequestEntity> x$1)
      • akka$http$scaladsl$marshalling$PredefinedToEntityMarshallers$_setter_$CharArrayMarshaller_$eq

        protected abstract static void akka$http$scaladsl$marshalling$PredefinedToEntityMarshallers$_setter_$CharArrayMarshaller_$eq​(Marshaller<char[],​RequestEntity> x$1)
      • akka$http$scaladsl$marshalling$PredefinedToEntityMarshallers$_setter_$DoneMarshaller_$eq

        protected abstract static void akka$http$scaladsl$marshalling$PredefinedToEntityMarshallers$_setter_$DoneMarshaller_$eq​(Marshaller<akka.Done,​RequestEntity> x$1)
      • akka$http$scaladsl$marshalling$PredefinedToEntityMarshallers$_setter_$StringMarshaller_$eq

        protected abstract static void akka$http$scaladsl$marshalling$PredefinedToEntityMarshallers$_setter_$StringMarshaller_$eq​(Marshaller<java.lang.String,​RequestEntity> x$1)
      • akka$http$scaladsl$marshalling$PredefinedToEntityMarshallers$_setter_$FormDataMarshaller_$eq

        protected abstract static void akka$http$scaladsl$marshalling$PredefinedToEntityMarshallers$_setter_$FormDataMarshaller_$eq​(Marshaller<FormData,​RequestEntity> x$1)
      • akka$http$scaladsl$marshalling$PredefinedToEntityMarshallers$_setter_$MessageEntityMarshaller_$eq

        protected abstract static void akka$http$scaladsl$marshalling$PredefinedToEntityMarshallers$_setter_$MessageEntityMarshaller_$eq​(Marshaller<RequestEntity,​RequestEntity> x$1)
      • fromToEntityMarshaller$default$1

        public static <T> StatusCode fromToEntityMarshaller$default$1()
      • fromToEntityMarshaller$default$2

        public static <T> scala.collection.immutable.Seq<HttpHeader> fromToEntityMarshaller$default$2()
      • fromEntityStreamingSupportAndByteStringMarshaller

        public static <T,​M> Marshaller<akka.stream.scaladsl.Source<T,​M>,​HttpResponse> fromEntityStreamingSupportAndByteStringMarshaller​(scala.reflect.ClassTag<T> evidence$1,
                                                                                                                                                          EntityStreamingSupport s,
                                                                                                                                                          Marshaller<T,​akka.util.ByteString> m)
      • akka$http$scaladsl$marshalling$PredefinedToResponseMarshallers$_setter_$fromResponse_$eq

        protected abstract static void akka$http$scaladsl$marshalling$PredefinedToResponseMarshallers$_setter_$fromResponse_$eq​(Marshaller<HttpResponse,​HttpResponse> x$1)
      • akka$http$scaladsl$marshalling$PredefinedToResponseMarshallers$_setter_$fromStatusCode_$eq

        protected abstract static void akka$http$scaladsl$marshalling$PredefinedToResponseMarshallers$_setter_$fromStatusCode_$eq​(Marshaller<StatusCode,​HttpResponse> x$1)
      • akka$http$scaladsl$marshalling$PredefinedToResponseMarshallers$_setter_$fromStatusCodeAndHeaders_$eq

        protected abstract static void akka$http$scaladsl$marshalling$PredefinedToResponseMarshallers$_setter_$fromStatusCodeAndHeaders_$eq​(Marshaller<scala.Tuple2<StatusCode,​scala.collection.immutable.Seq<HttpHeader>>,​HttpResponse> x$1)
      • akka$http$scaladsl$marshalling$PredefinedToRequestMarshallers$_setter_$fromRequest_$eq

        protected abstract static void akka$http$scaladsl$marshalling$PredefinedToRequestMarshallers$_setter_$fromRequest_$eq​(Marshaller<HttpRequest,​HttpRequest> x$1)
      • apply

        public abstract scala.concurrent.Future<scala.collection.immutable.List<Marshalling<B>>> apply​(A value,
                                                                                                       scala.concurrent.ExecutionContext ec)
      • map

        public <C> Marshaller<A,​C> map​(scala.Function1<B,​C> f)
      • wrap

        public <C,​D> Marshaller<C,​D> wrap​(MediaType newMediaType,
                                                      scala.Function1<C,​A> f,
                                                      ContentTypeOverrider<D> mto)
        Reuses this Marshaller's logic to produce a new Marshaller from another type C which overrides the MediaType of the marshalling result with the given one. Note that not all wrappings are legal. f the underlying MediaType has constraints with regard to the charsets it allows the new MediaType must be compatible, since akka-http will never recode entities. If the wrapping is illegal the Future produced by the resulting marshaller will contain a RuntimeException.
        Parameters:
        newMediaType - (undocumented)
        f - (undocumented)
        mto - (undocumented)
        Returns:
        (undocumented)
      • wrapWithEC

        public <C,​D> Marshaller<C,​D> wrapWithEC​(MediaType newMediaType,
                                                            scala.Function1<scala.concurrent.ExecutionContext,​scala.Function1<C,​A>> f,
                                                            ContentTypeOverrider<D> cto)
        Reuses this Marshaller's logic to produce a new Marshaller from another type C which overrides the MediaType of the marshalling result with the given one. Note that not all wrappings are legal. f the underlying MediaType has constraints with regard to the charsets it allows the new MediaType must be compatible, since akka-http will never recode entities. If the wrapping is illegal the Future produced by the resulting marshaller will contain a RuntimeException.
        Parameters:
        newMediaType - (undocumented)
        f - (undocumented)
        cto - (undocumented)
        Returns:
        (undocumented)
      • compose

        public <C> Marshaller<C,​B> compose​(scala.Function1<C,​A> f)
      • composeWithEC

        public <C> Marshaller<C,​B> composeWithEC​(scala.Function1<scala.concurrent.ExecutionContext,​scala.Function1<C,​A>> f)