Repository: incubator-htrace Updated Branches: refs/heads/master 0557ceaac -> 20f00f9c2
HTRACE-149. htraced: remove unused resource/ directory (cmccabe) Project: http://git-wip-us.apache.org/repos/asf/incubator-htrace/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-htrace/commit/20f00f9c Tree: http://git-wip-us.apache.org/repos/asf/incubator-htrace/tree/20f00f9c Diff: http://git-wip-us.apache.org/repos/asf/incubator-htrace/diff/20f00f9c Branch: refs/heads/master Commit: 20f00f9c232182dc1863c5ad9656d0a214a69aa3 Parents: 0557cea Author: Colin P. Mccabe <[email protected]> Authored: Sun Apr 19 16:59:31 2015 -0700 Committer: Colin P. Mccabe <[email protected]> Committed: Sun Apr 19 16:59:31 2015 -0700 ---------------------------------------------------------------------- htrace-core/src/go/gobuild.sh | 2 -- .../go/src/org/apache/htrace/htraced/rest.go | 25 ----------------- .../src/org/apache/htrace/resource/catalog.go | 29 -------------------- 3 files changed, 56 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-htrace/blob/20f00f9c/htrace-core/src/go/gobuild.sh ---------------------------------------------------------------------- diff --git a/htrace-core/src/go/gobuild.sh b/htrace-core/src/go/gobuild.sh index 40cb4bf..1a4e5f1 100755 --- a/htrace-core/src/go/gobuild.sh +++ b/htrace-core/src/go/gobuild.sh @@ -80,8 +80,6 @@ fi case $ACTION in clean) rm -rf -- "${GOBIN}" ${SCRIPT_DIR}/pkg - find "${SCRIPT_DIR}/src/org/apache/htrace/resource" ! -name 'catalog.go' \ - -type f -exec rm -f {} + ;; install) # Ensure that we have the godep program. http://git-wip-us.apache.org/repos/asf/incubator-htrace/blob/20f00f9c/htrace-core/src/go/src/org/apache/htrace/htraced/rest.go ---------------------------------------------------------------------- diff --git a/htrace-core/src/go/src/org/apache/htrace/htraced/rest.go b/htrace-core/src/go/src/org/apache/htrace/htraced/rest.go index c113a90..978862a 100644 --- a/htrace-core/src/go/src/org/apache/htrace/htraced/rest.go +++ b/htrace-core/src/go/src/org/apache/htrace/htraced/rest.go @@ -25,12 +25,10 @@ import ( "fmt" "github.com/gorilla/mux" "io" - "mime" "net" "net/http" "org/apache/htrace/common" "org/apache/htrace/conf" - "org/apache/htrace/resource" "os" "path/filepath" "strconv" @@ -226,29 +224,6 @@ func (hand *queryHandler) ServeHTTP(w http.ResponseWriter, req *http.Request) { w.Write(jbytes) } -type defaultServeHandler struct { - lg *common.Logger -} - -func (hand *defaultServeHandler) ServeHTTP(w http.ResponseWriter, req *http.Request) { - ident := strings.TrimLeft(req.URL.Path, "/") - if ident == "" { - ident = "index.html" // default to index.html - } - ident = strings.Replace(ident, "/", "__", -1) - hand.lg.Debugf("defaultServeHandler(path=%s, ident=%s)\n", req.URL.Path, ident) - rsc := resource.Catalog[ident] - if rsc == "" { - hand.lg.Warnf("failed to find entry for %s\n", ident) - w.WriteHeader(http.StatusNotFound) - return - } - file_ext := filepath.Ext(req.URL.Path) - mime_type := mime.TypeByExtension(file_ext) - w.Header().Set("Content-Type", mime_type) - w.Write([]byte(rsc)) -} - type logErrorHandler struct { lg *common.Logger } http://git-wip-us.apache.org/repos/asf/incubator-htrace/blob/20f00f9c/htrace-core/src/go/src/org/apache/htrace/resource/catalog.go ---------------------------------------------------------------------- diff --git a/htrace-core/src/go/src/org/apache/htrace/resource/catalog.go b/htrace-core/src/go/src/org/apache/htrace/resource/catalog.go deleted file mode 100644 index 5b71f88..0000000 --- a/htrace-core/src/go/src/org/apache/htrace/resource/catalog.go +++ /dev/null @@ -1,29 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package resource - -// Map containing all resources. -var Catalog map[string]string = make(map[string]string) - -// Function called by generated code to add a resource to the catalog. -func addResource(key, val string) string { - Catalog[key] = val - return key -}
