List of usage examples for java.net HttpURLConnection HTTP_PRECON_FAILED
int HTTP_PRECON_FAILED
To view the source code for java.net HttpURLConnection HTTP_PRECON_FAILED.
Click Source Link
From source file:com.netflix.genie.server.resources.ClusterConfigResource.java
/** * Delete the all tags from a given cluster. * * @param id The id of the cluster to delete the tags from. * Not null/empty/blank./*from w ww . j av a 2s . co m*/ * @return Empty set if successful * @throws GenieException For any error */ @DELETE @Path("/{id}/tags") @ApiOperation(value = "Remove all tags from a cluster", notes = "Remove all the tags from the cluster with given id. Note that the genie name space tags" + "prefixed with genie.id and genie.name cannot be deleted.", response = String.class, responseContainer = "List") @ApiResponses(value = { @ApiResponse(code = HttpURLConnection.HTTP_NOT_FOUND, message = "Cluster not found"), @ApiResponse(code = HttpURLConnection.HTTP_PRECON_FAILED, message = "Invalid required parameter supplied"), @ApiResponse(code = HttpURLConnection.HTTP_INTERNAL_ERROR, message = "Genie Server Error due to Unknown Exception") }) public Set<String> removeAllTagsForCluster( @ApiParam(value = "Id of the cluster to delete from.", required = true) @PathParam("id") final String id) throws GenieException { LOG.info("Called with id " + id); return this.clusterConfigService.removeAllTagsForCluster(id); }
From source file:com.netflix.genie.server.resources.CommandConfigResource.java
/** * Remove an tag from a given command./*from www . ja v a2 s. c o m*/ * * @param id The id of the command to delete the tag from. Not * null/empty/blank. * @param tag The tag to remove. Not null/empty/blank. * @return The active set of tags for the command. * @throws GenieException For any error */ @DELETE @Path("/{id}/tags/{tag}") @ApiOperation(value = "Remove a tag from a command", notes = "Remove the given tag from the command with given id. Note that the genie name space tags" + "prefixed with genie.id and genie.name cannot be deleted.", response = String.class, responseContainer = "List") @ApiResponses(value = { @ApiResponse(code = HttpURLConnection.HTTP_NOT_FOUND, message = "Command not found"), @ApiResponse(code = HttpURLConnection.HTTP_PRECON_FAILED, message = "Invalid required parameter supplied"), @ApiResponse(code = HttpURLConnection.HTTP_INTERNAL_ERROR, message = "Genie Server Error due to Unknown Exception") }) public Set<String> removeTagForCommand( @ApiParam(value = "Id of the command to delete from.", required = true) @PathParam("id") final String id, @ApiParam(value = "The tag to remove.", required = true) @PathParam("tag") final String tag) throws GenieException { LOG.info("Called with id " + id + " and tag " + tag); return this.commandConfigService.removeTagForCommand(id, tag); }
From source file:com.netflix.genie.server.resources.ApplicationConfigResource.java
/** * Get all the commands this application is associated with. * * @param id The id of the application to get the commands for. Not * NULL/empty/blank.//w w w . ja va2s.c o m * @param statuses The various statuses of the commands to retrieve * @return The set of commands. * @throws GenieException For any error */ @GET @Path("/{id}/commands") @ApiOperation(value = "Get the commands this application is associated with", notes = "Get the commands which this application supports.", response = Command.class, responseContainer = "List") @ApiResponses(value = { @ApiResponse(code = HttpURLConnection.HTTP_NOT_FOUND, message = "Application not found"), @ApiResponse(code = HttpURLConnection.HTTP_PRECON_FAILED, message = "Invalid ID supplied"), @ApiResponse(code = HttpURLConnection.HTTP_INTERNAL_ERROR, message = "Genie Server Error due to Unknown Exception") }) public List<Command> getCommandsForApplication( @ApiParam(value = "Id of the application to get the commands for.", required = true) @PathParam("id") final String id, @ApiParam(value = "The statuses of the commands to find.", allowableValues = "ACTIVE, DEPRECATED, INACTIVE") @QueryParam("status") final Set<String> statuses) throws GenieException { LOG.info("Called with id " + id); Set<CommandStatus> enumStatuses = null; if (!statuses.isEmpty()) { enumStatuses = EnumSet.noneOf(CommandStatus.class); for (final String status : statuses) { if (StringUtils.isNotBlank(status)) { enumStatuses.add(CommandStatus.parse(status)); } } } return this.applicationConfigService.getCommandsForApplication(id, enumStatuses); }
From source file:com.netflix.genie.server.resources.ClusterConfigResource.java
/** * Remove an tag from a given cluster./* ww w .j a v a 2 s. c o m*/ * * @param id The id of the cluster to delete the tag from. Not * null/empty/blank. * @param tag The tag to remove. Not null/empty/blank. * @return The active set of tags for the cluster. * @throws GenieException For any error */ @DELETE @Path("/{id}/tags/{tag}") @ApiOperation(value = "Remove a tag from a cluster", notes = "Remove the given tag from the cluster with given id. Note that the genie name space tags" + "prefixed with genie.id and genie.name cannot be deleted.", response = String.class, responseContainer = "List") @ApiResponses(value = { @ApiResponse(code = HttpURLConnection.HTTP_NOT_FOUND, message = "Cluster not found"), @ApiResponse(code = HttpURLConnection.HTTP_PRECON_FAILED, message = "Invalid required parameter supplied"), @ApiResponse(code = HttpURLConnection.HTTP_INTERNAL_ERROR, message = "Genie Server Error due to Unknown Exception") }) public Set<String> removeTagForCluster( @ApiParam(value = "Id of the cluster to delete from.", required = true) @PathParam("id") final String id, @ApiParam(value = "The tag to remove.", required = true) @PathParam("tag") final String tag) throws GenieException { LOG.info("Called with id " + id + " and tag " + tag); return this.clusterConfigService.removeTagForCluster(id, tag); }
From source file:com.netflix.genie.server.resources.ApplicationConfigResource.java
/** * Remove an tag from a given application. * * @param id The id of the application to delete the tag from. Not * null/empty/blank.//from www . j av a 2 s . c o m * @param tag The tag to remove. Not null/empty/blank. * @return The active set of tags for the application. * @throws GenieException For any error */ @DELETE @Path("/{id}/tags/{tag}") @ApiOperation(value = "Remove a tag from a application", notes = "Remove the given tag from the application with given id. Note that the genie name space tags" + "prefixed with genie.id and genie.name cannot be deleted.", response = String.class, responseContainer = "List") @ApiResponses(value = { @ApiResponse(code = HttpURLConnection.HTTP_NOT_FOUND, message = "Application not found"), @ApiResponse(code = HttpURLConnection.HTTP_PRECON_FAILED, message = "Invalid ID supplied"), @ApiResponse(code = HttpURLConnection.HTTP_INTERNAL_ERROR, message = "Genie Server Error due to Unknown Exception") }) public Set<String> removeTagForApplication( @ApiParam(value = "Id of the application to delete from.", required = true) @PathParam("id") final String id, @ApiParam(value = "The tag to remove.", required = true) @PathParam("tag") final String tag) throws GenieException { LOG.info("Called with id " + id + " and tag " + tag); return this.applicationConfigService.removeTagForApplication(id, tag); }
From source file:org.eclipse.orion.server.tests.servlets.files.CoreFilesTest.java
@Test public void testMoveFileOverwrite() throws Exception { String directoryPath = "testMoveFile/directory/path" + System.currentTimeMillis(); String sourcePath = directoryPath + "/source.txt"; String destName = "destination.txt"; String destPath = directoryPath + "/" + destName; createDirectory(directoryPath);/*from w ww. j av a 2s.co m*/ createFile(sourcePath, "This is the contents"); createFile(destPath, "Original file"); //with no-overwrite, move should fail JSONObject requestObject = new JSONObject(); addSourceLocation(requestObject, sourcePath); WebRequest request = getPostFilesRequest(directoryPath, requestObject.toString(), "destination.txt"); request.setHeaderField("X-Create-Options", "copy,no-overwrite"); WebResponse response = webConversation.getResponse(request); assertEquals(HttpURLConnection.HTTP_PRECON_FAILED, response.getResponseCode()); //now omit no-overwrite and move should succeed and return 200 instead of 201 request = getPostFilesRequest(directoryPath, requestObject.toString(), "destination.txt"); request.setHeaderField("X-Create-Options", "move"); response = webConversation.getResponse(request); assertEquals(HttpURLConnection.HTTP_OK, response.getResponseCode()); JSONObject responseObject = new JSONObject(response.getText()); checkFileMetadata(responseObject, destName, null, null, null, null, null, null, null, null); assertFalse(checkFileExists(sourcePath)); assertTrue(checkFileExists(destPath)); }