Play Framework: how to get current request in custom BodyParser

Considering the following body parser that saves incoming files to MongoDB ...

fsBodyParser()(
  implicit gridFsService: GridFsService
): BodyParser[MultipartFormData[Future[MetaFile]]] = {
  import BodyParsers.parse._

  multipartFormData(
    Multipart.handleFilePart {
      case Multipart.FileInfo(partName, filename, contentType) =>
        gridFsService.iteratee(filename, contentType)
    }
  ) 
}

...

def saveFile = SecureAction.async(fsBodyParser) { implicit request =>

  ...
}

      

how to get the current request in fsBodyParser

?

+3


source to share





All Articles