Documentation ¶
Overview ¶
HTTP requests and responses that work with files on the server's file system
Index ¶
- func NewRoute(contentRootPath string) http.Route
- type DirectoryListing
- type FileSlice
- type FileSystemRoute
- type LocalResources
- type NonExisting
- type PartialSlice
- type ReadableFile
- type ResourceFactory
- type SliceFactory
- type UnsupportedSlice
- type WholeFile
- type WritableFile
- func (writableFile *WritableFile) Get(client io.Writer, message http.RequestMessage)
- func (writableFile *WritableFile) Head(client io.Writer, message http.RequestMessage)
- func (writableFile *WritableFile) Name() string
- func (writableFile *WritableFile) Patch(client io.Writer, message http.RequestMessage)
- func (writableFile *WritableFile) Put(client io.Writer, message http.RequestMessage)
- type WritableFileRoute
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type DirectoryListing ¶
type DirectoryListing struct { Files []string HrefPrefix string // contains filtered or unexported fields }
Responds with a navigable list of files and directories in a given path
func (*DirectoryListing) Get ¶
func (listing *DirectoryListing) Get(client io.Writer, message http.RequestMessage)
func (*DirectoryListing) Head ¶
func (listing *DirectoryListing) Head(client io.Writer, message http.RequestMessage)
func (*DirectoryListing) Name ¶
func (listing *DirectoryListing) Name() string
type FileSlice ¶
type FileSlice interface { WriteStatus(writer io.Writer) WriteContentHeaders(writer io.Writer) WriteBody(writer io.Writer) }
A view of all/part of a file
type FileSystemRoute ¶
type FileSystemRoute struct { ContentRootPath string Factory ResourceFactory }
func (FileSystemRoute) Route ¶
func (route FileSystemRoute) Route(requested http.RequestMessage) http.Request
type LocalResources ¶
type LocalResources struct{}
Factory for Resources in this package
func (*LocalResources) DirectoryListingResource ¶
func (*LocalResources) DirectoryListingResource(message http.RequestMessage, files []string) http.Resource
func (*LocalResources) ExistingFileResource ¶
func (*LocalResources) ExistingFileResource(message http.RequestMessage, path string) http.Resource
func (*LocalResources) NonExistingResource ¶
func (*LocalResources) NonExistingResource(message http.RequestMessage) http.Resource
type NonExisting ¶
type NonExisting struct { Path string // contains filtered or unexported fields }
A requested file or directory that does not exist at the requested path
func (*NonExisting) Get ¶
func (nonExisting *NonExisting) Get(client io.Writer, message http.RequestMessage)
func (*NonExisting) Head ¶
func (nonExisting *NonExisting) Head(client io.Writer, message http.RequestMessage)
func (*NonExisting) Name ¶
func (nonExisting *NonExisting) Name() string
type PartialSlice ¶
type PartialSlice struct { Path string ContentType string FirstByteIndex int64 LastByteIndex int64 }
A slice of part of a file
func (*PartialSlice) WriteBody ¶
func (slice *PartialSlice) WriteBody(writer io.Writer)
func (*PartialSlice) WriteContentHeaders ¶
func (slice *PartialSlice) WriteContentHeaders(writer io.Writer)
func (*PartialSlice) WriteStatus ¶
func (slice *PartialSlice) WriteStatus(writer io.Writer)
type ReadableFile ¶
type ReadableFile struct {
Filename string
}
An existing file that can be read or patched to an updated version
func (*ReadableFile) Get ¶
func (readableFile *ReadableFile) Get(client io.Writer, message http.RequestMessage)
func (*ReadableFile) Head ¶
func (readableFile *ReadableFile) Head(client io.Writer, message http.RequestMessage)
func (*ReadableFile) Name ¶
func (readableFile *ReadableFile) Name() string
type ResourceFactory ¶
type ResourceFactory interface { DirectoryListingResource(message http.RequestMessage, files []string) http.Resource ExistingFileResource(message http.RequestMessage, path string) http.Resource NonExistingResource(message http.RequestMessage) http.Resource }
type SliceFactory ¶
func (*SliceFactory) SliceCovering ¶
func (factory *SliceFactory) SliceCovering(lowIndex, highIndex int64) FileSlice
type UnsupportedSlice ¶
An attempt to slice that is not supported
func (*UnsupportedSlice) WriteBody ¶
func (slice *UnsupportedSlice) WriteBody(writer io.Writer)
func (*UnsupportedSlice) WriteContentHeaders ¶
func (slice *UnsupportedSlice) WriteContentHeaders(writer io.Writer)
func (*UnsupportedSlice) WriteStatus ¶
func (slice *UnsupportedSlice) WriteStatus(writer io.Writer)
type WholeFile ¶
A slice consisting of the entire file
func (*WholeFile) WriteContentHeaders ¶
func (*WholeFile) WriteStatus ¶
type WritableFile ¶
type WritableFile struct {
Filename string
}
An existing file with read/write access
func (*WritableFile) Get ¶
func (writableFile *WritableFile) Get(client io.Writer, message http.RequestMessage)
func (*WritableFile) Head ¶
func (writableFile *WritableFile) Head(client io.Writer, message http.RequestMessage)
func (*WritableFile) Name ¶
func (writableFile *WritableFile) Name() string
func (*WritableFile) Patch ¶
func (writableFile *WritableFile) Patch(client io.Writer, message http.RequestMessage)
func (*WritableFile) Put ¶
func (writableFile *WritableFile) Put(client io.Writer, message http.RequestMessage)
type WritableFileRoute ¶
type WritableFileRoute struct { UrlPath string FileResource *WritableFile }
func NewWritableFileRoute ¶
func NewWritableFileRoute(urlPath, contentRootPath string) *WritableFileRoute
func (*WritableFileRoute) Route ¶
func (route *WritableFileRoute) Route(requested http.RequestMessage) http.Request
Click to show internal directories.
Click to hide internal directories.