func GetItemHandler(w http.ResponseWriter, req *http.Request) {
	if bbpd_runinfo.BBPDAbortIfClosed(w) {
		return
	}
	start := time.Now()
	if req.Method != "POST" {
		e := "get_item_route.GetItemHandler:method only supports POST"
		log.Printf(e)
		http.Error(w, e, http.StatusBadRequest)
		return
	}
	pathElts := strings.Split(req.URL.Path, "/")
	if len(pathElts) != 2 {
		e := "get_item_route.GetItemHandler:cannot parse path."
		log.Printf(e)
		http.Error(w, e, http.StatusBadRequest)
		return
	}

	bodybytes, read_err := ioutil.ReadAll(req.Body)
	req.Body.Close()
	if read_err != nil && read_err != io.EOF {
		e := fmt.Sprintf("get_item_route.GetItemHandler err reading req body: %s", read_err.Error())
		log.Printf(e)
		http.Error(w, e, http.StatusInternalServerError)
		return
	}

	g := get.NewGetItem()

	um_err := json.Unmarshal(bodybytes, g)
	if um_err != nil {
		e := fmt.Sprintf("get_item_route.GetItemHandler unmarshal err on %s to Get %s", string(bodybytes), um_err.Error())
		log.Printf(e)
		http.Error(w, e, http.StatusInternalServerError)
		return
	}

	resp_body, code, resp_err := g.EndpointReq()

	if resp_err != nil {
		e := fmt.Sprintf("get_item_route.GetItemHandler:err %s",
			resp_err.Error())
		log.Printf(e)
		http.Error(w, e, http.StatusInternalServerError)
		return
	}

	if ep.HttpErr(code) {
		route_response.WriteError(w, code, "get_item_route.GetItemHandler", resp_body)
		return
	}

	mr_err := route_response.MakeRouteResponse(
		w,
		req,
		resp_body,
		code,
		start,
		get.ENDPOINT_NAME)
	if mr_err != nil {
		e := fmt.Sprintf("get_item_route.GetItemHandler %s",
			mr_err.Error())
		log.Printf(e)
		http.Error(w, e, http.StatusInternalServerError)
		return
	}
}
// GetItemHandler relays the GetItem request to Dynamo but first validates it through a local type.
GetItemHandler relays the GetItem request to Dynamo but first validates it through a local type.
// GetItemHandler relays the GetItem request to Dynamo but first validates it through a local type .
func GetItemHandler(w http.ResponseWriter, req *http.Request) {
	if bbpd_runinfo.BBPDAbortIfClosed(w) {
		return
	}
	start := time.Now()
	if req.Method != "POST" {
		e := "get_item_route.GetItemHandler:method only supports POST"
		log.Printf(e)
		http.Error(w, e, http.StatusBadRequest)
		return
	}
	pathElts := strings.Split(req.URL.Path, "/")
	if len(pathElts) != 2 {
		e := "get_item_route.GetItemHandler:cannot parse path."
		log.Printf(e)
		http.Error(w, e, http.StatusBadRequest)
		return
	}
	bodybytes, read_err := ioutil.ReadAll(req.Body)
	req.Body.Close()
	if read_err != nil && read_err != io.EOF {
		e := fmt.Sprintf("get_item_route.GetItemHandler err reading req body: %s", read_err.Error())
		log.Printf(e)
		http.Error(w, e, http.StatusInternalServerError)
		return
	}
	g := get.NewGetItem()
	um_err := json.Unmarshal(bodybytes, g)
	if um_err != nil {
		e := fmt.Sprintf("get_item_route.GetItemHandler unmarshal err on %s to Get %s", string(bodybytes), um_err.Error())
		log.Printf(e)
		http.Error(w, e, http.StatusInternalServerError)
		return
	}
	resp_body, code, resp_err := g.EndpointReq()
	if resp_err != nil {
		e := fmt.Sprintf("get_item_route.GetItemHandler:err %s",
			resp_err.Error())
		log.Printf(e)
		http.Error(w, e, http.StatusInternalServerError)
		return
	}
	if ep.HttpErr(code) {
		route_response.WriteError(w, code, "get_item_route.GetItemHandler", resp_body)
		return
	}
	mr_err := route_response.MakeRouteResponse(
		w,
		req,
		resp_body,
		code,
		start,
		get.ENDPOINT_NAME)
	if mr_err != nil {
		e := fmt.Sprintf("get_item_route.GetItemHandler %s",
			mr_err.Error())
		log.Printf(e)
		http.Error(w, e, http.StatusInternalServerError)
		return
	}
}
func GetItemHandler ( w http . ResponseWriter , req * http . Request ) { if bbpd_runinfo . BBPDAbortIfClosed ( w ) { return } start := time . Now ( ) if req . Method != " " { e := " " log . Printf ( e ) http . Error ( w , e , http . StatusBadRequest ) return } pathElts := strings . Split ( req . URL . Path , " " ) if len ( pathElts ) != 2 { e := " " log . Printf ( e ) http . Error ( w , e , http . StatusBadRequest ) return } bodybytes , read_err := ioutil . ReadAll ( req . Body ) req . Body . Close ( ) if read_err != nil && read_err != io . EOF { e := fmt . Sprintf ( " " , read_err . Error ( ) ) log . Printf ( e ) http . Error ( w , e , http . StatusInternalServerError ) return } g := get . NewGetItem ( ) um_err := json . Unmarshal ( bodybytes , g ) if um_err != nil { e := fmt . Sprintf ( " " , string ( bodybytes ) , um_err . Error ( ) ) log . Printf ( e ) http . Error ( w , e , http . StatusInternalServerError ) return } resp_body , code , resp_err := g . EndpointReq ( ) if resp_err != nil { e := fmt . Sprintf ( " " , resp_err . Error ( ) ) log . Printf ( e ) http . Error ( w , e , http . StatusInternalServerError ) return } if ep . HttpErr ( code ) { route_response . WriteError ( w , code , " " , resp_body ) return } mr_err := route_response . MakeRouteResponse ( w , req , resp_body , code , start , get . ENDPOINT_NAME ) if mr_err != nil { e := fmt . Sprintf ( " " , mr_err . Error ( ) ) log . Printf ( e ) http . Error ( w , e , http . StatusInternalServerError ) return } }
GetItemHandler relays the GetItem request to Dynamo but first validates it through a local type.
GetItemHandler relays the GetItem request to Dynamo but first validates it through a local type .