blackarachnia

package module
v0.0.0-...-af3b5e5 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 30, 2020 License: MIT Imports: 6 Imported by: 0

README

Blackarachnia

           ;               ,
         ,;                 '.
        ;:                   :;
       ::                     ::
       ::                     ::
       ':                     :
        :.                    :
     ;' ::                   ::  '
    .'  ';                   ;'  '.
   ::    :;                 ;:    ::
   ;      :;.             ,;:     ::
   :;      :;:           ,;"      ::
   ::.      ':;  ..,.;  ;:'     ,.;:
    "'"...   '::,::::: ;:   .;.;""'
        '"""....;:::::;,;.;"""
    .:::.....'"':::::::'",...;::::;.
   ;:' '""'"";.,;:::::;.'""""""  ':;
  ::'         ;::;:::;::..         :;
 ::         ,;:::::::::::;:..       ::
 ;'     ,;;:;::::::::::::::;";..    ':.
::     ;:"  ::::::"""'::::::  ":     ::
 :.    ::   ::::::;  :::::::   :     ;
  ;    ::   :::::::  :::::::   :    ;
   '   ::   ::::::....:::::'  ,:   '
    '  ::    :::::::::::::"   ::
       ::     ':::::::::"'    ::
       ':       """""""'      ::
        ::                   ;:
        ':;                 ;:"
-hrr-     ';              ,;'
            "'           '"
 ```            '

Blackarachnia is a Go port of Perl's Web::Machine which is itself ultimately a
port of Erlang's Webmachine.

It is a REST based framework that uses a finite state machine to model the HTTP
request cycle.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewHandler

func NewHandler(res types.Resource) http.HandlerFunc

Types

type ContentHandler

type ContentHandler func(w Response, r *http.Request) bool

type Resource

type Resource struct{}

func (*Resource) AllowMissingPost

func (r *Resource) AllowMissingPost() bool

func (*Resource) AllowedMethods

func (r *Resource) AllowedMethods() []string

func (*Resource) Authorized

func (r *Resource) Authorized(w http.ResponseWriter, auth string) bool

func (*Resource) BaseURI

func (r *Resource) BaseURI() string

func (*Resource) CharsetsProvided

func (r *Resource) CharsetsProvided() []string

func (*Resource) ContentTypesAccepted

func (r *Resource) ContentTypesAccepted() types.HandlerMap

func (*Resource) ContentTypesProvided

func (r *Resource) ContentTypesProvided() types.HandlerMap

func (*Resource) CreatePath

func (r *Resource) CreatePath() string

func (*Resource) DefaultCharset

func (r *Resource) DefaultCharset() string

func (*Resource) DeleteCompleted

func (r *Resource) DeleteCompleted() bool

func (*Resource) DeleteResource

func (r *Resource) DeleteResource() bool

func (*Resource) ETAG

func (r *Resource) ETAG() string

func (*Resource) EncodingsProvided

func (r *Resource) EncodingsProvided() []string

func (*Resource) Exists

func (r *Resource) Exists() bool

func (*Resource) Expires

func (r *Resource) Expires() time.Time

func (*Resource) FinishRequest

func (r *Resource) FinishRequest()

func (*Resource) Forbidden

func (r *Resource) Forbidden() bool

func (*Resource) IsConflict

func (r *Resource) IsConflict() bool

func (*Resource) KnownContentType

func (r *Resource) KnownContentType(c string) bool

func (*Resource) KnownMethods

func (r *Resource) KnownMethods() []string

func (*Resource) LanguagesProvided

func (r *Resource) LanguagesProvided() []string

func (*Resource) LastModified

func (r *Resource) LastModified() time.Time

func (*Resource) Location

func (r *Resource) Location() string

func (*Resource) MalformedRequest

func (r *Resource) MalformedRequest(req *http.Request) bool

func (*Resource) MovedPermanently

func (r *Resource) MovedPermanently() bool

func (*Resource) MovedTemporarily

func (r *Resource) MovedTemporarily() bool

func (*Resource) MultipleChoices

func (r *Resource) MultipleChoices() bool

func (*Resource) Options

func (r *Resource) Options(w http.ResponseWriter)

func (*Resource) PostIsCreate

func (r *Resource) PostIsCreate() bool

func (*Resource) PreviouslyExisted

func (r *Resource) PreviouslyExisted() bool

func (*Resource) ProcessPost

func (r *Resource) ProcessPost(w http.ResponseWriter, req *http.Request) error

func (*Resource) ServiceAvailable

func (r *Resource) ServiceAvailable() bool

func (*Resource) URLTooLong

func (r *Resource) URLTooLong(u *url.URL) bool

func (*Resource) ValidContentHeaders

func (r *Resource) ValidContentHeaders(req *http.Request) bool

func (*Resource) ValidEntityLength

func (r *Resource) ValidEntityLength(length string) bool

func (*Resource) Variances

func (r *Resource) Variances() []string

type Response

type Response struct {
	http.ResponseWriter
	// contains filtered or unexported fields
}

func (*Response) Body

func (r *Response) Body() string

func (*Response) SetCharset

func (r *Response) SetCharset(c string)

func (*Response) Write

func (r *Response) Write(b []byte) (int, error)

Directories

Path Synopsis
yapc-talk-examples
#!perl use strict; use warnings; use Web::Machine; =pod This test shows that the order of content_types_provided is actually important if you do not specify a media-type.
#!perl use strict; use warnings; use Web::Machine; =pod This test shows that the order of content_types_provided is actually important if you do not specify a media-type.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL