gweb

package module
v1.3.0 Latest Latest
Warning

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

Go to latest
Published: Mar 25, 2022 License: Apache-2.0 Imports: 33 Imported by: 7

README

gweb

golang web 轻框架

最轻量的包装,灵活极易扩展,采用流行的MVC框架思想。

支持特性:
  • 子路径独立拦截器和控制器
  • 添加子控制器
  • 支持RESTful,OPTIONS,GET,HEAD,POST,PUT,DELETE,TRACE,CONNECT
  • 支持 {id}/path 路径映射
  • 内置返回类型有:ViewResult,HTMLResult,JsonResult,TextResult,RedirectToUrlResult,ImageResult,ImageBytesResult
  • 内置模板函数,除了golang的函数,还增加了IncludeHTML,Split,FromJSONToMap,FromJSONToArray,CipherDecrypter,CipherEncrypter,Int2String,Uint2String,Float2String,ToJSON
安装:
go get github.com/nbvghost/gweb
配制文件说明:

默认配制文件信息: {"ViewDir":"view","ResourcesDir":"resources","DefaultPage":"index","JsonDataPath":"data.json","HttpPort":":80","HttpsPort":":443","ViewSuffix":".html","ViewActionMapping":true,"TLSCertFile":"","TLSKeyFile":""}]

  • ViewDir:视图文件夹名
  • ResourcesDir:资源文件夹名
  • DefaultPage:默认文件名
  • JsonDataPath:json 数据文件,这个文件在所有视图文件中可以读取到,可用于程序业务配制信息一块。
  • HttpPort:http 端口
  • HttpsPort:https 端口
  • ViewSuffix:视图文件后缀
  • TLSCertFile,TLSKeyFile: https 证书文件
使用例子:

package main

import (
	"github.com/nbvghost/gweb"
	"github.com/nbvghost/gweb/conf"
	"net/http"
	"net/url"
	"time"
)

//拦截器
type InterceptorManager struct {
}

//拦截器 方法,如果 允许登陆 返回true
func (this InterceptorManager) Execute(context *gweb.Context) (bool, gweb.Result) {
	if context.Session.Attributes.Get("admin") == nil { //判断当前 session 信息
		redirect := "" // 跳转地址
		if len(context.Request.URL.Query().Encode()) == 0 {
			redirect = context.Request.URL.Path
		} else {
			redirect = context.Request.URL.Path + "?" + context.Request.URL.Query().Encode()
		}
		//http.Redirect(Response, Request, "/account/login?redirect="+url.QueryEscape(redirect), http.StatusFound)
		return false, &gweb.RedirectToUrlResult{Url: "/account/login?redirect=" + url.QueryEscape(redirect)}
	} else {
		return true, nil
	}
}

type User struct {
	Name string
	Age  int
}

//index路由控制器
type IndexController struct {
	gweb.BaseController
}

func (c *IndexController) Apply() {
	c.Interceptors.Add(&InterceptorManager{}) //拦截器


	// 添加index地址映射
	//访问路径示例:http://127.0.0.1:80/index
	c.AddHandler(gweb.ALLMethod("index", func(context *gweb.Context) gweb.Result {
		return &gweb.HTMLResult{}
	}))

	//访问子路径示例:http://127.0.0.1:80/wx/
	wx := &WxController{}
	wx.Interceptors = c.Interceptors //使用 父级 拦截器
	c.AddSubController("/wx/", wx)   // 添加子控制器,相关的路由定义在 WxController.Apply() 里

}

//account路由控制器
type AccountController struct {
	gweb.BaseController
}

func (c *AccountController) Apply() {

	//访问路径示例:http://127.0.0.1:80/account/login
	c.AddHandler(gweb.GETMethod("login", func(context *gweb.Context) gweb.Result {

		user := &User{Name: "user name", Age: 12}

		context.Session.Attributes.Put("admin", user)

		redirect := context.Request.URL.Query().Get("redirect")

		return &gweb.RedirectToUrlResult{Url: redirect}
	}))

}

// /wx 路由控制器
type WxController struct {
	gweb.BaseController
}

func (c *WxController) Apply() {

	//访问路径示例:http://127.0.0.1:80/wx/44545/path
	c.AddHandler(gweb.GETMethod("{id}/path", func(context *gweb.Context) gweb.Result {

		user := context.Session.Attributes.Get("admin").(*User)

		return &gweb.HTMLResult{Name: "wx/path", Params: map[string]interface{}{"User": user, "Id": context.PathParams}}
	}))
	//访问路径示例:http://127.0.0.1:80/wx/info
	c.AddHandler(gweb.GETMethod("info", func(context *gweb.Context) gweb.Result {

		user := context.Session.Attributes.Get("admin").(*User)

		return &gweb.HTMLResult{Params: map[string]interface{}{"User": user}}
	}))

}
func main() {

	//初始化控制器,拦截 / 路径
	index := &IndexController{}
	index.NewController("/", index)

	//初始化控制器,拦截 /account 路径
	account := &AccountController{}
	account.NewController("/account", account)

	httpServer := &http.Server{
		Addr:         conf.Config.HttpPort,
		Handler:      http.DefaultServeMux,
		ReadTimeout:  60 * time.Second,
		WriteTimeout: 60 * time.Second,
		//MaxHeaderBytes: 1 << 20,
	}

	//启动web服务器
	gweb.StartServer(http.DefaultServeMux,httpServer, nil)

	//也可用,内置函数,gweb只是简单的做一个封装的
	//err := http.ListenAndServe(conf.Config.HttpPort, nil)
	//log.Println(err)
}

具体代码请查看demo目录:https://github.com/nbvghost/gweb/tree/master/demo/gwebtest

也可以加我QQ:274455411

推荐使用jetbrains goland开发

使用IDEA开发

Documentation

Index

Constants

This section is empty.

Variables

View Source
var AppRouter = mux.NewRouter()
View Source
var Sessions = &SessionSafeMap{}

Functions

func DownloadInternetImage added in v1.3.0

func DownloadInternetImage(url string, UserAgent string, Referer string, dynamicDirName string) string

func DownloadInternetImageTemp added in v1.3.0

func DownloadInternetImageTemp(url string, UserAgent string, Referer string) string

func GetDeviceName added in v1.3.0

func GetDeviceName(UserAgent string) string

Mozilla/5.0 (iPhone; CPU iPhone OS 10_3_1 like Mac OS X) AppleWebKit/603.1.30 (KHTML, like Gecko) Version/10.0 Mobile/14E304 Safari/602.1 Mozilla/5.0 (Linux; Android 8.0; Pixel 2 Build/OPD3.170816.012) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/74.0.3729.157 Mobile Safari/537.36 Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/74.0.3729.157 Safari/537.36 Mozilla/5.0 (iPad; CPU OS 11_0 like Mac OS X) AppleWebKit/604.1.34 (KHTML, like Gecko) Version/11.0 Mobile/15A5341f Safari/604.1

func GetIP added in v1.3.0

func GetIP(request *http.Request) string

func IsFileExist added in v1.3.0

func IsFileExist(path string) bool

func NewFuncMap added in v1.2.16

func NewFuncMap(context *Context) template.FuncMap

func NewStaticController added in v1.2.19

func NewStaticController(rootPath, dir string)

func QueryParams added in v1.3.0

func QueryParams(m url.Values) map[string]string

func RegisterFunction added in v1.3.0

func RegisterFunction(funcName string, function IFunc)

func RegisterWidget added in v1.3.0

func RegisterWidget(funcName string, widget IWidget)

func RequestByHeader added in v1.3.0

func RequestByHeader(url string, UserAgent string, Referer string) (error, *http.Response, []byte)

func RequestByHeader(url string, UserAgent string, Referer string) ([]byte,error) {

client := http.Client{}
req, err := http.NewRequest("GET", url, nil)
if err != nil {
	return nil,err
}
//req.Header.Add("User-Agent","Mozilla/5.0 (Linux; Android 7.0; SLA-AL00 Build/HUAWEISLA-AL00; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/57.0.2987.132 MQQBrowser/6.2 TBS/044109 Mobile Safari/537.36 MicroMessenger/6.6.7.1321(0x26060739) NetType/WIFI Language/zh_CN")
if !strings.EqualFold(UserAgent, "") {
	req.Header.Add("User-Agent", UserAgent)
}

if !strings.EqualFold(Referer, "") {
	req.Header.Add("Referer", Referer)
}

resp, err := client.Do(req)
if err != nil {
	return nil,err
}
defer resp.Body.Close()

b, err := ioutil.ReadAll(resp.Body)

return b,err

}

func WriteFile added in v1.3.0

func WriteFile(fileBytes []byte, ContentType string, dynamicDirName, dirType string) string

func WriteFilePath added in v1.3.0

func WriteFilePath(fileBytes []byte, dynamicDirName, dirType string, fileName string) (error, string)

func WriteTempFile added in v1.3.0

func WriteTempFile(fileBytes []byte, ContentType string) string

func WriteTempUrlNameFile added in v1.3.0

func WriteTempUrlNameFile(b []byte, Url string) string

func WriteWithFile added in v1.3.0

func WriteWithFile(file multipart.File, header *multipart.FileHeader, dynamicDirName string, dirType string) (error, string)

Types

type Attributes

type Attributes struct {
	// contains filtered or unexported fields
}

func (*Attributes) Delete

func (att *Attributes) Delete(key AttributesKey)

func (*Attributes) Get

func (att *Attributes) Get(key AttributesKey) interface{}

func (*Attributes) GetMap

func (att *Attributes) GetMap() map[string]interface{}

func (*Attributes) GetOrPut

func (att *Attributes) GetOrPut(key AttributesKey, value interface{}) (actual interface{}, loaded bool)

func (*Attributes) Put

func (att *Attributes) Put(key AttributesKey, value interface{})

type AttributesKey added in v1.3.0

type AttributesKey string

func (AttributesKey) String added in v1.3.0

func (ak AttributesKey) String() string

type CacheConfig added in v1.2.17

type CacheConfig struct {
	PrefixName      string //前缀名字,主要用于生成缓存目录的名字
	EnableHTMLCache bool   //是否启用html缓存功能
}

type Context

type Context struct {
	Response   http.ResponseWriter //
	Request    *http.Request       //
	Session    *Session            //
	PathParams map[string]string   //
	RoutePath  string              //route 的路径,相当于router根目录,请求request path remove restful path
	Function   *Function           //
}

func (*Context) Clone added in v1.2.15

func (c *Context) Clone() Context

type Controller added in v1.2.19

type Controller struct {
	RoutePath        string        //定义路由的路径
	Interceptors     *Interceptors //
	ParentController *Controller   //
	Router           *mux.Router   //dir
	ViewSubDir       string        //
}

func (*Controller) AddHandler added in v1.2.19

func (c *Controller) AddHandler(routePath string, call IHandler) IController

func (*Controller) AddInterceptor added in v1.3.0

func (c *Controller) AddInterceptor(value Interceptor) IController

func (*Controller) AddStaticHandler added in v1.2.19

func (c *Controller) AddStaticHandler(function *Function)

func (*Controller) DefaultHandle added in v1.2.19

func (c *Controller) DefaultHandle(call IHandler) IController

func (*Controller) NewController added in v1.2.19

func (c *Controller) NewController(actionName string) IController

func (*Controller) NotFoundHandler added in v1.2.20

func (c *Controller) NotFoundHandler(call IHandler) IController

type EmptyResult

type EmptyResult struct {
}

func (*EmptyResult) Apply

func (r *EmptyResult) Apply(context *Context)

type ErrorResult

type ErrorResult struct {
	Error error
}

func NewErrorResult added in v1.2.15

func NewErrorResult(err error) *ErrorResult

func (*ErrorResult) Apply

func (r *ErrorResult) Apply(context *Context)

type FileDirType added in v1.3.0

type FileDirType int32
var FileDirT FileDirType = 1
var FileDirTemp FileDirType = 1

type FileServerResult

type FileServerResult struct {
	Prefix string
	Dir    string
}

func (*FileServerResult) Apply

func (fs *FileServerResult) Apply(context *Context)

http.StripPrefix

type FuncObject added in v1.2.16

type FuncObject struct {
	// contains filtered or unexported fields
}

type Function added in v1.2.16

type Function struct {
	RoutePath string
	Handler   IHandler
	// contains filtered or unexported fields
}

func NewFunction added in v1.2.19

func NewFunction(RoutePath string, call IHandler) *Function

func (*Function) ServeHTTP added in v1.2.19

func (function *Function) ServeHTTP(w http.ResponseWriter, r *http.Request)

type HTMLResult

type HTMLResult struct {
	Name       string
	StatusCode int
	Params     map[string]interface{}
	Template   []string //读取当前目录下 template 文件夹下的模板
}

HTMLResult 只映射已经定义的后缀模板文件

func (*HTMLResult) Apply

func (r *HTMLResult) Apply(context *Context)

type HtmlPlainResult

type HtmlPlainResult struct {
	Data   string
	Params map[string]interface{}
}

func (*HtmlPlainResult) Apply

func (r *HtmlPlainResult) Apply(context *Context)

type IController

type IController interface {
	DefaultHandle(call IHandler) IController
	NotFoundHandler(call IHandler) IController
	AddHandler(routePath string, call IHandler) IController
	AddInterceptor(value Interceptor) IController
	NewController(actionName string) IController
}

func NewController added in v1.2.19

func NewController(rootPath, viewSubDir string) IController

NewController 根目录控制器,非具体的handler

type IFunc added in v1.3.0

type IFunc interface {
	Call(ctx *Context) IFuncResult
}

type IFuncResult added in v1.3.0

type IFuncResult interface {
	Result() interface{}
}

func NewMapFuncResult added in v1.3.0

func NewMapFuncResult(m map[string]interface{}) IFuncResult

func NewStringArrayFuncResult added in v1.3.0

func NewStringArrayFuncResult(args []string) IFuncResult

func NewStringFuncResult added in v1.3.0

func NewStringFuncResult(arg string) IFuncResult

type IHandler added in v1.3.0

type IHandler interface {
	Handle(context *Context) (Result, error)
}

type IHandlerConnect added in v1.3.0

type IHandlerConnect interface {
	IHandler
	HandleConnect(context *Context) (Result, error)
}

type IHandlerDelete added in v1.3.0

type IHandlerDelete interface {
	IHandler
	HandleDelete(context *Context) (Result, error)
}

type IHandlerGet added in v1.3.0

type IHandlerGet interface {
	IHandler
	HandleGet(context *Context) (Result, error)
}

type IHandlerHead added in v1.3.0

type IHandlerHead interface {
	IHandler
	HandleHead(context *Context) (Result, error)
}

type IHandlerOptions added in v1.3.0

type IHandlerOptions interface {
	IHandler
	HandleOptions(context *Context) (Result, error)
}

type IHandlerPatch added in v1.3.0

type IHandlerPatch interface {
	IHandler
	HandlePatch(context *Context) (Result, error)
}

type IHandlerPost added in v1.3.0

type IHandlerPost interface {
	IHandler
	HandlePost(context *Context) (Result, error)
}

type IHandlerPut added in v1.3.0

type IHandlerPut interface {
	IHandler
	HandlePut(context *Context) (Result, error)
}

type IHandlerTrace added in v1.3.0

type IHandlerTrace interface {
	IHandler
	HandleTrace(context *Context) (Result, error)
}

type IWidget added in v1.3.0

type IWidget interface {
	Render(ctx *Context) (interface{}, error)
}

type ImageBytesResult

type ImageBytesResult struct {
	Data        []byte
	ContentType string //: image/png
}

func (*ImageBytesResult) Apply

func (r *ImageBytesResult) Apply(context *Context)

type ImageResult

type ImageResult struct {
	FilePath string
}

func (*ImageResult) Apply

func (r *ImageResult) Apply(context *Context)

type Interceptor

type Interceptor interface {
	ActionBefore(context *Context) (bool, Result)
	ActionService(context *Context) ServiceConfig
	ActionAfter(context *Context, result Result) Result
}

type InterceptorFlow added in v1.2.16

type InterceptorFlow string
const (
	InterceptorFlowBreak    InterceptorFlow = "BREAK"
	InterceptorFlowContinue InterceptorFlow = "CONTINUE"
)

type Interceptors

type Interceptors struct {
	// contains filtered or unexported fields
}

func (*Interceptors) ActionAfter added in v1.3.0

func (inter *Interceptors) ActionAfter(context *Context, result Result) Result
func (inter *Interceptors) Len() int {
	if inter == nil {
		return 0
	}
	if inter.list == nil {
		return 0
	}
	if len(inter.list) == 0 {
		return 0
	}
	return len(inter.list)
}

func (*Interceptors) ActionBefore added in v1.3.0

func (inter *Interceptors) ActionBefore(context *Context) (bool, Result)

func (*Interceptors) ActionService added in v1.3.0

func (inter *Interceptors) ActionService(context *Context) ServiceConfig

func (*Interceptors) AddInterceptor added in v1.3.0

func (inter *Interceptors) AddInterceptor(value Interceptor)

type JavaScriptResult

type JavaScriptResult struct {
	Data string
}

func (*JavaScriptResult) Apply

func (r *JavaScriptResult) Apply(context *Context)

type JsonResult

type JsonResult struct {
	Data interface{}
	// contains filtered or unexported fields
}

func (*JsonResult) Apply

func (r *JsonResult) Apply(context *Context)
func (r *JsonResult)encodeJson() (error,[]byte)  {
	r.Lock()
	defer r.Unlock()
	buffer := &bytes.Buffer{}
	encoder := json.NewEncoder(buffer)
	encoder.SetEscapeHTML(false)
	err := encoder.Encode(r.Data)
	return err,buffer.Bytes()
}

type MIME

type MIME string
const (
	MultipartByteranges MIME = "multipart/byteranges"
	MultipartFormData   MIME = "multipart/form-data"

	AudioWave   MIME = "audio/wave"
	AudioWav    MIME = "audio/wav"
	AudioXWav   MIME = "audio/x-wav"
	AudioWPnWav MIME = "audio/x-pn-wav"
	AudioWebm   MIME = "audio/webm"
	AudioOgg    MIME = "audio/ogg"
	AudioMpeg   MIME = "audio/mpeg"

	VideoWebm MIME = "video/webm"
	VideoOgg  MIME = "video/ogg"
	VideoMp4  MIME = "video/mp4"

	ApplicationOgg  MIME = "application/ogg"
	ApplicationJson MIME = "application/json"

	ApplicationJavascript  MIME = "application/javascript"
	ApplicationEcmascript  MIME = "application/ecmascript"
	ApplicationOctetStream MIME = "application/octet-stream"

	ImageGif    MIME = "image/gif"
	ImageJpeg   MIME = "image/jpeg"
	ImagePng    MIME = "image/png"
	ImageSvgXml MIME = "image/svg+xml"

	TextCss   MIME = "text/css"
	TextHtml  MIME = "text/html"
	TextPlain MIME = "text/plain"
)

type NotFoundHandler added in v1.2.20

type NotFoundHandler struct {
	// contains filtered or unexported fields
}

func (*NotFoundHandler) ServeHTTP added in v1.2.20

func (h *NotFoundHandler) ServeHTTP(writer http.ResponseWriter, request *http.Request)

type RedirectToUrlResult

type RedirectToUrlResult struct {
	Url string
}

func (*RedirectToUrlResult) Apply

func (r *RedirectToUrlResult) Apply(context *Context)

type Result

type Result interface {
	Apply(context *Context)
}

func FileLoadAction added in v1.2.20

func FileLoadAction(ctx *Context) Result
func (static Static) FileLoad(ctx *Context) Result {
	path := ctx.Request.URL.Query().Get("path")
	urldd, err := url.Parse(path)
	if glog.Error(err) || (strings.EqualFold(urldd.Scheme, "") && strings.EqualFold(urldd.Host, "")) {
		//dir, _ := filepath.Split(path)
		http.ServeFile(ctx.Response, ctx.Request, strings.Trim(conf.Config.UploadDir, "/")+"/"+strings.Trim(conf.Config.UploadDirName, "/")+"/"+path)
		return &EmptyResult{}
	}
	return &RedirectToUrlResult{Url: path}
}
func (static Static) FileTempLoad(ctx *Context) Result {
	path := ctx.Request.URL.Query().Get("path")
	http.ServeFile(ctx.Response, ctx.Request, "temp/"+path)
	return &EmptyResult{}
}

func FileTempLoadAction added in v1.2.20

func FileTempLoadAction(ctx *Context) Result

type ServiceConfig added in v1.2.17

type ServiceConfig struct {
	CacheConfig CacheConfig
}

type Session

type Session struct {
	//sync.RWMutex
	ID                string
	Token             string
	Attributes        *Attributes
	CreateTime        int64
	LastOperationTime int64
	LastRequestURL    *url.URL
}

type SessionSafeMap

type SessionSafeMap struct {
	// contains filtered or unexported fields
}

func (*SessionSafeMap) AddSession

func (s *SessionSafeMap) AddSession(GLSESSIONID string, session *Session)

func (*SessionSafeMap) DeleteSession

func (s *SessionSafeMap) DeleteSession(GLSESSIONID string)

func (*SessionSafeMap) GetSession

func (s *SessionSafeMap) GetSession(GLSESSIONID string) *Session

func (*SessionSafeMap) Range

func (s *SessionSafeMap) Range(f func(key, value interface{}) bool)

type SingleHostForwardProxyResult

type SingleHostForwardProxyResult struct {
	Target *url.URL
}

func (*SingleHostForwardProxyResult) Apply

func (r *SingleHostForwardProxyResult) Apply(context *Context)

type SingleHostReverseProxyResult

type SingleHostReverseProxyResult struct {
	Target *url.URL
}

func (*SingleHostReverseProxyResult) Apply

func (r *SingleHostReverseProxyResult) Apply(context *Context)

type TextResult

type TextResult struct {
	Data string
}

func (*TextResult) Apply

func (r *TextResult) Apply(context *Context)

type ViewActionMappingResult

type ViewActionMappingResult struct {
}

* 类型/子类型 扩展名 application/json json application/envoy evy application/fractals fif application/futuresplash spl application/hta hta application/internet-property-stream acx application/mac-binhex40 hqx application/msword doc application/msword dot application/octet-stream * application/octet-stream bin application/octet-stream class application/octet-stream dms application/octet-stream exe application/octet-stream lha application/octet-stream lzh application/oda oda application/olescript axs application/pdf pdf application/pics-rules prf application/pkcs10 p10 application/pkix-crl crl application/postscript ai application/postscript eps application/postscript ps application/rtf rtf application/set-payment-initiation setpay application/set-registration-initiation setreg application/vnd.ms-excel xla application/vnd.ms-excel xlc application/vnd.ms-excel xlm application/vnd.ms-excel xls application/vnd.ms-excel xlt application/vnd.ms-excel xlw application/vnd.ms-outlook msg application/vnd.ms-pkicertstore sst application/vnd.ms-pkiseccat cat application/vnd.ms-pkistl stl application/vnd.ms-powerpoint pot application/vnd.ms-powerpoint pps application/vnd.ms-powerpoint ppt application/vnd.ms-project mpp application/vnd.ms-works wcm application/vnd.ms-works wdb application/vnd.ms-works wks application/vnd.ms-works wps application/winhlp hlp application/x-bcpio bcpio application/x-cdf cdf application/x-compress z application/x-compressed tgz application/x-cpio cpio application/x-csh csh application/x-director dcr application/x-director dir application/x-director dxr application/x-dvi dvi application/x-gtar gtar application/x-gzip gz application/x-hdf hdf application/x-internet-signup ins application/x-internet-signup isp application/x-iphone iii application/x-javascript js application/x-latex latex application/x-msaccess mdb application/x-mscardfile crd application/x-msclip clp application/x-msdownload dll application/x-msmediaview m13 application/x-msmediaview m14 application/x-msmediaview mvb application/x-msmetafile wmf application/x-msmoney mny application/x-mspublisher pub application/x-msschedule scd application/x-msterminal trm application/x-mswrite wri application/x-netcdf cdf application/x-netcdf nc application/x-perfmon pma application/x-perfmon pmc application/x-perfmon pml application/x-perfmon pmr application/x-perfmon pmw application/x-pkcs12 p12 application/x-pkcs12 pfx application/x-pkcs7-certificates p7b application/x-pkcs7-certificates spc application/x-pkcs7-certreqresp p7r application/x-pkcs7-mime p7c application/x-pkcs7-mime p7m application/x-pkcs7-signature p7s application/x-sh sh application/x-shar shar application/x-shockwave-flash swf application/x-stuffit sit application/x-sv4cpio sv4cpio application/x-sv4crc sv4crc application/x-tar tar application/x-tcl tcl application/x-tex tex application/x-texinfo texi application/x-texinfo texinfo application/x-troff roff application/x-troff t application/x-troff tr application/x-troff-man man application/x-troff-me me application/x-troff-ms ms application/x-ustar ustar application/x-wais-source src application/x-x509-ca-cert cer application/x-x509-ca-cert crt application/x-x509-ca-cert der application/ynd.ms-pkipko pko application/zip zip audio/basic au audio/basic snd audio/mid mid audio/mid rmi audio/mpeg mp3 audio/x-aiff aif audio/x-aiff aifc audio/x-aiff aiff audio/x-mpegurl m3u audio/x-pn-realaudio ra audio/x-pn-realaudio ram audio/x-wav wav image/bmp bmp image/cis-cod cod image/gif gif image/ief ief image/jpeg jpe image/jpeg jpeg image/jpeg jpg image/pipeg jfif image/svg+xml svg image/tiff tif image/tiff tiff image/x-cmu-raster ras image/x-cmx cmx image/x-icon ico image/x-portable-anymap pnm image/x-portable-bitmap pbm image/x-portable-graymap pgm image/x-portable-pixmap ppm image/x-rgb rgb image/x-xbitmap xbm image/x-xpixmap xpm image/x-xwindowdump xwd message/rfc822 mht message/rfc822 mhtml message/rfc822 nws text/css css text/h323 323 text/html htm text/html html text/html stm text/iuls uls text/plain bas text/plain c text/plain h text/plain txt text/richtext rtx text/scriptlet sct text/tab-separated-values tsv text/webviewhtml htt text/x-component htc text/x-setext etx text/x-vcard vcf video/mpeg mp2 video/mpeg mpa video/mpeg mpe video/mpeg mpeg video/mpeg mpg video/mpeg mpv2 video/quicktime mov video/quicktime qt video/x-la-asf lsf video/x-la-asf lsx video/x-ms-asf asf video/x-ms-asf asr video/x-ms-asf asx video/x-msvideo avi video/x-sgi-movie movie x-world/x-vrml flr x-world/x-vrml vrml x-world/x-vrml wrl x-world/x-vrml wrz x-world/x-vrml xaf x-world/x-vrml xof

func (*ViewActionMappingResult) Apply

func (r *ViewActionMappingResult) Apply(context *Context)

type ViewResult

type ViewResult struct {
}

不做处理,返回原 Response

func (*ViewResult) Apply

func (r *ViewResult) Apply(context *Context)

type XMLResult

type XMLResult struct {
	Data string
}

func (*XMLResult) Apply

func (r *XMLResult) Apply(context *Context)

Directories

Path Synopsis
demo

Jump to

Keyboard shortcuts

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