title: Routing design in Spray
body: <p>I'm trying to make a rest service for profile management. So i have the following uri for profiles:</p>
  
  <pre><code>host/profile/id123123/:action
  </code></pre>
  
  <p>But there are different profile types, for different users with different dashboards, so i want to extract <code>profileType</code> and <code>id</code> as the top path and work with different actions under this. I've tried to write it in DRY way:</p>
  
  <pre><code>path(Segment / "id" ~ Segment) { (profileType, id) ⇒
    get {
      profileType match {
        case "admin" ⇒ loadProfilePage[Admin](id)
      }
    } ~
    path("update") {
      complete("Profile updated")
    }
  }
  </code></pre>
  
  <p>But if i type the following in the address bar:</p>
  
  <pre><code>localhost/admin/id123123/update
  </code></pre>
  
  <p>It throws server exception. What's the problem?</p>