I just knew I was running in circles, thanks!
On Monday, January 8, 2018 at 11:15:18 AM UTC-6, Konrad Malawski wrote:
>
> You can deconstruct the data structure on your own like this:
>
> val tag = EntityTag("kappa", weak = true)
> val ifNoneMatch = `If-None-Match`(tag)
>
> ifNoneMatch.m match {
> case EntityTagRange.Default(tags) if tags.nonEmpty ⇒ tags.head.tag
> case EntityTagRange.Default(tags) ⇒ ""
> case EntityTagRange.`*` ⇒ ""
> }
>
>
> ifNoneMatch match {
> case `If-None-Match`(EntityTagRange.Default(tags)) if tags.nonEmpty ⇒
> tags.head.tag
> case `If-None-Match`(EntityTagRange.Default(tags)) ⇒ ""
> case `If-None-Match`(EntityTagRange.`*`) ⇒ ""
> }
>
>
> Happy hakking
> --
> Cheers,
> Konrad 'ktoso <http://kto.so>' Malawski
> Akka <http://akka.io/> @ Lightbend <http://lightbend.com/>
>
> On January 9, 2018 at 2:04:33, Colin Bester ([email protected]
> <javascript:>) wrote:
>
> On server side using scala, akka-http (10.x) I am using
> *optionalHeaderValueByType[`If-None-Match`]()
> { reqETag => ... }* to extract `If-None-Match` header where reqETag is of
> type *Option[If-None-Match].*
>
> On client side, the If-None-Match is created using
>
> val entityTag = EntityTag(SomeSecurishString, weak = true)
> val ifNone = `If-None-Match`(entityTag)
>
> On the server side I am looking to extract SomeSecureString, ie. the tag
> value minus the prepended W/. I realize this can be done by
> parsing/splitting value string but this feels real cumbersome and was
> expecting an unapply function to come to the rescue.
>
>
> *`If-None-Match`.unapply* returns EntityTagRange which doesn't help me
> much.
>
> Any suggestions on how to extract the EntityTag's tag string from
> `If-None-Match`
>
> Much appreciated
> --
> >>>>>>>>>> Read the docs: http://akka.io/docs/
> >>>>>>>>>> Check the FAQ:
> http://doc.akka.io/docs/akka/current/additional/faq.html
> >>>>>>>>>> Search the archives: https://groups.google.com/group/akka-user
> ---
> You received this message because you are subscribed to the Google Groups
> "Akka User List" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected] <javascript:>.
> To post to this group, send email to [email protected]
> <javascript:>.
> Visit this group at https://groups.google.com/group/akka-user.
> For more options, visit https://groups.google.com/d/optout.
>
>
--
>>>>>>>>>> Read the docs: http://akka.io/docs/
>>>>>>>>>> Check the FAQ:
>>>>>>>>>> http://doc.akka.io/docs/akka/current/additional/faq.html
>>>>>>>>>> Search the archives: https://groups.google.com/group/akka-user
---
You received this message because you are subscribed to the Google Groups "Akka
User List" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/akka-user.
For more options, visit https://groups.google.com/d/optout.