Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Fix gzip output and scalate

  • Loading branch information...
commit 9e0c57ba4b5d2594a4fc14b553d89b4bbc8fbab9 2 parents 4f7f91b + 8020633
@casualjim casualjim authored
View
1  common/src/main/scala/org/scalatra/servlet/HasMultipartConfig.scala
@@ -48,4 +48,3 @@ trait HasMultipartConfig extends Initializable { self: { def servletContext: Ser
providedConfig = Some(config)
}
}
-
View
6 core/src/main/scala/org/scalatra/FutureSupport.scala
@@ -39,20 +39,20 @@ trait FutureSupport extends AsyncSupport {
override protected def isAsyncExecutable(result: Any) =
classOf[Future[_]].isAssignableFrom(result.getClass) ||
- classOf[AsyncResult].isAssignableFrom(result.getClass)
+ classOf[AsyncResult].isAssignableFrom(result.getClass)
override protected def renderResponse(actionResult: Any) {
actionResult match {
case r: AsyncResult
val req = request
- setMultiparams(matchedRoute(req), multiParams(req))
+ setMultiparams(matchedRoute(req), multiParams(req))(req)
val prelude = new AsyncResult {
val is: Future[_] = Future { setMultiparams(matchedRoute, multiParams) }
}
handleFuture(prelude.is flatMap (_ => r.is) , r.timeout)
case f: Future[_]
val req = request
- setMultiparams(matchedRoute(req), multiParams(req))
+ setMultiparams(matchedRoute(req), multiParams(req))(req)
handleFuture(Future { setMultiparams(matchedRoute(req), multiParams(req))(req) } flatMap (_ => f), asyncTimeout)
case a super.renderResponse(a)
}
View
17 core/src/main/scala/org/scalatra/ScalatraBase.scala
@@ -139,7 +139,6 @@ trait ScalatraBase extends ScalatraContext with CoreDsl with DynamicScope with I
* $ 5. The action result is passed to `renderResponse`.
*/
protected def executeRoutes() {
-
var result: Any = null
var rendered = true
@@ -374,15 +373,18 @@ trait ScalatraBase extends ScalatraContext with CoreDsl with DynamicScope with I
* @see #renderPipeline
*/
protected def renderResponseBody(actionResult: Any) {
+ @tailrec def loop(ar: Any): Any = ar match {
+ case _: Unit | Unit => runRenderCallbacks(Success(actionResult))
+ case a => loop(renderPipeline.lift(a) getOrElse())
+ }
try {
- runCallbacks(Success(actionResult))
- @tailrec def loop(ar: Any): Any = ar match {
- case _: Unit | Unit => runRenderCallbacks(Success(actionResult))
- case a => loop(renderPipeline.lift(a) getOrElse())
- }
loop(actionResult)
+ runCallbacks(Success(actionResult))
} catch {
- case e: Throwable => renderUncaughtException(e)
+ case e: Throwable =>
+ runCallbacks(Failure(e))
+ renderUncaughtException(e)
+ runCallbacks(Failure(e))
}
}
@@ -489,6 +491,7 @@ trait ScalatraBase extends ScalatraContext with CoreDsl with DynamicScope with I
case e: Throwable =>
runCallbacks(Failure(e))
renderUncaughtException(e)
+ runCallbacks(Failure(e))
}
}

0 comments on commit 9e0c57b

Please sign in to comment.
Something went wrong with that request. Please try again.