web

package
v0.0.0-...-3b0718c Latest Latest
Warning

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

Go to latest
Published: Jan 28, 2022 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

View Source
const (
	METHOD_GET    = "GET"
	METHOD_POST   = "POST"
	METHOD_PUT    = "PUT"
	METHOD_DELETE = "DELETE"
)
View Source
const TEMPLATES_LAYOUT_DEFAULT = "templates/layout.phtml"

Variables

View Source
var (
	JungleApp     *JungleRootApplication
	TemplatesPath string
	LogPath       string
	SessionPath   string

	SessionOn bool
	// Session life duration on server 30Min
	SessDuration int64

	RedisServer string
	RedisDb     int
)

Config params for Top Application

View Source
var End_run chan bool

Functions

func AddBlueprint

func AddBlueprint(prefix string, blueprint *blueprint.Blueprint)

func NotFound

func NotFound(w JungleResponseWriter, r *JungleRequest)

func Redirect

func Redirect(w JungleResponseWriter, r *JungleRequest, url string, code int)

func Router

func Router(prefix string, controller ControllerInterface)

raw add router information for http server

func Run

func Run(listen_server string, log_path string)

Types

type ControllerInterface

type ControllerInterface interface {
	Init(cptr *ControllerInterface, w http.ResponseWriter, r *http.Request)
	Prepare()
	Action()
	BeforeAction()
	AfterAction()

	Get()
	Post()
	Put()
	Delete()
}

type JungleController

type JungleController struct {
	Ctx context.Context

	// Templates setting
	TplPath string
	Layout  string
	// contains filtered or unexported fields
}

func (*JungleController) Action

func (c *JungleController) Action()

func (*JungleController) AfterAction

func (c *JungleController) AfterAction()

func (*JungleController) BeforeAction

func (c *JungleController) BeforeAction()

func (*JungleController) Delete

func (c *JungleController) Delete()

func (*JungleController) Echo

func (c *JungleController) Echo(content string, asHtml bool)

func (*JungleController) Get

func (c *JungleController) Get()

func (*JungleController) GetInstancesByName

func (c *JungleController) GetInstancesByName(filename string) (*UploadFile, error)

func (*JungleController) GetSession

func (c *JungleController) GetSession(key string) interface{}

func (*JungleController) Init

intialize controller instance. cptr params ControllerInterface : receive a instance to pointer the final Implements of JungleController

func (*JungleController) Post

func (c *JungleController) Post()

func (*JungleController) Prepare

func (c *JungleController) Prepare()

func (*JungleController) Put

func (c *JungleController) Put()

func (*JungleController) Render

func (c *JungleController) Render(tplfile string, tpl_params map[string]interface{})

func (*JungleController) RenderPartial

func (c *JungleController) RenderPartial(tplfile string, tpl_params map[string]interface{})

func (*JungleController) ResponseError

func (c *JungleController) ResponseError(err_msg string, err_code int)

Response standard Error information to client

func (*JungleController) SetLayout

func (c *JungleController) SetLayout(layout string)

func (*JungleController) SetSession

func (c *JungleController) SetSession(key string, value interface{})

type JungleHttpServerHandler

type JungleHttpServerHandler struct {
	// contains filtered or unexported fields
}
var (
	Global_JungleHttpServerHandler JungleHttpServerHandler
	End_Application                chan os.Signal
)

func NewJungleHttpServerHandler

func NewJungleHttpServerHandler() JungleHttpServerHandler

func (*JungleHttpServerHandler) Add

func (hander *JungleHttpServerHandler) Add(pattern string, c ControllerInterface)

func (*JungleHttpServerHandler) AddBlueprint

func (hander *JungleHttpServerHandler) AddBlueprint(prefix string, bp *blueprint.Blueprint)

func (*JungleHttpServerHandler) ServeHTTP

func (hander *JungleHttpServerHandler) ServeHTTP(w http.ResponseWriter, r *http.Request)

type JungleRequest

type JungleRequest struct {
	http.Request
}

type JungleResponseWriter

type JungleResponseWriter struct {
	http.ResponseWriter
}

type JungleRootApplication

type JungleRootApplication struct {
	Server       *http.Server
	TemplatePath string

	TemplateManager *html.TemplatesManager
	LoggerManager   *logger.LoggingManager
	SessionManager  session.SessionMgrInterface
}

func NewJungleApp

func NewJungleApp(log_path string) *JungleRootApplication

func (*JungleRootApplication) Cleanup

func (app *JungleRootApplication) Cleanup()

Do cleanup function for Jungle Application

func (*JungleRootApplication) Run

func (app *JungleRootApplication) Run(listen_serv string)

type UploadFile

type UploadFile struct {
	FileHeader *multipart.FileHeader
	File       multipart.File
}

func (*UploadFile) GetContentType

func (uf *UploadFile) GetContentType() string

func (*UploadFile) HasContentType

func (uf *UploadFile) HasContentType(content_type string) bool

* check uploadfile is specialize content-type or not @return bool

func (*UploadFile) Release

func (uf *UploadFile) Release()

func (*UploadFile) SaveAs

func (uf *UploadFile) SaveAs(descpath string) error

Jump to

Keyboard shortcuts

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