hadoop-hdfs-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Haohui Mai (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (HDFS-6169) Move the address in WebImageViewer
Date Fri, 04 Apr 2014 20:36:17 GMT

    [ https://issues.apache.org/jira/browse/HDFS-6169?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13960391#comment-13960391
] 

Haohui Mai commented on HDFS-6169:
----------------------------------

{code}
+      String path = decoder.getPath();
+      try {
+        Preconditions.checkArgument(path.startsWith("/webhdfs/v1"),
+            "Path: " + path + " should start with \"/webhdfs/v1\".");
+        path = path.replaceFirst("/webhdfs/v1", "");
+      } catch (Exception ex) {
+        LOG.warn(ex.getMessage());
+        response.setStatus(HttpResponseStatus.NOT_FOUND);
+        LOG.info(response.getStatus().getCode() + " method=GET target="
+            + decoder.getPath());
+        e.getChannel().write(response)
+            .addListener(ChannelFutureListener.CLOSE);
+        return;
+      }
{code}

It's better to simply use an if statement here. It's also better to extract most of the logic
into a separate function, so that you can easily ensure that {{e.getChannel().write(response).addListener(ChannelFutureListener.CLOSE);}}
is called in {{messageReceived()}}.

For the unit test, I think it might be better to create a {{WebHdfsFileSystem}} instance to
test it, because the code intends to expose the WebHDFS API. It's okay if you don't want to
address it in this jira, but please file another jira to keep track of it.


> Move the address in WebImageViewer
> ----------------------------------
>
>                 Key: HDFS-6169
>                 URL: https://issues.apache.org/jira/browse/HDFS-6169
>             Project: Hadoop HDFS
>          Issue Type: Sub-task
>          Components: tools
>    Affects Versions: 2.5.0
>            Reporter: Akira AJISAKA
>            Assignee: Akira AJISAKA
>         Attachments: HDFS-6169.2.patch, HDFS-6169.3.patch, HDFS-6169.4.patch, HDFS-6169.patch
>
>
> Move the endpoint of WebImageViewer from http://hostname:port/ to http://hostname:port/webhdfs/v1/
to support {{hdfs dfs -ls}} to WebImageViewer.



--
This message was sent by Atlassian JIRA
(v6.2#6252)

Mime
View raw message