Skip to content

This library provides a way to handle UserAgent easily with Akka HTTP using woothee-java

License

Notifications You must be signed in to change notification settings

dakatsuka/akka-http-useragent-support

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

akka-http-useragent-support

Maven Central CircleCI

This library provides a way to handle UserAgent easily with Akka HTTP using woothee-java.

Getting akka-http-useragent-support

akka-http-useragent-support is available in sonatype repository and it targets Akka HTTP 10.0.x. There are scala 2.11 and 2.12 compatible jars available.

libraryDependencies += "com.github.dakatsuka" %% "akka-http-useragent-support" % "0.2.0"

Usage

import com.github.dakatsuka.akka.http.useragent.UserAgentSupport._

val route = path("foo" / "bar") {
  get {
    extractUserAgent { ua =>
      ua.toString  // "Mozilla/5.0 (Windows NT 6.3; WOW64; Trident/7.0; Touch; rv:11.0) like Gecko"
      ua.value     // "Mozilla/5.0 (Windows NT 6.3; WOW64; Trident/7.0; Touch; rv:11.0) like Gecko"
      ua.name      // "Internet Explorer"
      ua.category  // "pc"
      ua.os        // "Windows 8.1"
      ua.version   // "11.0"
      ua.vendor    // Some("Microsoft")
      ua.osVersion // Some("NT 6.3")
    }

    optionalUserAgent {
      case Some(ua) =>
      case None     =>
    }
  }
}

Authors

About

This library provides a way to handle UserAgent easily with Akka HTTP using woothee-java

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages