Safe Haskell | None |
---|---|
Language | Haskell98 |
Synopsis
- data Piece
- toPiece :: Text -> Maybe Piece
- fromPiece :: Piece -> Text
- unsafeToPiece :: Text -> Piece
- type Pieces = [Piece]
- toPieces :: [Text] -> Maybe Pieces
- data MaxAge
- type FolderName = Piece
- data Folder = Folder {}
- data File = File {
- fileGetSize :: Integer
- fileToResponse :: Status -> ResponseHeaders -> Response
- fileName :: Piece
- fileGetHash :: IO (Maybe ByteString)
- fileGetModified :: Maybe EpochTime
- data LookupResult
- type Listing = Pieces -> Folder -> IO Builder
- data StaticSettings = StaticSettings {
- ssLookupFile :: Pieces -> IO LookupResult
- ssGetMimeType :: File -> IO MimeType
- ssIndices :: [Piece]
- ssListing :: Maybe Listing
- ssMaxAge :: MaxAge
- ssMkRedirect :: Pieces -> ByteString -> ByteString
- ssRedirectToIndex :: Bool
- ssUseHash :: Bool
- ssAddTrailingSlash :: Bool
- ss404Handler :: Maybe Application
Pieces
An individual component of a path, or of a filepath.
This is the core type used by wai-app-static for doing lookups. It provides
a smart constructor to avoid the possibility of constructing unsafe path
segments (though unsafeToPiece
can get around that as necessary).
Individual file lookup backends must know how to convert from a Piece
to
their storage system.
toPiece :: Text -> Maybe Piece Source #
Smart constructor for a Piece
. Won't allow unsafe components, such as
pieces beginning with a period or containing a slash. This will, however,
allow null pieces.
unsafeToPiece :: Text -> Piece Source #
Construct a Piece
without input validation.
Caching
Values for the max-age component of the cache-control response header.
NoMaxAge | no cache-control set |
MaxAgeSeconds Int | set to the given number of seconds |
MaxAgeForever | essentially infinite caching; in reality, probably one year |
File/folder serving
type FolderName = Piece Source #
Just the name of a folder.
Represent contents of a single folder, which can be itself either a file or a folder.
Information on an individual file.
File | |
|
data LookupResult Source #
Result of looking up a file in some storage backend.
The lookup is either a file or folder, or does not exist.
type Listing = Pieces -> Folder -> IO Builder Source #
How to construct a directory listing page for the given request path and the resulting folder.
Settings
data StaticSettings Source #
All of the settings available to users for tweaking wai-app-static.
Note that you should use the settings type approach for modifying values. See http://www.yesodweb.com/book/settings-types for more information.
StaticSettings | |
|