Documentation ¶
Index ¶
- Constants
- Variables
- type Controller
- type DefaultErrorHandler
- type ErrorHandler
- type HTTPError
- type HandlerChain
- type HandlerFunction
- type HandlerInterceptor
- type HandlerInterceptorAfter
- type HandlerInterceptorAfterCompletion
- type HandlerInterceptorBefore
- type HandlerInterceptorProcessor
- type HandlerInterceptorRegistry
- type HandlerMapping
- type HandlerRegistry
- type MappingRegistry
- type MediaType
- type PathVariable
- type ProcyonRouter
- type ProcyonServerApplicationContext
- type ProcyonWebServer
- type RequestBinder
- type RequestHandler
- func Delete(handler RequestHandlerFunction, options ...RequestHandlerOption) RequestHandler
- func Get(handler RequestHandlerFunction, options ...RequestHandlerOption) RequestHandler
- func Head(handler RequestHandlerFunction, options ...RequestHandlerOption) RequestHandler
- func Options(handler RequestHandlerFunction, options ...RequestHandlerOption) RequestHandler
- func Patch(handler RequestHandlerFunction, options ...RequestHandlerOption) RequestHandler
- func Post(handler RequestHandlerFunction, options ...RequestHandlerOption) RequestHandler
- func Put(handler RequestHandlerFunction, options ...RequestHandlerOption) RequestHandler
- type RequestHandlerFunction
- type RequestHandlerMapping
- type RequestHandlerMappingProcessor
- type RequestHandlerObject
- type RequestHandlerOption
- type RequestMappingRegistry
- type RequestMethod
- type RequestObjectCache
- type RequestObjectMetadata
- type Response
- type ResponseBodyBuilder
- type ResponseBodyWriter
- type ResponseEntity
- type ResponseHeaderBuilder
- type ResponseWriter
- type Router
- type RouterMethodTree
- type RouterNodeType
- type RouterPathNode
- type RouterTree
- type Server
- type SimpleHandlerInterceptorRegistry
- func (registry *SimpleHandlerInterceptorRegistry) GetHandlerAfterCompletionInterceptors() []HandlerInterceptor
- func (registry *SimpleHandlerInterceptorRegistry) GetHandlerAfterInterceptors() []HandlerInterceptor
- func (registry *SimpleHandlerInterceptorRegistry) GetHandlerBeforeInterceptors() []HandlerInterceptor
- func (registry *SimpleHandlerInterceptorRegistry) RegisterHandlerInterceptor(interceptor interface{})
- type SimpleHandlerRegistry
- type StandardWebEnvironment
- type Validator
- type WebRequestContext
- func (ctx *WebRequestContext) Accepted() ResponseBodyBuilder
- func (ctx *WebRequestContext) AddResponseHeader(key string, value string) ResponseHeaderBuilder
- func (ctx *WebRequestContext) BadRequest() ResponseBodyBuilder
- func (ctx *WebRequestContext) BindRequest(request interface{}) error
- func (ctx *WebRequestContext) Cancel()
- func (ctx *WebRequestContext) Created(location string) ResponseBodyBuilder
- func (ctx *WebRequestContext) Get(key string) interface{}
- func (ctx *WebRequestContext) GetContextId() context.ContextId
- func (ctx *WebRequestContext) GetHTTPError() *HTTPError
- func (ctx *WebRequestContext) GetInternalError() error
- func (ctx *WebRequestContext) GetModel() interface{}
- func (ctx *WebRequestContext) GetPath() string
- func (ctx *WebRequestContext) GetPathVariable(name string) (string, bool)
- func (ctx *WebRequestContext) GetRequestBody() []byte
- func (ctx *WebRequestContext) GetRequestHeader(key string) (string, bool)
- func (ctx *WebRequestContext) GetRequestParameter(name string) (string, bool)
- func (ctx *WebRequestContext) GetResponseBody() []byte
- func (ctx *WebRequestContext) GetResponseContentType() MediaType
- func (ctx *WebRequestContext) GetResponseHeader(key string) (string, bool)
- func (ctx *WebRequestContext) GetResponseLocation() string
- func (ctx *WebRequestContext) GetResponseStatus() int
- func (ctx *WebRequestContext) IsCanceled() bool
- func (ctx *WebRequestContext) IsCompleted() bool
- func (ctx *WebRequestContext) IsSuccess() bool
- func (ctx *WebRequestContext) NoContent() ResponseHeaderBuilder
- func (ctx *WebRequestContext) NotFound() ResponseHeaderBuilder
- func (ctx *WebRequestContext) Ok() ResponseBodyBuilder
- func (ctx *WebRequestContext) Put(key string, value interface{})
- func (ctx *WebRequestContext) SetHTTPError(err *HTTPError)
- func (ctx *WebRequestContext) SetModel(model interface{}) ResponseBodyBuilder
- func (ctx *WebRequestContext) SetResponseContentType(mediaType MediaType) ResponseBodyBuilder
- func (ctx *WebRequestContext) SetResponseStatus(status int) ResponseBodyBuilder
- func (ctx *WebRequestContext) ThrowError(err error)
- func (ctx *WebRequestContext) Validate(val interface{}) error
Constants ¶
View Source
const ( DefaultMediaTypeValue = MediaTypeApplicationTextHtmlValue MediaTypeApplicationTextHtmlValue = "text/html" MediaTypeApplicationXmlValue = "application/xml" MediaTypeApplicationJsonValue = "application/json" )
View Source
const DefaultWebServerPort uint = 8080
Variables ¶
View Source
var ( HttpErrorNoContent = NewHTTPError(http.StatusNoContent) HttpErrorBadRequest = NewHTTPError(http.StatusBadRequest) HttpErrorForbidden = NewHTTPError(http.StatusForbidden) HttpErrorNotFound = NewHTTPError(http.StatusNotFound) HttpErrorMethodNotAllowed = NewHTTPError(http.StatusMethodNotAllowed) HttpErrorRequestTimeout = NewHTTPError(http.StatusRequestTimeout) HttpErrorRequestEntityTooLarge = NewHTTPError(http.StatusRequestEntityTooLarge) HttpErrorUnsupportedMediaType = NewHTTPError(http.StatusUnsupportedMediaType) HttpErrorTooManyRequests = NewHTTPError(http.StatusTooManyRequests) HttpErrorInternalServerError = NewHTTPError(http.StatusInternalServerError) HttpErrorBadGateway = NewHTTPError(http.StatusBadGateway) )
Functions ¶
This section is empty.
Types ¶
type Controller ¶
type Controller interface {
RegisterHandlers(registry HandlerRegistry)
}
type DefaultErrorHandler ¶
type DefaultErrorHandler struct {
// contains filtered or unexported fields
}
func NewDefaultErrorHandler ¶
func NewDefaultErrorHandler(logger context.Logger) DefaultErrorHandler
func (DefaultErrorHandler) HandleError ¶
func (handler DefaultErrorHandler) HandleError(err error, requestContext *WebRequestContext)
type ErrorHandler ¶
type ErrorHandler interface {
HandleError(err error, requestContext *WebRequestContext)
}
type HandlerChain ¶
type HandlerChain struct {
// contains filtered or unexported fields
}
func NewHandlerChain ¶
func NewHandlerChain(fun RequestHandlerFunction, interceptorRegistry HandlerInterceptorRegistry, metadata *RequestObjectMetadata) *HandlerChain
type HandlerFunction ¶
type HandlerFunction func(requestContext *WebRequestContext)
type HandlerInterceptor ¶
type HandlerInterceptor HandlerFunction
type HandlerInterceptorAfter ¶
type HandlerInterceptorAfter interface {
HandleAfter(requestContext *WebRequestContext)
}
type HandlerInterceptorAfterCompletion ¶
type HandlerInterceptorAfterCompletion interface {
AfterCompletion(requestContext *WebRequestContext)
}
type HandlerInterceptorBefore ¶
type HandlerInterceptorBefore interface {
HandleBefore(requestContext *WebRequestContext)
}
type HandlerInterceptorProcessor ¶
type HandlerInterceptorProcessor struct {
// contains filtered or unexported fields
}
func NewHandlerInterceptorProcessor ¶
func NewHandlerInterceptorProcessor(interceptorRegistry HandlerInterceptorRegistry) HandlerInterceptorProcessor
func (HandlerInterceptorProcessor) AfterPeaInitialization ¶
func (processor HandlerInterceptorProcessor) AfterPeaInitialization(peaName string, pea interface{}) (interface{}, error)
func (HandlerInterceptorProcessor) BeforePeaInitialization ¶
func (processor HandlerInterceptorProcessor) BeforePeaInitialization(peaName string, pea interface{}) (interface{}, error)
type HandlerInterceptorRegistry ¶
type HandlerInterceptorRegistry interface { RegisterHandlerInterceptor(interceptorInstance interface{}) GetHandlerBeforeInterceptors() []HandlerInterceptor GetHandlerAfterInterceptors() []HandlerInterceptor GetHandlerAfterCompletionInterceptors() []HandlerInterceptor }
type HandlerMapping ¶
type HandlerMapping interface { RegisterHandlerMethod(path string, method RequestMethod, handlerFunc RequestHandlerFunction, metadata *RequestObjectMetadata) GetHandlerChain(ctx *WebRequestContext) }
type HandlerRegistry ¶
type HandlerRegistry interface { Register(info ...RequestHandler) RegisterGroup(prefix string, info ...RequestHandler) }
type MappingRegistry ¶
type MappingRegistry interface { Register(path string, method RequestMethod, handlerChain *HandlerChain) Find(ctx *WebRequestContext) }
type MediaType ¶
type MediaType byte
const ( DefaultMediaType = MediaTypeApplicationTextHtml MediaTypeApplicationTextHtml MediaType = 0 MediaTypeApplicationJson MediaType = 1 MediaTypeApplicationXml MediaType = 2 )
type PathVariable ¶
type ProcyonRouter ¶
type ProcyonRouter struct {
// contains filtered or unexported fields
}
func NewProcyonRouter ¶
func NewProcyonRouter(context context.ConfigurableApplicationContext) *ProcyonRouter
func (*ProcyonRouter) Route ¶
func (router *ProcyonRouter) Route(requestCtx *fasthttp.RequestCtx)
type ProcyonServerApplicationContext ¶
type ProcyonServerApplicationContext struct { *context.BaseApplicationContext // contains filtered or unexported fields }
func NewProcyonServerApplicationContext ¶
func NewProcyonServerApplicationContext(appId context.ApplicationId, contextId context.ContextId) *ProcyonServerApplicationContext
func (*ProcyonServerApplicationContext) Configure ¶
func (ctx *ProcyonServerApplicationContext) Configure()
func (*ProcyonServerApplicationContext) FinishConfigure ¶
func (ctx *ProcyonServerApplicationContext) FinishConfigure()
func (*ProcyonServerApplicationContext) GetWebServer ¶
func (ctx *ProcyonServerApplicationContext) GetWebServer() Server
func (*ProcyonServerApplicationContext) OnConfigure ¶
func (ctx *ProcyonServerApplicationContext) OnConfigure()
type ProcyonWebServer ¶
type ProcyonWebServer struct {
// contains filtered or unexported fields
}
func NewProcyonWebServerForBenchmark ¶
func NewProcyonWebServerForBenchmark(handlerRegistry SimpleHandlerRegistry) *ProcyonWebServer
func (*ProcyonWebServer) GetPort ¶
func (server *ProcyonWebServer) GetPort() uint
func (*ProcyonWebServer) Handle ¶
func (server *ProcyonWebServer) Handle(ctx *fasthttp.RequestCtx)
func (*ProcyonWebServer) Run ¶
func (server *ProcyonWebServer) Run() error
func (*ProcyonWebServer) SetProperties ¶
func (server *ProcyonWebServer) SetProperties(properties *configure.WebServerProperties)
func (*ProcyonWebServer) Stop ¶
func (server *ProcyonWebServer) Stop() error
type RequestBinder ¶
type RequestBinder interface {
BindRequest(request interface{}, ctx *WebRequestContext) error
}
type RequestHandler ¶
type RequestHandler struct { Path string Method RequestMethod HandlerFunc RequestHandlerFunction RequestObject RequestHandlerObject // contains filtered or unexported fields }
func Delete ¶
func Delete(handler RequestHandlerFunction, options ...RequestHandlerOption) RequestHandler
func Get ¶
func Get(handler RequestHandlerFunction, options ...RequestHandlerOption) RequestHandler
func Head ¶
func Head(handler RequestHandlerFunction, options ...RequestHandlerOption) RequestHandler
func Options ¶
func Options(handler RequestHandlerFunction, options ...RequestHandlerOption) RequestHandler
func Patch ¶
func Patch(handler RequestHandlerFunction, options ...RequestHandlerOption) RequestHandler
func Post ¶
func Post(handler RequestHandlerFunction, options ...RequestHandlerOption) RequestHandler
func Put ¶
func Put(handler RequestHandlerFunction, options ...RequestHandlerOption) RequestHandler
type RequestHandlerFunction ¶
type RequestHandlerFunction = func(context *WebRequestContext)
type RequestHandlerMapping ¶
type RequestHandlerMapping struct {
// contains filtered or unexported fields
}
func NewRequestHandlerMapping ¶
func NewRequestHandlerMapping(mappingRegistry MappingRegistry, interceptorRegistry HandlerInterceptorRegistry) RequestHandlerMapping
func (RequestHandlerMapping) GetHandlerChain ¶
func (requestMapping RequestHandlerMapping) GetHandlerChain(ctx *WebRequestContext)
func (RequestHandlerMapping) RegisterHandlerMethod ¶
func (requestMapping RequestHandlerMapping) RegisterHandlerMethod(path string, method RequestMethod, handlerFunc RequestHandlerFunction, metadata *RequestObjectMetadata)
type RequestHandlerMappingProcessor ¶
type RequestHandlerMappingProcessor struct {
// contains filtered or unexported fields
}
func NewRequestHandlerMappingProcessor ¶
func NewRequestHandlerMappingProcessor(mapping RequestHandlerMapping) RequestHandlerMappingProcessor
func (RequestHandlerMappingProcessor) AfterPeaInitialization ¶
func (processor RequestHandlerMappingProcessor) AfterPeaInitialization(peaName string, pea interface{}) (interface{}, error)
func (RequestHandlerMappingProcessor) BeforePeaInitialization ¶
func (processor RequestHandlerMappingProcessor) BeforePeaInitialization(peaName string, pea interface{}) (interface{}, error)
type RequestHandlerObject ¶
type RequestHandlerObject interface{}
type RequestHandlerOption ¶
type RequestHandlerOption func(handler *RequestHandler)
func Path ¶
func Path(path string) RequestHandlerOption
func RequestObject ¶
func RequestObject(requestObject RequestHandlerObject) RequestHandlerOption
type RequestMappingRegistry ¶
type RequestMappingRegistry struct {
// contains filtered or unexported fields
}
func NewRequestMappingRegistry ¶
func NewRequestMappingRegistry() RequestMappingRegistry
func (RequestMappingRegistry) Find ¶
func (registry RequestMappingRegistry) Find(ctx *WebRequestContext)
func (RequestMappingRegistry) Register ¶
func (registry RequestMappingRegistry) Register(path string, method RequestMethod, handlerChain *HandlerChain)
type RequestMethod ¶
type RequestMethod string
const ( RequestMethodGet RequestMethod = http.MethodGet RequestMethodPost RequestMethod = http.MethodPost RequestMethodPut RequestMethod = http.MethodPut RequestMethodDelete RequestMethod = http.MethodDelete RequestMethodPatch RequestMethod = http.MethodPatch RequestMethodOptions RequestMethod = http.MethodOptions RequestMethodHead RequestMethod = http.MethodHead )
type RequestObjectCache ¶
type RequestObjectCache struct {
// contains filtered or unexported fields
}
type RequestObjectMetadata ¶
type RequestObjectMetadata struct {
// contains filtered or unexported fields
}
func ScanRequestObjectMetadata ¶
func ScanRequestObjectMetadata(requestObject interface{}) *RequestObjectMetadata
type ResponseBodyBuilder ¶
type ResponseBodyBuilder interface { ResponseHeaderBuilder SetResponseStatus(status int) ResponseBodyBuilder SetModel(body interface{}) ResponseBodyBuilder SetResponseContentType(mediaType MediaType) ResponseBodyBuilder }
type ResponseBodyWriter ¶
type ResponseBodyWriter interface {
WriteResponseBody(ctx *WebRequestContext, responseWriter ResponseWriter) error
}
type ResponseEntity ¶
type ResponseEntity struct {
// contains filtered or unexported fields
}
type ResponseHeaderBuilder ¶
type ResponseHeaderBuilder interface {
AddResponseHeader(key string, value string) ResponseHeaderBuilder
}
type ResponseWriter ¶
type ResponseWriter struct { }
func (ResponseWriter) WriteResponse ¶
func (responseWriter ResponseWriter) WriteResponse(ctx *WebRequestContext, body []byte)
type Router ¶
type Router interface {
Route(requestCtx *fasthttp.RequestCtx)
}
type RouterMethodTree ¶
type RouterMethodTree struct {
// contains filtered or unexported fields
}
type RouterNodeType ¶
type RouterNodeType byte
const ( PathSegmentNode RouterNodeType = 0 PathVariableNode RouterNodeType = 1 PathWildcardNode RouterNodeType = 2 )
type RouterPathNode ¶
type RouterPathNode struct {
// contains filtered or unexported fields
}
type RouterTree ¶
type RouterTree struct {
// contains filtered or unexported fields
}
func (*RouterTree) AddRoute ¶
func (tree *RouterTree) AddRoute(path string, method RequestMethod, handlerChain *HandlerChain)
func (*RouterTree) Get ¶
func (tree *RouterTree) Get(ctx *WebRequestContext)
func (*RouterTree) GetMethodTree ¶
func (tree *RouterTree) GetMethodTree(method []byte) *RouterMethodTree
type SimpleHandlerInterceptorRegistry ¶
type SimpleHandlerInterceptorRegistry struct {
// contains filtered or unexported fields
}
func NewSimpleHandlerInterceptorRegistry ¶
func NewSimpleHandlerInterceptorRegistry() *SimpleHandlerInterceptorRegistry
func (*SimpleHandlerInterceptorRegistry) GetHandlerAfterCompletionInterceptors ¶
func (registry *SimpleHandlerInterceptorRegistry) GetHandlerAfterCompletionInterceptors() []HandlerInterceptor
func (*SimpleHandlerInterceptorRegistry) GetHandlerAfterInterceptors ¶
func (registry *SimpleHandlerInterceptorRegistry) GetHandlerAfterInterceptors() []HandlerInterceptor
func (*SimpleHandlerInterceptorRegistry) GetHandlerBeforeInterceptors ¶
func (registry *SimpleHandlerInterceptorRegistry) GetHandlerBeforeInterceptors() []HandlerInterceptor
func (*SimpleHandlerInterceptorRegistry) RegisterHandlerInterceptor ¶
func (registry *SimpleHandlerInterceptorRegistry) RegisterHandlerInterceptor(interceptor interface{})
type SimpleHandlerRegistry ¶
type SimpleHandlerRegistry struct {
// contains filtered or unexported fields
}
func NewSimpleHandlerRegistry ¶
func NewSimpleHandlerRegistry() SimpleHandlerRegistry
func (SimpleHandlerRegistry) Register ¶
func (registry SimpleHandlerRegistry) Register(info ...RequestHandler)
func (SimpleHandlerRegistry) RegisterGroup ¶
func (registry SimpleHandlerRegistry) RegisterGroup(prefix string, info ...RequestHandler)
type StandardWebEnvironment ¶
type StandardWebEnvironment struct {
core.StandardEnvironment
}
func NewStandardWebEnvironment ¶
func NewStandardWebEnvironment() *StandardWebEnvironment
type WebRequestContext ¶
type WebRequestContext struct {
// contains filtered or unexported fields
}
func (*WebRequestContext) Accepted ¶
func (ctx *WebRequestContext) Accepted() ResponseBodyBuilder
func (*WebRequestContext) AddResponseHeader ¶
func (ctx *WebRequestContext) AddResponseHeader(key string, value string) ResponseHeaderBuilder
func (*WebRequestContext) BadRequest ¶
func (ctx *WebRequestContext) BadRequest() ResponseBodyBuilder
func (*WebRequestContext) BindRequest ¶
func (ctx *WebRequestContext) BindRequest(request interface{}) error
func (*WebRequestContext) Cancel ¶
func (ctx *WebRequestContext) Cancel()
func (*WebRequestContext) Created ¶
func (ctx *WebRequestContext) Created(location string) ResponseBodyBuilder
func (*WebRequestContext) Get ¶
func (ctx *WebRequestContext) Get(key string) interface{}
func (*WebRequestContext) GetContextId ¶
func (ctx *WebRequestContext) GetContextId() context.ContextId
func (*WebRequestContext) GetHTTPError ¶
func (ctx *WebRequestContext) GetHTTPError() *HTTPError
func (*WebRequestContext) GetInternalError ¶
func (ctx *WebRequestContext) GetInternalError() error
func (*WebRequestContext) GetModel ¶
func (ctx *WebRequestContext) GetModel() interface{}
func (*WebRequestContext) GetPath ¶
func (ctx *WebRequestContext) GetPath() string
func (*WebRequestContext) GetPathVariable ¶
func (ctx *WebRequestContext) GetPathVariable(name string) (string, bool)
func (*WebRequestContext) GetRequestBody ¶
func (ctx *WebRequestContext) GetRequestBody() []byte
func (*WebRequestContext) GetRequestHeader ¶
func (ctx *WebRequestContext) GetRequestHeader(key string) (string, bool)
func (*WebRequestContext) GetRequestParameter ¶
func (ctx *WebRequestContext) GetRequestParameter(name string) (string, bool)
func (*WebRequestContext) GetResponseBody ¶
func (ctx *WebRequestContext) GetResponseBody() []byte
func (*WebRequestContext) GetResponseContentType ¶
func (ctx *WebRequestContext) GetResponseContentType() MediaType
func (*WebRequestContext) GetResponseHeader ¶
func (ctx *WebRequestContext) GetResponseHeader(key string) (string, bool)
func (*WebRequestContext) GetResponseLocation ¶
func (ctx *WebRequestContext) GetResponseLocation() string
func (*WebRequestContext) GetResponseStatus ¶
func (ctx *WebRequestContext) GetResponseStatus() int
func (*WebRequestContext) IsCanceled ¶
func (ctx *WebRequestContext) IsCanceled() bool
func (*WebRequestContext) IsCompleted ¶
func (ctx *WebRequestContext) IsCompleted() bool
func (*WebRequestContext) IsSuccess ¶
func (ctx *WebRequestContext) IsSuccess() bool
func (*WebRequestContext) NoContent ¶
func (ctx *WebRequestContext) NoContent() ResponseHeaderBuilder
func (*WebRequestContext) NotFound ¶
func (ctx *WebRequestContext) NotFound() ResponseHeaderBuilder
func (*WebRequestContext) Ok ¶
func (ctx *WebRequestContext) Ok() ResponseBodyBuilder
func (*WebRequestContext) Put ¶
func (ctx *WebRequestContext) Put(key string, value interface{})
func (*WebRequestContext) SetHTTPError ¶
func (ctx *WebRequestContext) SetHTTPError(err *HTTPError)
func (*WebRequestContext) SetModel ¶
func (ctx *WebRequestContext) SetModel(model interface{}) ResponseBodyBuilder
func (*WebRequestContext) SetResponseContentType ¶
func (ctx *WebRequestContext) SetResponseContentType(mediaType MediaType) ResponseBodyBuilder
func (*WebRequestContext) SetResponseStatus ¶
func (ctx *WebRequestContext) SetResponseStatus(status int) ResponseBodyBuilder
func (*WebRequestContext) ThrowError ¶
func (ctx *WebRequestContext) ThrowError(err error)
func (*WebRequestContext) Validate ¶
func (ctx *WebRequestContext) Validate(val interface{}) error
Click to show internal directories.
Click to hide internal directories.