Documentation
¶
Index ¶
- Constants
- Variables
- func GetPurePath(path string) string
- func GetUniqueId() int64
- func HandleError(request *RequestContext, message string)
- func HandlerError(w http.ResponseWriter, r *http.Request, message string)
- func HandlerOk(w http.ResponseWriter, r *http.Request, message string)
- func MatchByContainMap(src []byte, containMap map[byte]int) bool
- func PrepareValidatePattern(pattern *ValidatePattern, defContainMap map[byte]int, ...) error
- func ProvideHeaders(preHeaders map[string][]string, postHeaders map[string][]string, origin string, ...)
- func Send(w http.ResponseWriter, r *http.Request, message []byte)
- func SetRecordMode(path string)
- type ActionPolicy
- type DatabaseConfig
- type DatabaseTable
- type DvAction
- type HandlerFunc
- type InterfaceExecutor
- type MaskInfo
- type MaskInfoPart
- type MaskKind
- type MicroCoreHeaderAttribute
- type MicroCoreInfo
- type ParallelExecutionControl
- type ParallelProcessing
- type ProcessorBlock
- type ProcessorEndPointHandler
- type ProxyServerBlock
- type RequestContext
- func (ctx *RequestContext) AddTempFile(name string)
- func (ctx *RequestContext) CleanUpRequest()
- func (request *RequestContext) GetContentType() string
- func (ctx *RequestContext) GetCurrentErrorPolicy() *RequestErrorPolicy
- func (ctx *RequestContext) GetEnvironment() *dvevaluation.DvObject
- func (ctx *RequestContext) GetUrlInlineParameter(param string) string
- func (ctx *RequestContext) GetUrlParameter(param string) string
- func (request *RequestContext) HandleCommunication()
- func (ctx *RequestContext) HandleFileNotFound()
- func (ctx *RequestContext) HandleHttpError(statusCode int)
- func (ctx *RequestContext) HandleInternalServerError()
- func (ctx *RequestContext) SetError(err error)
- func (ctx *RequestContext) SetErrorMessage(message string)
- func (ctx *RequestContext) SetHeaderArray(key string, val []string)
- func (ctx *RequestContext) SetHeaderUnique(key string, val string)
- func (ctx *RequestContext) SetHttpErrorCode(errorCode int, message string)
- func (ctx *RequestContext) SetUrlInlineParameters(params map[string]string)
- func (ctx *RequestContext) StoreStoringSession()
- type RequestErrorPolicy
- type RequestSession
- type RewriteMap
- type RewriteMapItem
- type SSEChange
- type SSEWSControl
- type SecurityServerInfo
- type ServerSessionProvider
- type ServerSettings
- type SessionActionRequest
- type Stage
- type ValidatePattern
Constants ¶
View Source
const ( UrlPathPrefix = "URL_PATH_" ErrorPolicy = "ERROR_POLICY" )
View Source
const ( HeadersAddToList = iota HeadersSetOrigin = iota HeadersSetOriginAlways = iota )
View Source
const ( LogLevelNone = iota LogLevelInputURL = iota LogLevelFullInput = iota LogLevelFull = iota )
View Source
const ( PARALLEL_MODE_SIMPLE = 0 PARALLEL_MODE_SSE = 1 PARALLEL_MODE_WS = 2 )
View Source
const ( STAGE_MODE_START = 0 STAGE_MODE_MIDDLE = 1 STAGE_MODE_END = 2 )
View Source
const ( UrlIncludeOption_HostFirst = 1 UrlIncludeOption_PredefinedHostOnly = 2 UrlIncludeOption_HostWithoutPort = 4 )
View Source
const ( BODY_STRING = "BODY_STRING" BODY_JSON = "BODY_JSON" BODY_STRING_ARRAY_MAP = "BODY_STRING_ARRAY_MAP" BODY_STRING_MAP = "BODY_STRING_MAP" BODY_PARAM_PREFIX = "BODY_PARAM_" REQUEST_METHOD = "REQUEST_METHOD" REQUEST_URI = "REQUEST_URI" REQUEST_URL_PARAMS = "REQUEST_URL_PARAMS" AUTO_HEADER_SET_BY = "AUTO_HEADER_SET_BY" HEADERS_RESPONSE = "HEADERS_RESPONSE" )
View Source
const (
DoNotShowPlaceInfo = "~DO NOT SHOW PLACE~"
)
View Source
const ENCODED_HOST_PORT_URL_PARAM = "_ENCODED_HOST_PORT_URL_PARAM_"
View Source
const LogHandled = -2000
View Source
const (
ServerSessionStoringKey = "___SERVER__SESSION__STORING__KEY___"
)
*** SessionActionRequest options: c - create session u - update session only e - error if no session l - load all session variables with SESSION_ prefix (default) or without n - specifies option "l" must be without prefix
id is a place where to find the session id
Variables ¶
View Source
var DefaultRequestErrorPolicy = &RequestErrorPolicy{ Name: "default", Format: "{\"timestamp\":\"$$$TIMESTAMP\",\"status\":$$$STATUS,\"error\":\"$$$ERROR\",\"message\":\"$$$MESSAGE\",\"path\":\"$$$PATH\"}", ContentType: "application/json", FormatForced: false, }
Functions ¶
func GetPurePath ¶
func GetUniqueId ¶
func GetUniqueId() int64
func HandleError ¶
func HandleError(request *RequestContext, message string)
func HandlerError ¶
func HandlerError(w http.ResponseWriter, r *http.Request, message string)
func PrepareValidatePattern ¶
func ProvideHeaders ¶
func ProvideHeaders(preHeaders map[string][]string, postHeaders map[string][]string, origin string, specialHeaders map[string]MicroCoreHeaderAttribute, w http.ResponseWriter)
func SetRecordMode ¶
func SetRecordMode(path string)
Types ¶
type ActionPolicy ¶
type DatabaseConfig ¶
type DatabaseConfig struct {
Name string `json:"name"`
Root string `json:"root"`
WebRoot string `json:"webroot"`
Tables []*DatabaseTable `json:"tables"`
}
type DatabaseTable ¶
type DatabaseTable struct {
Name string `json:"name"`
Kind string `json:"kind"`
Web string `json:"web"`
KeyFirst string `json:"keyFirst"`
WebField string `json:"webField"`
WebFileName string `json:"webFileName"`
WebFormats string `json:"webFormats"`
AllowCustomId bool `json:"customId"`
Version string `json:"version"`
}
type DvAction ¶
type DvAction struct {
Name string `json:"name"`
Typ string `json:"type"`
Url string `json:"url"`
Method string `json:"method"`
QueryParams map[string]string `json:"query"`
Body map[string]string `json:"body"`
Result string `json:"result"`
ResultMode string `json:"mode"`
Definitions map[string]string `json:"definitions"`
InnerParams string `json:"params"`
Conditions map[string]string `json:"conditions"`
Validations []*ValidatePattern `json:"validations"`
ErrorPolicy string `json:"error_policy"`
LogPolicy string `json:"log_policy"`
Session *SessionActionRequest `json:"session"`
Roles string `json:"roles"`
Auth string `json:"auth"`
SseWs *SSEWSControl `json:"sse_ws"`
}
type HandlerFunc ¶
type HandlerFunc func(request *RequestContext) bool
type InterfaceExecutor ¶
type InterfaceExecutor func(*RequestContext, interface{}) interface{}
type MaskInfo ¶
type MaskInfo struct {
FixedStart string
FixedEnd string
Middle []*MaskInfoPart
IsNegative bool
IsCaseInsensitive int
}
type MaskInfoPart ¶
type MicroCoreInfo ¶
type MicroCoreInfo struct {
sync.RWMutex
Client *http.Client
BaseFolderUsed bool
ExtraStaticServer bool
ProxyServerHttp bool
HasProxyServers bool
BaseFolderUrl string
ProxyServerMap map[string]string
ProxyServerUrl string
ProxyServerSettings ServerSettings
ProxyName string
DomainName string
ProxyServers []*ProxyServerBlock
ErrorPolicies map[string]*RequestErrorPolicy
HeadersStatic map[string][]string
HeadersProxyServer map[string][]string
HeadersStaticOptions map[string][]string
HeadersProxyServerOptions map[string][]string
HeadersSpecial map[string]MicroCoreHeaderAttribute
HeadersSpecialOptions map[string]MicroCoreHeaderAttribute
HeadersSpecialStatic map[string]MicroCoreHeaderAttribute
DirectoryIndex []string
BaseRewrite RewriteMap
BaseProcessorBlocks []ProcessorBlock
BaseProviderBlocks []ProcessorBlock
PostProcessorBlocks []ProcessorBlock
HostHeader string
ServerRewrite RewriteMap
Session ServerSessionProvider
SecurityInfo *SecurityServerInfo
ModuleHandler HandlerFunc
ActionPolicies map[string]*ActionPolicy
ActionHandler HandlerFunc
LogLevel int
UrlIncludeOption int
}
type ParallelProcessing ¶
type ParallelProcessing struct {
IntervalTimeUnit float32 `json:"interval_time_unit"`
}
type ProcessorBlock ¶
type ProcessorBlock struct {
Name string
EndPointHandler ProcessorEndPointHandler
Urls []*MaskInfo
Data map[string]string
}
type ProcessorEndPointHandler ¶
type ProcessorEndPointHandler func(request *RequestContext) bool
type ProxyServerBlock ¶
type RequestContext ¶
type RequestContext struct {
Id int64
Extra map[string]interface{}
PrimaryContextEnvironment *dvevaluation.DvObject
LocalContextEnvironment *dvevaluation.DvObject
Params map[string]string
UrlInlineParams map[string]string
Url string
Urls []string
UrlsLowerCase []string
FileName string
DataType string
Queries map[string]string
Writer http.ResponseWriter
Reader *http.Request
Server *MicroCoreInfo
Session RequestSession
Input []byte
InputStr string
InputJson interface{}
Output []byte
Headers map[string][]string
Error error
Action *DvAction
StatusCode int
ParallelExecution *ParallelExecutionControl
ExecutorFn InterfaceExecutor
LogLevel int
PlaceInfo string
TempFiles []string
}
func (*RequestContext) AddTempFile ¶
func (ctx *RequestContext) AddTempFile(name string)
func (*RequestContext) CleanUpRequest ¶
func (ctx *RequestContext) CleanUpRequest()
func (*RequestContext) GetContentType ¶
func (request *RequestContext) GetContentType() string
func (*RequestContext) GetCurrentErrorPolicy ¶
func (ctx *RequestContext) GetCurrentErrorPolicy() *RequestErrorPolicy
func (*RequestContext) GetEnvironment ¶
func (ctx *RequestContext) GetEnvironment() *dvevaluation.DvObject
func (*RequestContext) GetUrlInlineParameter ¶
func (ctx *RequestContext) GetUrlInlineParameter(param string) string
func (*RequestContext) GetUrlParameter ¶
func (ctx *RequestContext) GetUrlParameter(param string) string
func (*RequestContext) HandleCommunication ¶
func (request *RequestContext) HandleCommunication()
func (*RequestContext) HandleFileNotFound ¶
func (ctx *RequestContext) HandleFileNotFound()
func (*RequestContext) HandleHttpError ¶
func (ctx *RequestContext) HandleHttpError(statusCode int)
func (*RequestContext) HandleInternalServerError ¶
func (ctx *RequestContext) HandleInternalServerError()
func (*RequestContext) SetError ¶
func (ctx *RequestContext) SetError(err error)
func (*RequestContext) SetErrorMessage ¶
func (ctx *RequestContext) SetErrorMessage(message string)
func (*RequestContext) SetHeaderArray ¶
func (ctx *RequestContext) SetHeaderArray(key string, val []string)
func (*RequestContext) SetHeaderUnique ¶
func (ctx *RequestContext) SetHeaderUnique(key string, val string)
func (*RequestContext) SetHttpErrorCode ¶
func (ctx *RequestContext) SetHttpErrorCode(errorCode int, message string)
func (*RequestContext) SetUrlInlineParameters ¶
func (ctx *RequestContext) SetUrlInlineParameters(params map[string]string)
func (*RequestContext) StoreStoringSession ¶
func (ctx *RequestContext) StoreStoringSession()
type RequestErrorPolicy ¶
type RequestSession ¶
type RewriteMap ¶
type RewriteMap map[string][]*RewriteMapItem
type SSEWSControl ¶
type SecurityServerInfo ¶
type ServerSessionProvider ¶
type ServerSessionProvider interface {
GetSessionStorage(ctx *RequestContext, request *SessionActionRequest, sessionId string) (RequestSession, error)
}
type ServerSettings ¶
type ServerSettings struct {
MaxIdleConns int `json:"maxIdleConnections"`
IdleConnTimeout int `json:"idleConnectionTimeout"`
DisableCompression bool `json:"disableCompression"`
DisableKeepAlives bool `json:"disableKeepAlives"`
MaxIdleConnsPerHost int `json:"maxIdleConnectionsPerHost"`
ResponseHeaderTimeout int `json:"responseHeaderTimeout"`
ExpectContinueTimeout int `json:"expectContinueTimeout"`
}
type SessionActionRequest ¶
type ValidatePattern ¶
type ValidatePattern struct {
Source string `json:"source"`
Message string `json:"message"`
EmptyMessage string `json:"empty"`
Contains string `json:"contains"`
RegPattern string `json:"pattern"`
// contains filtered or unexported fields
}
func (*ValidatePattern) Match ¶
func (pattern *ValidatePattern) Match(src string) string
func (*ValidatePattern) MatchByCompiledPattern ¶
func (pattern *ValidatePattern) MatchByCompiledPattern(src string) string
Click to show internal directories.
Click to hide internal directories.