StaticFile
object StaticFile
- Source:
- StaticFile.scala
Value members
Concrete methods
augmentString(_$4).nonEmpty))).mkString("/")
defgetResource(`name₂`:String):OptionT[F,URL]=OptionT.apply[F,URL](Sync.apply[F](evidence$3).blocking[Option[URL]](Option.apply[URL](loader.getResource(`name₂`))))
valgzUrl:OptionT[F,URL]=if(tryGzipped)getResource(normalizedName.+(".gz"))elseOptionT.none[F,URL](evidence$3)
gzUrl.flatMap[Response[F]](((url:URL)=>fromURL[F](url,req)(evidence$3).map[Response[F]](((_$5:Response[F])=>_$5.removeHeader[Content-Type](headerInstance).putHeaders(modelledHeadersToRaw[Content-Encoding](Content-Encoding.apply(ContentCoding.gzip))(headerInstance),foldablesToRaw[[A>:Nothing<:Any]=>Option[A],Content-Type](nameToContentType(normalizedName))(catsTraverseForOption,((h:Content-Type)=>modelledHeadersToRaw[Content-Type](h)(headerInstance))))))(evidence$3)))(evidence$3).orElse(getResource(normalizedName).flatMap[Response[F]](((_$6:URL)=>fromURL[F](_$6,req)(evidence$3)))(evidence$3))(evidence$3)
}" class="documentableAnchor">
def augmentString(_$4).nonEmpty))).mkString("/")
defgetResource(`name₂`:String):OptionT[F,URL]=OptionT.apply[F,URL](Sync.apply[F](evidence$3).blocking[Option[URL]](Option.apply[URL](loader.getResource(`name₂`))))
valgzUrl:OptionT[F,URL]=if(tryGzipped)getResource(normalizedName.+(".gz"))elseOptionT.none[F,URL](evidence$3)
gzUrl.flatMap[Response[F]](((url:URL)=>fromURL[F](url,req)(evidence$3).map[Response[F]](((_$5:Response[F])=>_$5.removeHeader[Content-Type](headerInstance).putHeaders(modelledHeadersToRaw[Content-Encoding](Content-Encoding.apply(ContentCoding.gzip))(headerInstance),foldablesToRaw[[A>:Nothing<:Any]=>Option[A],Content-Type](nameToContentType(normalizedName))(catsTraverseForOption,((h:Content-Type)=>modelledHeadersToRaw[Content-Type](h)(headerInstance))))))(evidence$3)))(evidence$3).orElse(getResource(normalizedName).flatMap[Response[F]](((_$6:URL)=>fromURL[F](_$6,req)(evidence$3)))(evidence$3))(evidence$3)
}" class="documentableName ">fromResource[F[_] : Sync](name: String, req: Option[Request[F]], preferGzipped: Boolean, classloader: Option[ClassLoader]): OptionT[F, Response[F]]
- Source:
- StaticFile.scala
_$8.headers.get[If-Modified-Since](singleHeaders[If-Modified-Since](headerInstance))))
valexpired:Boolean=catsSyntaxTuple2Semigroupal[[A>:Nothing<:Any]=>Option[A],If-Modified-Since,HttpDate](Tuple2.apply[Option[If-Modified-Since],Option[HttpDate]](ifModifiedSince,lastmod)).mapN[Boolean](((_$9:If-Modified-Since,_$10:HttpDate)=>_$9.date.<(_$10)))(catsInstancesForOption,catsSemigroupalForOption).getOrElse[Boolean](true)
if(expired){
vallen:Long=urlConn.getContentLengthLong()
valheaders:Headers=Headers.apply(foldablesToRaw[[A>:Nothing<:Any]=>Option[A],Last-Modified](lastmod.map[Last-Modified](((_$11:HttpDate)=>Last-Modified.apply(_$11))))(catsTraverseForOption,((h:Last-Modified)=>modelledHeadersToRaw[Last-Modified](h)(headerInstance))),foldablesToRaw[[A>:Nothing<:Any]=>Option[A],Content-Type](nameToContentType(url.getPath()))(catsTraverseForOption,((`h₂`:Content-Type)=>modelledHeadersToRaw[Content-Type](`h₂`)(headerInstance))),if(len.>=(0))modelledHeadersToRaw[Content-Length](Content-Length.unsafeFromLong(len))(headerInstance)elsemodelledHeadersToRaw[Transfer-Encoding](Transfer-Encoding.apply(catsSyntaxApplicativeId[TransferCoding](TransferCoding.chunked).pure[[A>:Nothing<:Any]=>NonEmptyList[A]](catsDataInstancesForNonEmptyList)))(headerInstance))
catsSyntaxApplicativeError[F,Throwable,InputStream](F.blocking[InputStream](urlConn.getInputStream()))(F).redeem[Option[Response[F]]](recover=((x$1:Throwable)=>x$1match{
case_:FileNotFoundException=>
None
caseother=>
throwother
}),f=((inputStream:InputStream)=>Some.apply[Response[F]]({
valentity$1:Entity[F]=Entity.apply[F](readInputStream[F](F.pure[InputStream](inputStream),DefaultBufferSize,package.readInputStream$default$3[F])(F),Entity.apply$default$2[F])
valstatus$1:Status=Response.apply$default$1[F]
valhttpVersion$1:HttpVersion=Response.apply$default$2[F]
valattributes$1:Vault=Response.apply$default$5[F]
Response.apply[F](status$1,httpVersion$1,headers=headers,entity=entity$1,attributes$1)
})))(F)
}elsetoFunctorOps[F,Unit](catsSyntaxApplicativeError[F,Throwable,Unit](F.blocking[Unit](urlConn.getInputStream().close()))(F).handleError(((_$12:Throwable)=>()))(F))(F).as[Option[Response[F]]](Some.apply[Response[Nothing]](Response.apply[Nothing](NotModified,Response.apply$default$2[Nothing],Response.apply$default$3[Nothing],Response.apply$default$4[Nothing],Response.apply$default$5[Nothing])))
}))
}" class="documentableAnchor">
def _$8.headers.get[If-Modified-Since](singleHeaders[If-Modified-Since](headerInstance))))
valexpired:Boolean=catsSyntaxTuple2Semigroupal[[A>:Nothing<:Any]=>Option[A],If-Modified-Since,HttpDate](Tuple2.apply[Option[If-Modified-Since],Option[HttpDate]](ifModifiedSince,lastmod)).mapN[Boolean](((_$9:If-Modified-Since,_$10:HttpDate)=>_$9.date.<(_$10)))(catsInstancesForOption,catsSemigroupalForOption).getOrElse[Boolean](true)
if(expired){
vallen:Long=urlConn.getContentLengthLong()
valheaders:Headers=Headers.apply(foldablesToRaw[[A>:Nothing<:Any]=>Option[A],Last-Modified](lastmod.map[Last-Modified](((_$11:HttpDate)=>Last-Modified.apply(_$11))))(catsTraverseForOption,((h:Last-Modified)=>modelledHeadersToRaw[Last-Modified](h)(headerInstance))),foldablesToRaw[[A>:Nothing<:Any]=>Option[A],Content-Type](nameToContentType(url.getPath()))(catsTraverseForOption,((`h₂`:Content-Type)=>modelledHeadersToRaw[Content-Type](`h₂`)(headerInstance))),if(len.>=(0))modelledHeadersToRaw[Content-Length](Content-Length.unsafeFromLong(len))(headerInstance)elsemodelledHeadersToRaw[Transfer-Encoding](Transfer-Encoding.apply(catsSyntaxApplicativeId[TransferCoding](TransferCoding.chunked).pure[[A>:Nothing<:Any]=>NonEmptyList[A]](catsDataInstancesForNonEmptyList)))(headerInstance))
catsSyntaxApplicativeError[F,Throwable,InputStream](F.blocking[InputStream](urlConn.getInputStream()))(F).redeem[Option[Response[F]]](recover=((x$1:Throwable)=>x$1match{
case_:FileNotFoundException=>
None
caseother=>
throwother
}),f=((inputStream:InputStream)=>Some.apply[Response[F]]({
valentity$1:Entity[F]=Entity.apply[F](readInputStream[F](F.pure[InputStream](inputStream),DefaultBufferSize,package.readInputStream$default$3[F])(F),Entity.apply$default$2[F])
valstatus$1:Status=Response.apply$default$1[F]
valhttpVersion$1:HttpVersion=Response.apply$default$2[F]
valattributes$1:Vault=Response.apply$default$5[F]
Response.apply[F](status$1,httpVersion$1,headers=headers,entity=entity$1,attributes$1)
})))(F)
}elsetoFunctorOps[F,Unit](catsSyntaxApplicativeError[F,Throwable,Unit](F.blocking[Unit](urlConn.getInputStream().close()))(F).handleError(((_$12:Throwable)=>()))(F))(F).as[Option[Response[F]]](Some.apply[Response[Nothing]](Response.apply[Nothing](NotModified,Response.apply$default$2[Nothing],Response.apply$default$3[Nothing],Response.apply$default$4[Nothing],Response.apply$default$5[Nothing])))
}))
}" class="documentableName ">fromURL[F[_]](url: URL, req: Option[Request[F]])(implicit F: Sync[F]): OptionT[F, Response[F]]
- Source:
- StaticFile.scala