Versions in this module Expand all Collapse all v1 v1.0.0 Nov 4, 2019 Changes in this version + const DefaultBufferSize + const DefaultPriority + const DefaultTimeout + const EndIncludeBlock + const FileURLPrefix + const FragmentSeparater + const LayoutFragmentName + const MAX_PRIORITY + const ParamAttrPrefix + const PlaceholderEnd + const PlaceholderStart + const ScriptTypeMeta + const StartInclude + const StartIncludeBlock + const UicFetch + const UicFragment + const UicInclude + const UicRemove + const UicTail + var ForwardRequestHeaders = []string + var ForwardResponseHeaders = []string + var ResponseProcessorsNotApplicable = errors.New("request processors are not apliable on file content") + func LogFetchResultLoadingError(res *FetchResult, w http.ResponseWriter, r *http.Request) + func MetadataForRequest(r *http.Request) map[string]interface + func ParseHeadFragment(fragment *StringFragment, headPropertyMap map[string]string) error + type Cache interface + Get func(hash string) (cacheObject interface{}, found bool) + Invalidate func() + PurgeEntries func(keys []string) + Set func(hash string, label string, memorySize int, cacheObject interface{}) + type CacheInvalidationHandler struct + func NewCacheInvalidationHandler(cache Cache, next http.Handler) *CacheInvalidationHandler + func (cih *CacheInvalidationHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) + type CacheStrategy interface + Hash func(method string, url string, requestHeader http.Header) string + IsCacheable func(method string, url string, statusCode int, requestHeader http.Header, ...) bool + type CachingContentLoader struct + func NewCachingContentLoader(cache Cache) *CachingContentLoader + func (loader *CachingContentLoader) Load(fd *FetchDefinition) (Content, error) + type CompositionHandler struct + func NewCompositionHandler(contentFetcherFactory ContentFetcherFactory) *CompositionHandler + func NewCompositionHandlerWithCache(contentFetcherFactory ContentFetcherFactory, cache Cache) *CompositionHandler + func (agg *CompositionHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) + func (agg *CompositionHandler) WithCache(cache Cache) *CompositionHandler + func (agg *CompositionHandler) WithDeduplicationStrategyFactory(strategyFactory func() StylesheetDeduplicationStrategy) *CompositionHandler + type Content interface + Body func() map[string]Fragment + BodyAttributes func() Fragment + Dependencies func() map[string]Params + Head func() Fragment + HttpHeader func() http.Header + HttpStatusCode func() int + MemorySize func() int + Meta func() map[string]interface{} + Name func() string + Reader func() io.ReadCloser + RequiredContent func() []*FetchDefinition + Tail func() Fragment + type ContentFetcher struct + Loader ContentLoader + func NewContentFetcher(defaultMetaJSON map[string]interface{}) *ContentFetcher + func (fetcher *ContentFetcher) AddFetchJob(d *FetchDefinition) + func (fetcher *ContentFetcher) Empty() bool + func (fetcher *ContentFetcher) MetaJSON() map[string]interface{} + func (fetcher *ContentFetcher) SetFetchDefinitionFactory(factory FetchDefinitionFactory) + func (fetcher *ContentFetcher) WaitForResults() []*FetchResult + type ContentFetcherFactory func(r *http.Request) FetchResultSupplier + type ContentLoader interface + Load func(fd *FetchDefinition) (content Content, err error) + type ContentMerge struct + Body map[string]Fragment + BodyAttrs []Fragment + BodyAttrsArray [][]html.Attribute + Buffered bool + Head []Fragment + MetaJSON map[string]interface{} + Tail []Fragment + func NewContentMerge(metaJSON map[string]interface{}) *ContentMerge + func (cntx *ContentMerge) AddContent(c Content, priority int) + func (cntx *ContentMerge) GetBodyFragmentByName(name string) (Fragment, bool) + func (cntx *ContentMerge) GetHtml() ([]byte, error) + func (cntx *ContentMerge) SetDeduplicationStrategy(strategy StylesheetDeduplicationStrategy) + type ContentMerger interface + AddContent func(c Content, priority int) + GetHtml func() ([]byte, error) + SetDeduplicationStrategy func(stategy StylesheetDeduplicationStrategy) + type ContentParser interface + Parse func(*MemoryContent, io.Reader) error + type ContentV2 interface + BodyAttributesArray func() []html.Attribute + type ContentWrapper struct + func (cw *ContentWrapper) Reader() io.ReadCloser + type DefaultErrorHandler struct + func NewDefaultErrorHandler() *DefaultErrorHandler + func (der *DefaultErrorHandler) Handle(err error, status int, w http.ResponseWriter, r *http.Request) + type ErrorHandler interface + Handle func(err error, status int, w http.ResponseWriter, r *http.Request) + type FetchDefinition struct + Body io.Reader + CacheStrategy CacheStrategy + ErrHandler ErrorHandler + FollowRedirects bool + Header http.Header + Method string + Name string + Priority int + Required bool + RespProc ResponseProcessor + ServiceDiscovery servicediscovery.ServiceDiscovery + ServiceDiscoveryActive bool + Timeout time.Duration + URL string + func NewFetchDefinition(url string) *FetchDefinition + func (d *FetchDefinition) DiscoveredBy(dnsServer string) *FetchDefinition + func (def *FetchDefinition) Hash() string + func (def *FetchDefinition) IsCacheable(responseStatus int, responseHeaders http.Header) bool + func (def *FetchDefinition) IsReadableFromCache() bool + func (fd *FetchDefinition) FromRequest(r *http.Request) *FetchDefinition + func (fd *FetchDefinition) WithHeaders(header http.Header) *FetchDefinition + func (fd *FetchDefinition) WithName(name string) *FetchDefinition + func (fd *FetchDefinition) WithPriority(priority int) *FetchDefinition + func (fd *FetchDefinition) WithResponseProcessor(rp ResponseProcessor) *FetchDefinition + type FetchDefinitionFactory func(name string, params Params) (fd *FetchDefinition, existing bool, err error) + type FetchResult struct + Content Content + Def *FetchDefinition + Err error + Hash string + type FetchResultSupplier interface + Empty func() bool + MetaJSON func() map[string]interface{} + WaitForResults func() []*FetchResult + type FetchResults []*FetchResult + func (fr FetchResults) Len() int + func (fr FetchResults) Less(i, j int) bool + func (fr FetchResults) Swap(i, j int) + type FileContentLoader struct + func NewFileContentLoader() *FileContentLoader + func (loader *FileContentLoader) Load(fd *FetchDefinition) (Content, error) + type Fragment interface + Execute func(w io.Writer, data map[string]interface{}, ...) error + MemorySize func() int + Stylesheets func() [][]html.Attribute + type HtmlContentParser struct + func (parser *HtmlContentParser) Parse(c *MemoryContent, in io.Reader) error + type HttpContentLoader struct + func NewHttpContentLoader() *HttpContentLoader + func (loader *HttpContentLoader) Load(fd *FetchDefinition) (Content, error) + type IdentityDeduplicationStrategy struct + func (strategy *IdentityDeduplicationStrategy) Deduplicate(stylesheets [][]html.Attribute) [][]html.Attribute + type MemoryContent struct + func NewMemoryContent() *MemoryContent + func (c *MemoryContent) Body() map[string]Fragment + func (c *MemoryContent) BodyAttributes() Fragment + func (c *MemoryContent) BodyAttributesArray() []html.Attribute + func (c *MemoryContent) Dependencies() map[string]Params + func (c *MemoryContent) Head() Fragment + func (c *MemoryContent) HttpHeader() http.Header + func (c *MemoryContent) HttpStatusCode() int + func (c *MemoryContent) MemorySize() int + func (c *MemoryContent) Meta() map[string]interface{} + func (c *MemoryContent) Name() string + func (c *MemoryContent) Reader() io.ReadCloser + func (c *MemoryContent) RequiredContent() []*FetchDefinition + func (c *MemoryContent) Tail() Fragment + type Params map[string]string + type ResponseProcessor interface + Process func(*http.Response, string) error + type SimpleDeduplicationStrategy struct + func (strategy *SimpleDeduplicationStrategy) Deduplicate(stylesheets [][]html.Attribute) (result [][]html.Attribute) + type StringFragment struct + func NewStringFragment(c string) *StringFragment + func (f *StringFragment) AddStylesheets(stylesheets [][]html.Attribute) + func (f *StringFragment) Content() string + func (f *StringFragment) Execute(w io.Writer, data map[string]interface{}, ...) error + func (f *StringFragment) MemorySize() int + func (f *StringFragment) SetContent(content string) + func (f *StringFragment) Stylesheets() [][]html.Attribute + type StylesheetDeduplicationStrategy interface + Deduplicate func(stylesheetAttrs [][]html.Attribute) [][]html.Attribute Other modules containing this package github.com/tarent/lib-compose/v2