當前位置: 首頁>>代碼示例>>Golang>>正文


Golang ObjectRequest.Extras方法代碼示例

本文整理匯總了Golang中duov6/com/objectstore/messaging.ObjectRequest.Extras方法的典型用法代碼示例。如果您正苦於以下問題:Golang ObjectRequest.Extras方法的具體用法?Golang ObjectRequest.Extras怎麽用?Golang ObjectRequest.Extras使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在duov6/com/objectstore/messaging.ObjectRequest的用法示例。


在下文中一共展示了ObjectRequest.Extras方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。

示例1: dispatchRequest

func dispatchRequest(r *http.Request, params martini.Params) (responseMessage string, isSuccess bool) { //result is JSON

	objectRequest := messaging.ObjectRequest{}

	paramMap := make(map[string]interface{})
	objectRequest.Extras = paramMap

	message, isSuccess := getObjectRequest(r, &objectRequest, params)

	if isSuccess == false {
		responseMessage = getQueryResponseString("Invalid Query Request", message, false, objectRequest.MessageStack, nil)
	} else {

		dispatcher := processors.Dispatcher{}
		var repResponse repositories.RepositoryResponse = dispatcher.Dispatch(&objectRequest)
		isSuccess = repResponse.IsSuccess

		if isSuccess {
			if repResponse.Body != nil {
				responseMessage = string(repResponse.Body)
				//If it's a FILE
				if checkIfFile(params) != "NAF" {

					rootsaveDirectory := ""
					rootgetDirectory := ""
					if runtime.GOOS == "linux" {
						rootsaveDirectory = objectRequest.Configuration.ServerConfiguration["LinuxFileServer"]["SavePath"]
						rootgetDirectory = objectRequest.Configuration.ServerConfiguration["LinuxFileServer"]["GetPath"]
					} else {
						rootsaveDirectory = objectRequest.Configuration.ServerConfiguration["WindowsFileServer"]["SavePath"]
						rootgetDirectory = objectRequest.Configuration.ServerConfiguration["WindowsFileServer"]["GetPath"]
					}

					var sendRequest = FileServerMessaging.FileRequest{}
					sendRequest.Body = repResponse.Body
					sendRequest.FilePath = ""
					sendRequest.RootSavePath = rootsaveDirectory
					sendRequest.RootGetPath = rootgetDirectory

					exe := FileServer.FileManager{}

					fileResponse := exe.Download(&sendRequest)

					if fileResponse.IsSuccess == true {
						fmt.Println(fileResponse.Message)
					} else {
						fmt.Println(fileResponse.Message)
					}
				}

			} else {
				responseMessage = getQueryResponseString("Successfully completed request", repResponse.Message, isSuccess, objectRequest.MessageStack, repResponse.Data)
			}

		} else {
			responseMessage = getQueryResponseString("Error occured while processing", repResponse.Message, isSuccess, objectRequest.MessageStack, nil)
		}

	}

	return
}
開發者ID:sajeetharan,項目名稱:v6engine,代碼行數:62,代碼來源:HTTPService.go


注:本文中的duov6/com/objectstore/messaging.ObjectRequest.Extras方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。