how to use scala spray detach?

后端 未结 1 970
梦毁少年i
梦毁少年i 2021-01-27 07:45

i\'m trying to use spray detach as following:

path(\"\") {
  get {
    detach {
      respondWithMediaType(`text/html`) { // XML is marshalled to `text/xml` by d         


        
相关标签:
1条回答
  • 2021-01-27 08:02

    You are looking at a deprecated documentation. If you to want to read the current documentation you have to look at the spray.io website.

    Regarding your problem, the current documentation specifies a different signature for the detach directive - see here

    def detach()(implicit ec: ExecutionContext): Directive0
    def detach()(implicit refFactory: ActorRefFactory): Directive0
    def detach(ec: ExecutionContext): Directive0
    

    As you are passing your ExecutionContext implicitly I guess, you have to write the parenthesis:

    detach() {
      respondWithMediaType(`text/html`) { // XML is marshalled to `text/xml` by default, so we simply override here
        complete { ...
    
    0 讨论(0)
提交回复
热议问题