// URI return the real address of this server
345034
func (server *TCPServer) URI() string {
	if server.listener == nil {
		panic(ErrServerIsNotStarted)
	}
	u, err := url.Parse(server.uri)
	if err != nil {
		panic(err)
	}
	return u.Scheme + "://" + server.listener.Addr().String()
}
96117
func (r *URIBuilder) ClientURI(s string) *URIBuilder {
	r.clientURI = s
	return r
}
169733
func (k RRSetKey) AlertsQueryURI(offset int) string {
	uri := k.AlertsURI()
	if offset != 0 {
		uri = fmt.Sprintf("%s?offset=%d", uri, offset)
	}
	return uri
}
787783
func (p *Processor) RedirectURI(originURL string) string {
	p.RLock()
	defer p.RUnlock()

	return p.userTokenHandler.IssueRedirect(originURL)
}
344960
func (req *Request) GetRequestURI() string {
	uri, _ := req.GetValue(HTTP_REQUEST_URI).(string)
	return uri
}
253752
func ParseSessionsURI(in string) (*url.URL, error) {
	if in == "" {
		return nil, trace.BadParameter("uri is empty")
	}
	u, err := url.Parse(in)
	if err != nil {
		return nil, trace.BadParameter("failed to parse URI %q: %v", in, err)
	}
	if u.Scheme == "" {
		u.Scheme = teleport.SchemeFile
	}
	return u, nil
}
810078
func (s *ResourceUri) SetUri(v string) *ResourceUri {
	s.Uri = &v
	return s
}
217934
func WithURI(uri string) ClientOptionFunc {
	return func(c *Client) error {
		_, err := mgo.ParseURL(uri)
		if err != nil {
			return client.InvalidURIError{URI: uri, Err: err.Error()}
		}
		c.uri = uri
		return nil
	}
}
414115
func (c *OAuthAccessCall) RedirectURI(redirectURI string) *OAuthAccessCall {
	c.redirectURI = redirectURI
	return c
}
18001
func DecodeURI(uri string) (raw string, err error) {
	defer func() {
		if r := recover(); r != nil {
			err = r.(*js.Error)
		}
	}()
	raw = js.Global.Call("decodeURI", uri).String()
	return
}
1341706
func (e *Echo) URI(handler interface{}, params ...interface{}) string {
	var uri, name string
	if h, ok := handler.(Handler); ok {
		if hn, ok := h.(Name); ok {
			name = hn.Name()
		} else {
			name = HandlerName(h)
		}
	} else if h, ok := handler.(string); ok {
		name = h
	} else {
		return uri
	}
	if indexes, ok := e.router.nroute[name]; ok && len(indexes) > 0 {
		r := e.router.routes[indexes[0]]
		length := len(params)
		if length == 1 {
			switch val := params[0].(type) {
			case url.Values:
				uri = r.Path
				for _, name := range r.Params {
					tag := `:` + name
					v := val.Get(name)
					uri = strings.Replace(uri, tag+`/`, v+`/`, -1)
					if strings.HasSuffix(uri, tag) {
						uri = strings.TrimSuffix(uri, tag) + v
					}
					val.Del(name)
				}
				q := val.Encode()
				if len(q) > 0 {
					uri += `?` + q
				}
			case map[string]string:
				uri = r.Path
				for _, name := range r.Params {
					tag := `:` + name
					v, y := val[name]
					if y {
						delete(val, name)
					}
					uri = strings.Replace(uri, tag+`/`, v+`/`, -1)
					if strings.HasSuffix(uri, tag) {
						uri = strings.TrimSuffix(uri, tag) + v
					}
				}
				sep := `?`
				keys := make([]string, 0, len(val))
				for k := range val {
					keys = append(keys, k)
				}
				sort.Strings(keys)
				for _, k := range keys {
					uri += sep + url.QueryEscape(k) + `=` + url.QueryEscape(val[k])
					sep = `&`
				}
			case []interface{}:
				uri = fmt.Sprintf(r.Format, val...)
			default:
				uri = fmt.Sprintf(r.Format, val)
			}
		} else {
			uri = fmt.Sprintf(r.Format, params...)
		}
	}
	return uri
}
605654
func (s *Server) URL() (u *url.URL, err error) {
	if s.Scheme == "" {
		return u, fmt.Errorf("Server %s:%d has no scheme, cannot make a URL", s.Host, s.Port)
	}

	ustring := fmt.Sprintf("%s://%s:%d", s.Scheme, s.Host, s.Port)

	u, err = url.Parse(ustring)
	if err != nil {
		return u, fmt.Errorf("Could not parse %s: %s", ustring, err)
	}

	return
}
442428
func (s *GraphqlApi) SetUris(v map[string]*string) *GraphqlApi {
	s.Uris = v
	return s
}
45941
func (r *Request) RequestURI(uri string) *Request {
	if r.err != nil {
		return r
	}
	locator, err := url.Parse(uri)
	if err != nil {
		r.err = err
		return r
	}
	r.pathPrefix = locator.Path
	if len(locator.Query()) > 0 {
		if r.params == nil {
			r.params = make(url.Values)
		}
		for k, v := range locator.Query() {
			r.params[k] = v
		}
	}
	return r
}
1232997
func (s *InputLocation) SetUri(v string) *InputLocation {
	s.Uri = &v
	return s
}
280737
func (u URI) String() string {
	return fmt.Sprintf("%s://%s:%d", u.Scheme, u.Host, u.Port)
}
438363
func baseURI(req *http.Request) string {
	scheme := strings.ToLower(req.URL.Scheme)
	host := strings.ToLower(req.URL.Host)
	if hostPort := strings.Split(host, ":"); len(hostPort) == 2 && (hostPort[1] == "80" || hostPort[1] == "443") {
		host = hostPort[0]
	}
	// TODO: use req.URL.EscapedPath() once Go 1.5 is more generally adopted
	// For now, hacky workaround accomplishes the same internal escaping mode
	// escape(u.Path, encodePath) for proper compliance with the OAuth1 spec.
	path := req.URL.Path
	if path != "" {
		path = strings.Split(req.URL.RequestURI(), "?")[0]
	}
	return fmt.Sprintf("%v://%v%v", scheme, host, path)
}