pathprefix("myItem"){
  pathPrefix(Segment){ id =>
    pathEndOrSingleSlash{
     //whatever you want to do 
  }
 }
}

On Monday, 15 June 2015 15:01:39 UTC+5:30, Ivan wrote:
>
> Thanks! I'll read it and see how I can rewrite my services.
>
>
> Am Montag, 15. Juni 2015 03:36:40 UTC+2 schrieb Brian Topping:
>>
>> Hi Ivan,
>>
>> You'll notice that the asyncHandler() code opts to use the "Low-Level 
>> Server-Side API" documented at 
>> http://doc.akka.io/docs/akka-stream-and-http-experimental/1.0-RC3/scala/http/low-level-server-side-api.html.
>>  
>> If you are interested in using directives, you want to use the high level 
>> API, documented at 
>> http://doc.akka.io/docs/akka-stream-and-http-experimental/1.0-RC3/scala/http/routing-dsl/index.html
>> .
>>
>> The longer example on that page has an example of matching with an item 
>> ID in the path.
>>
>> Note these links are to the RC3 versions of the docs, which are immensely 
>> better than the M2 docs you are working with. I would suggest re-reading 
>> from 
>> http://doc.akka.io/docs/akka-stream-and-http-experimental/1.0-RC3/scala/, 
>> there's a lot of new content there. 
>>
>> As far as HTTP is concerned, the list of high level directives is 
>> available at 
>> http://doc.akka.io/docs/akka-stream-and-http-experimental/1.0-RC3/scala/http/routing-dsl/directives/index.html
>> .
>>
>> Hope that helps!
>>
>> Brian
>>
>> On Jun 14, 2015, at 12:46 PM, user123 <[email protected]> wrote:
>>
>> I implemented a simple server following this tutorial: 
>> http://java.dzone.com/articles/building-rest-service-scala
>>
>> Now I want to add a DELETE service, with the pattern /myItem/<idemId>
>>
>> I found there is pattern matching functionality available in akka-http, 
>> using path matchers / directives
>>
>>
>> http://doc.akka.io/docs/akka-stream-and-http-experimental/1.0-M2/scala/http/path-matchers.html
>>
>> http://doc.akka.io/docs/akka-stream-and-http-experimental/1.0-M2/scala/http/directives/path-directives/index.html#pathdirectives
>>
>> But I can't find a way to use this in my implementation. How can I 
>> extract the id with my current implementation (other than splitting the 
>> url). Or do I have to implement differently for this functionality to be 
>> available?
>>
>> Thanks in advance,
>> Ivan
>>
>>
>> -- 
>> >>>>>>>>>> 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 http://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 http://groups.google.com/group/akka-user.
For more options, visit https://groups.google.com/d/optout.

Reply via email to