- Value parameters:
- basePath
prefix of the path files will be served from
- bufferSize
size hint of internal buffers to use when serving resources
- cacheStrategy
strategy to use for caching purposes.
- classLoader
optional classloader for extracting the resources
- pathPrefix
prefix of the Uri that content will be served from
- preferGzipped
whether to serve pre-gzipped files (with extension ".gz") if they exist
- Companion:
- object
Value members
Concrete methods
TranslateUri.apply[[_$7>:Nothing<:Any]=>OptionT[F,_$7],F,Response[F]](pathPrefix)(Kleisli.apply[[_$7>:Nothing<:Any]=>OptionT[F,_$7],Request[F],Response[F]](((x$1:Request[F])=>x$1match{
caserequestifrequest.pathInfo.nonEmpty=>
valsegments:Vector[String]=request.pathInfo.segments.map[String](((_$2:Segment)=>_$2.decoded(_$2.decoded$default$1,plusIsSpace=true,_$2.decoded$default$3)))
catsSyntaxApplicativeError[[A>:Nothing<:Any]=>OptionT[F,A],Throwable,Response[F]](OptionT.liftF[F,Path](F.catchNonFatal[Path](segments.foldLeft[Path](rootPath)(((`x$1₂`:Path,x$2:String)=>Tuple2.apply[Path,String](`x$1₂`,x$2)match{
caseTuple2(_,(""|"."|".."))=>
throwBadTraversal
caseTuple2(path,segment)=>
path.resolve(segment)
})))(refl[Throwable]))(F).collect[Path](((`x$1₃`:Path)=>(`x$1₃`:@unchecked)match{
casepathif`path₂`.startsWith(rootPath)=>
(`path₂`:Path)
}))(F).flatMap[Response[F]](((`path₃`:Path)=>StaticFile.fromResource[F](`path₃`.toString(),Some.apply[Request[F]](request),preferGzipped=preferGzipped,classLoader)(F)))(F).semiflatMap[Response[F]](((_$3:Response[F])=>cacheStrategy.cache(request.pathInfo,_$3)(F)))(F))(catsDataMonadErrorForOptionT[F,Throwable](F)).recoverWith(((`x$1₄`:Throwable)=>(`x$1₄`:@unchecked)match{
caseBadTraversal=>
OptionT.some[F].apply[Response[F]](Response.apply[F](Status.BadRequest,Response.apply$default$2[F],Response.apply$default$3[F],Response.apply$default$4[F],Response.apply$default$5[F]))(F)
}))(catsDataMonadErrorForOptionT[F,Throwable](F))
case_=>
OptionT.none[F,Response[F]](F)
})))(catsDataMonoidKForOptionT[F](F))
caseFailure(e)=>
ResourceServiceBuilder.this.logger.error(e)(_root_.scala.StringContext.apply("CouldnotgetrootpathfromResourceServiceconfig:basePath=",",pathPrefix=",".Allrequestswillfail.").s(basePath,pathPrefix))
Kleisli.apply[[_$7>:Nothing<:Any]=>OptionT[F,_$7],Request[F],Response[F]](((_$4:Request[F])=>OptionT.pure[F].apply[Response[F]](Response.apply[F](Status.InternalServerError,Response.apply$default$2[F],Response.apply$default$3[F],Response.apply$default$4[F],Response.apply$default$5[F]))(F)))
}
}" class="documentableAnchor">
def
TranslateUri.apply[[_$7>:Nothing<:Any]=>OptionT[F,_$7],F,Response[F]](pathPrefix)(Kleisli.apply[[_$7>:Nothing<:Any]=>OptionT[F,_$7],Request[F],Response[F]](((x$1:Request[F])=>x$1match{
caserequestifrequest.pathInfo.nonEmpty=>
valsegments:Vector[String]=request.pathInfo.segments.map[String](((_$2:Segment)=>_$2.decoded(_$2.decoded$default$1,plusIsSpace=true,_$2.decoded$default$3)))
catsSyntaxApplicativeError[[A>:Nothing<:Any]=>OptionT[F,A],Throwable,Response[F]](OptionT.liftF[F,Path](F.catchNonFatal[Path](segments.foldLeft[Path](rootPath)(((`x$1₂`:Path,x$2:String)=>Tuple2.apply[Path,String](`x$1₂`,x$2)match{
caseTuple2(_,(""|"."|".."))=>
throwBadTraversal
caseTuple2(path,segment)=>
path.resolve(segment)
})))(refl[Throwable]))(F).collect[Path](((`x$1₃`:Path)=>(`x$1₃`:@unchecked)match{
casepathif`path₂`.startsWith(rootPath)=>
(`path₂`:Path)
}))(F).flatMap[Response[F]](((`path₃`:Path)=>StaticFile.fromResource[F](`path₃`.toString(),Some.apply[Request[F]](request),preferGzipped=preferGzipped,classLoader)(F)))(F).semiflatMap[Response[F]](((_$3:Response[F])=>cacheStrategy.cache(request.pathInfo,_$3)(F)))(F))(catsDataMonadErrorForOptionT[F,Throwable](F)).recoverWith(((`x$1₄`:Throwable)=>(`x$1₄`:@unchecked)match{
caseBadTraversal=>
OptionT.some[F].apply[Response[F]](Response.apply[F](Status.BadRequest,Response.apply$default$2[F],Response.apply$default$3[F],Response.apply$default$4[F],Response.apply$default$5[F]))(F)
}))(catsDataMonadErrorForOptionT[F,Throwable](F))
case_=>
OptionT.none[F,Response[F]](F)
})))(catsDataMonoidKForOptionT[F](F))
caseFailure(e)=>
ResourceServiceBuilder.this.logger.error(e)(_root_.scala.StringContext.apply("CouldnotgetrootpathfromResourceServiceconfig:basePath=",",pathPrefix=",".Allrequestswillfail.").s(basePath,pathPrefix))
Kleisli.apply[[_$7>:Nothing<:Any]=>OptionT[F,_$7],Request[F],Response[F]](((_$4:Request[F])=>OptionT.pure[F].apply[Response[F]](Response.apply[F](Status.InternalServerError,Response.apply$default$2[F],Response.apply$default$3[F],Response.apply$default$4[F],Response.apply$default$5[F]))(F)))
}
}" class="documentableName ">toRoutes(implicit F: Async[F]): HttpRoutes[F]