Versions in this module Expand all Collapse all v1 v1.1.0 Jun 22, 2016 Changes in this version type CompressingResponseWriter + func (c *CompressingResponseWriter) Hijack() (net.Conn, *bufio.ReadWriter, error) type Response + func (r *Response) Flush() v1.1.0-beta3 Jun 10, 2016 v1.1.0-beta2 Jun 3, 2016 v1.1.0-beta1 May 20, 2016 v1.0.1 Mar 31, 2016 v1.0.0 Mar 7, 2016 v1.0.0-beta1 Feb 23, 2016 v0 v0.1.0 Feb 3, 2016 Changes in this version + const BodyParameterKind + const ENCODING_DEFLATE + const ENCODING_GZIP + const FormParameterKind + const HEADER_Accept + const HEADER_AcceptEncoding + const HEADER_AccessControlAllowCredentials + const HEADER_AccessControlAllowHeaders + const HEADER_AccessControlAllowMethods + const HEADER_AccessControlAllowOrigin + const HEADER_AccessControlExposeHeaders + const HEADER_AccessControlMaxAge + const HEADER_AccessControlRequestHeaders + const HEADER_AccessControlRequestMethod + const HEADER_Allow + const HEADER_ContentEncoding + const HEADER_ContentType + const HEADER_LastModified + const HEADER_Origin + const HeaderParameterKind + const MIME_JSON + const MIME_OCTET + const MIME_XML + const PathParameterKind + const QueryParameterKind + var DefaultResponseMimeType string + var DoNotRecover = false + var EnableContentEncoding = false + var PrettyPrintResponses = true + func Add(service *WebService) + func DefaultRequestContentType(mime string) + func DefaultResponseContentType(mime string) + func EnableTracing(enabled bool) + func Filter(filter FilterFunction) + func RegisterEntityAccessor(mime string, erw EntityReaderWriter) + func SetCacheReadEntity(doCache bool) + func SetCompressorProvider(p CompressorProvider) + func SetLogger(customLogger log.StdLogger) + func TraceLogger(logger log.StdLogger) + type BoundedCachedCompressors struct + func NewBoundedCachedCompressors(writersCapacity, readersCapacity int) *BoundedCachedCompressors + func (b *BoundedCachedCompressors) AcquireGzipReader() *gzip.Reader + func (b *BoundedCachedCompressors) AcquireGzipWriter() *gzip.Writer + func (b *BoundedCachedCompressors) AcquireZlibWriter() *zlib.Writer + func (b *BoundedCachedCompressors) ReleaseGzipReader(r *gzip.Reader) + func (b *BoundedCachedCompressors) ReleaseGzipWriter(w *gzip.Writer) + func (b *BoundedCachedCompressors) ReleaseZlibWriter(w *zlib.Writer) + type CompressingResponseWriter struct + func NewCompressingResponseWriter(httpWriter http.ResponseWriter, encoding string) (*CompressingResponseWriter, error) + func (c *CompressingResponseWriter) Close() error + func (c *CompressingResponseWriter) CloseNotify() <-chan bool + func (c *CompressingResponseWriter) Header() http.Header + func (c *CompressingResponseWriter) Write(bytes []byte) (int, error) + func (c *CompressingResponseWriter) WriteHeader(status int) + type CompressorProvider interface + AcquireGzipReader func() *gzip.Reader + AcquireGzipWriter func() *gzip.Writer + AcquireZlibWriter func() *zlib.Writer + ReleaseGzipReader func(w *gzip.Reader) + ReleaseGzipWriter func(w *gzip.Writer) + ReleaseZlibWriter func(w *zlib.Writer) + func CurrentCompressorProvider() CompressorProvider + type Container struct + ServeMux *http.ServeMux + var DefaultContainer *Container + func NewContainer() *Container + func (c *Container) Add(service *WebService) *Container + func (c *Container) DoNotRecover(doNot bool) + func (c *Container) EnableContentEncoding(enabled bool) + func (c *Container) Filter(filter FilterFunction) + func (c *Container) HandleWithFilter(pattern string, handler http.Handler) + func (c *Container) OPTIONSFilter(req *Request, resp *Response, chain *FilterChain) + func (c *Container) RecoverHandler(handler RecoverHandleFunction) + func (c *Container) Remove(ws *WebService) error + func (c *Container) Router(aRouter RouteSelector) + func (c *Container) ServiceErrorHandler(handler ServiceErrorHandleFunction) + func (c Container) Handle(pattern string, handler http.Handler) + func (c Container) RegisteredWebServices() []*WebService + func (c Container) ServeHTTP(httpwriter http.ResponseWriter, httpRequest *http.Request) + type CrossOriginResourceSharing struct + AllowedDomains []string + AllowedHeaders []string + AllowedMethods []string + Container *Container + CookiesAllowed bool + ExposeHeaders []string + MaxAge int + func (c CrossOriginResourceSharing) Filter(req *Request, resp *Response, chain *FilterChain) + type CurlyRouter struct + func (c CurlyRouter) SelectRoute(webServices []*WebService, httpRequest *http.Request) (selectedService *WebService, selected *Route, err error) + type EntityReaderWriter interface + Read func(req *Request, v interface{}) error + Write func(resp *Response, status int, v interface{}) error + type FilterChain struct + Filters []FilterFunction + Index int + Target RouteFunction + func (f *FilterChain) ProcessFilter(request *Request, response *Response) + type FilterFunction func(*Request, *Response, *FilterChain) + func OPTIONSFilter() FilterFunction + type Parameter struct + func BodyParameter(name, description string) *Parameter + func FormParameter(name, description string) *Parameter + func HeaderParameter(name, description string) *Parameter + func PathParameter(name, description string) *Parameter + func QueryParameter(name, description string) *Parameter + func (p *Parameter) AllowMultiple(multiple bool) *Parameter + func (p *Parameter) AllowableValues(values map[string]string) *Parameter + func (p *Parameter) Data() ParameterData + func (p *Parameter) DataFormat(formatName string) *Parameter + func (p *Parameter) DataType(typeName string) *Parameter + func (p *Parameter) DefaultValue(stringRepresentation string) *Parameter + func (p *Parameter) Description(doc string) *Parameter + func (p *Parameter) Kind() int + func (p *Parameter) Required(required bool) *Parameter + type ParameterData struct + AllowMultiple bool + AllowableValues map[string]string + DataFormat string + DataType string + DefaultValue string + Description string + Kind int + Name string + Required bool + type RecoverHandleFunction func(interface{}, http.ResponseWriter) + type Request struct + Request *http.Request + func NewRequest(httpRequest *http.Request) *Request + func (r *Request) BodyParameter(name string) (string, error) + func (r *Request) HeaderParameter(name string) string + func (r *Request) PathParameter(name string) string + func (r *Request) PathParameters() map[string]string + func (r *Request) QueryParameter(name string) string + func (r *Request) ReadEntity(entityPointer interface{}) (err error) + func (r *Request) SetAttribute(name string, value interface{}) + func (r Request) Attribute(name string) interface{} + func (r Request) SelectedRoutePath() string + type Response struct + func NewResponse(httpWriter http.ResponseWriter) *Response + func (r *Response) EntityWriter() (EntityReaderWriter, bool) + func (r *Response) PrettyPrint(bePretty bool) + func (r *Response) SetRequestAccepts(mime string) + func (r *Response) Write(bytes []byte) (int, error) + func (r *Response) WriteAsJson(value interface{}) error + func (r *Response) WriteAsXml(value interface{}) error + func (r *Response) WriteEntity(value interface{}) error + func (r *Response) WriteError(httpStatus int, err error) error + func (r *Response) WriteErrorString(httpStatus int, errorReason string) error + func (r *Response) WriteHeader(httpStatus int) + func (r *Response) WriteHeaderAndEntity(status int, value interface{}) error + func (r *Response) WriteHeaderAndJson(status int, value interface{}, contentType string) error + func (r *Response) WriteHeaderAndXml(status int, value interface{}) error + func (r *Response) WriteJson(value interface{}, contentType string) error + func (r *Response) WriteServiceError(httpStatus int, err ServiceError) error + func (r Response) AddHeader(header string, value string) Response + func (r Response) CloseNotify() <-chan bool + func (r Response) ContentLength() int + func (r Response) Error() error + func (r Response) InternalServerError() Response + func (r Response) StatusCode() int + type ResponseError struct + Code int + Message string + Model interface{} + type Route struct + Consumes []string + Doc string + Filters []FilterFunction + Function RouteFunction + Method string + Notes string + Operation string + ParameterDocs []*Parameter + Path string + Produces []string + ReadSample interface{} + ResponseErrors map[int]ResponseError + WriteSample interface{} + func (r Route) String() string + type RouteBuilder struct + func (b *RouteBuilder) Build() Route + func (b *RouteBuilder) Consumes(mimeTypes ...string) *RouteBuilder + func (b *RouteBuilder) Do(oneArgBlocks ...func(*RouteBuilder)) *RouteBuilder + func (b *RouteBuilder) Doc(documentation string) *RouteBuilder + func (b *RouteBuilder) Filter(filter FilterFunction) *RouteBuilder + func (b *RouteBuilder) Method(method string) *RouteBuilder + func (b *RouteBuilder) Notes(notes string) *RouteBuilder + func (b *RouteBuilder) Operation(name string) *RouteBuilder + func (b *RouteBuilder) Param(parameter *Parameter) *RouteBuilder + func (b *RouteBuilder) Path(subPath string) *RouteBuilder + func (b *RouteBuilder) Produces(mimeTypes ...string) *RouteBuilder + func (b *RouteBuilder) Reads(sample interface{}) *RouteBuilder + func (b *RouteBuilder) Returns(code int, message string, model interface{}) *RouteBuilder + func (b *RouteBuilder) ReturnsError(code int, message string, model interface{}) *RouteBuilder + func (b *RouteBuilder) To(function RouteFunction) *RouteBuilder + func (b *RouteBuilder) Writes(sample interface{}) *RouteBuilder + func (b RouteBuilder) ParameterNamed(name string) (p *Parameter) + type RouteFunction func(*Request, *Response) + type RouteSelector interface + SelectRoute func(webServices []*WebService, httpRequest *http.Request) (selectedService *WebService, selected *Route, err error) + type RouterJSR311 struct + func (r RouterJSR311) SelectRoute(webServices []*WebService, httpRequest *http.Request) (selectedService *WebService, selectedRoute *Route, err error) + type ServiceError struct + Code int + Message string + func NewError(code int, message string) ServiceError + func (s ServiceError) Error() string + type ServiceErrorHandleFunction func(ServiceError, *Request, *Response) + type SyncPoolCompessors struct + GzipReaderPool *sync.Pool + GzipWriterPool *sync.Pool + ZlibWriterPool *sync.Pool + func NewSyncPoolCompessors() *SyncPoolCompessors + func (s *SyncPoolCompessors) AcquireGzipReader() *gzip.Reader + func (s *SyncPoolCompessors) AcquireGzipWriter() *gzip.Writer + func (s *SyncPoolCompessors) AcquireZlibWriter() *zlib.Writer + func (s *SyncPoolCompessors) ReleaseGzipReader(r *gzip.Reader) + func (s *SyncPoolCompessors) ReleaseGzipWriter(w *gzip.Writer) + func (s *SyncPoolCompessors) ReleaseZlibWriter(w *zlib.Writer) + type WebService struct + func RegisteredWebServices() []*WebService + func (w *WebService) ApiVersion(apiVersion string) *WebService + func (w *WebService) BodyParameter(name, description string) *Parameter + func (w *WebService) Consumes(accepts ...string) *WebService + func (w *WebService) DELETE(subPath string) *RouteBuilder + func (w *WebService) Doc(plainText string) *WebService + func (w *WebService) Filter(filter FilterFunction) *WebService + func (w *WebService) FormParameter(name, description string) *Parameter + func (w *WebService) GET(subPath string) *RouteBuilder + func (w *WebService) HEAD(subPath string) *RouteBuilder + func (w *WebService) HeaderParameter(name, description string) *Parameter + func (w *WebService) Method(httpMethod string) *RouteBuilder + func (w *WebService) PATCH(subPath string) *RouteBuilder + func (w *WebService) POST(subPath string) *RouteBuilder + func (w *WebService) PUT(subPath string) *RouteBuilder + func (w *WebService) Param(parameter *Parameter) *WebService + func (w *WebService) Path(root string) *WebService + func (w *WebService) PathParameter(name, description string) *Parameter + func (w *WebService) Produces(contentTypes ...string) *WebService + func (w *WebService) QueryParameter(name, description string) *Parameter + func (w *WebService) RemoveRoute(path, method string) error + func (w *WebService) Route(builder *RouteBuilder) *WebService + func (w *WebService) SetDynamicRoutes(enable bool) + func (w WebService) Documentation() string + func (w WebService) PathParameters() []*Parameter + func (w WebService) RootPath() string + func (w WebService) Routes() []Route + func (w WebService) Version() string