コード例 #1
0
ファイル: tokenContext.go プロジェクト: gk-turnip/server
func (tokenContext *tokenContextDef) ServeHTTP(res http.ResponseWriter, req *http.Request) {
	path := req.URL.Path

	gklog.LogTrace(req.Method)
	gklog.LogTrace(path)

	if req.Method == _methodGet || req.Method == _methodPost {
		if gknet.RequestMatches(path, _tokenRequest) {
			tokenContext.handleTokenRequest(res, req)
		} else {
			http.NotFound(res, req)
		}
	} else {
		http.NotFound(res, req)
	}
}
コード例 #2
0
ファイル: httpContext.go プロジェクト: gk-turnip/server
func (httpContext *httpContextDef) ServeHTTP(res http.ResponseWriter, req *http.Request) {
	if _gameTemplate == nil {
		gklog.LogError("missing call to gameInit")
	}

	path := req.URL.Path

	gklog.LogTrace(req.Method)
	gklog.LogTrace(path)

	if req.Method == _methodGet || req.Method == _methodPost {
		if gknet.RequestMatches(path, _gameRequest) {
			httpContext.handleGameRequest(res, req)
		} else {
			http.NotFound(res, req)
		}
	} else {
		http.NotFound(res, req)
	}
}
コード例 #3
0
func (loginConfig *loginConfigDef) ServeHTTP(res http.ResponseWriter, req *http.Request) {
	if _loginTemplate == nil {
		gklog.LogError("missing call to loginInit")
	}

	path := req.URL.Path

	gklog.LogTrace(req.Method)
	gklog.LogTrace(path)

	if req.Method == _methodGet || req.Method == _methodPost {
		if gknet.RequestMatches(path, _loginServer) {
			handleLogin(loginConfig, res, req)
		} else {
			http.NotFound(res, req)
		}
	} else {
		http.NotFound(res, req)
	}

}