HDFS-15102. HttpFS: put requests are not supported for path "/". Contributed by hemanthboyina.
This commit is contained in:
parent
93233a7d6e
commit
782c0556fb
|
@ -642,6 +642,29 @@ public class HttpFSServer {
|
||||||
return uriBuilder.build(null);
|
return uriBuilder.build(null);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Special binding for '/' as it is not handled by the wildcard binding.
|
||||||
|
* @param is the inputstream for the request payload.
|
||||||
|
* @param uriInfo the of the request.
|
||||||
|
* @param op the HttpFS operation of the request.
|
||||||
|
* @param params the HttpFS parameters of the request.
|
||||||
|
*
|
||||||
|
* @return the request response.
|
||||||
|
*
|
||||||
|
* @throws IOException thrown if an IO error occurred. Thrown exceptions are
|
||||||
|
* handled by {@link HttpFSExceptionProvider}.
|
||||||
|
* @throws FileSystemAccessException thrown if a FileSystemAccess related
|
||||||
|
* error occurred. Thrown exceptions are handled by
|
||||||
|
* {@link HttpFSExceptionProvider}.
|
||||||
|
*/
|
||||||
|
@PUT
|
||||||
|
@Produces({ MediaType.APPLICATION_JSON + "; " + JettyUtils.UTF_8 })
|
||||||
|
public Response putRoot(InputStream is, @Context UriInfo uriInfo,
|
||||||
|
@QueryParam(OperationParam.NAME) OperationParam op,
|
||||||
|
@Context Parameters params, @Context HttpServletRequest request)
|
||||||
|
throws IOException, FileSystemAccessException {
|
||||||
|
return put(is, uriInfo, "/", op, params, request);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Binding to handle PUT requests.
|
* Binding to handle PUT requests.
|
||||||
|
|
|
@ -1783,5 +1783,12 @@ public class TestHttpFSServer extends HFSTestCase {
|
||||||
// response should be null
|
// response should be null
|
||||||
dfsDirLst = dfs.getErasureCodingPolicy(path1);
|
dfsDirLst = dfs.getErasureCodingPolicy(path1);
|
||||||
Assert.assertNull(dfsDirLst);
|
Assert.assertNull(dfsDirLst);
|
||||||
|
|
||||||
|
// test put opeartion with path as "/"
|
||||||
|
final String dir1 = "/";
|
||||||
|
HttpURLConnection conn3 =
|
||||||
|
putCmdWithReturn(dir1, "SETECPOLICY", "ecpolicy=" + ecPolicyName);
|
||||||
|
// Should return HTTP_OK
|
||||||
|
Assert.assertEquals(HttpURLConnection.HTTP_OK, conn3.getResponseCode());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue