Java Code Examples for javax.servlet.http.HttpServletResponse#SC_ACCEPTED

The following examples show how to use javax.servlet.http.HttpServletResponse#SC_ACCEPTED . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: DownloadsEntityResource.java    From alfresco-remote-api with GNU Lesser General Public License v3.0 5 votes vote down vote up
@Override
@WebApiDescription(title = "Create download", description = "Create a download node whose content will be a zip which is being created asynchronously.", successStatus = HttpServletResponse.SC_ACCEPTED)
@WebApiParam(name = "entity", title = "Download request", description = "Download request which contains the node ids for the zip elements.", 
             kind = ResourceParameter.KIND.HTTP_BODY_OBJECT, allowMultiple = false)
public List<Download> create(List<Download> entity, Parameters parameters)
{
    Download downloadNode = downloads.createDownloadNode(entity.get(0));
    return Collections.singletonList(downloadNode);
}
 
Example 2
Source File: PeopleEntityResource.java    From alfresco-remote-api with GNU Lesser General Public License v3.0 5 votes vote down vote up
@Operation("request-password-reset")
@WebApiDescription(title = "Request Password Reset", description = "Request password reset",
                   successStatus = HttpServletResponse.SC_ACCEPTED)
@WebApiNoAuth
public void requestPasswordReset(String personId, Client client, Parameters parameters, WithResponse withResponse)
{
    people.requestPasswordReset(personId, client.getClient());
}
 
Example 3
Source File: PeopleEntityResource.java    From alfresco-remote-api with GNU Lesser General Public License v3.0 5 votes vote down vote up
@Operation("reset-password")
@WebApiDescription(title = "Reset Password", description = "Performs password reset", successStatus = HttpServletResponse.SC_ACCEPTED)
@WebApiNoAuth
public void resetPassword(String personId, PasswordReset passwordReset, Parameters parameters, WithResponse withResponse)
{
    people.resetPassword(personId, passwordReset);
}
 
Example 4
Source File: JaxRsUnhandledExceptionHandlerTest.java    From backstopper with Apache License 2.0 5 votes vote down vote up
@Test
public void prepareFrameworkRepresentationReturnsCorrectStatusCode() {

    int expectedCode = HttpServletResponse.SC_ACCEPTED;
    Response.ResponseBuilder actualResponse = handler.prepareFrameworkRepresentation(null, expectedCode, null, null, null);
    assertThat(actualResponse.build().getStatus()).isEqualTo(expectedCode);
}
 
Example 5
Source File: Jersey1UnhandledExceptionHandlerTest.java    From backstopper with Apache License 2.0 5 votes vote down vote up
@Test
public void prepareFrameworkRepresentationReturnsCorrectStatusCode() {

    int expectedCode = HttpServletResponse.SC_ACCEPTED;
    Response.ResponseBuilder actualResponse = handler.prepareFrameworkRepresentation(null, expectedCode, null, null, null);
    assertThat(actualResponse.build().getStatus()).isEqualTo(expectedCode);
}
 
Example 6
Source File: DownloadAction.java    From gocd with Apache License 2.0 5 votes vote down vote up
private int download(HttpService httpService, String url, FetchHandler handler) throws Exception {
    int returnCode = httpService.download(url, handler);
    while (returnCode == HttpServletResponse.SC_ACCEPTED) {
        clock.sleepForMillis(DOWNLOAD_SLEEP_MILLIS);
        returnCode = httpService.download(url, handler);
    }
    return returnCode;
}
 
Example 7
Source File: ArtifactCacheHandler.java    From buck with Apache License 2.0 5 votes vote down vote up
private int handlePut(Request baseRequest, HttpServletResponse response) throws IOException {
  Path temp = null;
  try {
    projectFilesystem.mkdirs(projectFilesystem.getBuckPaths().getScratchDir());
    temp =
        projectFilesystem.createTempFile(
            projectFilesystem.getBuckPaths().getScratchDir(), "incoming_upload", ".tmp");

    HttpArtifactCacheBinaryProtocol.StoreResponseReadResult storeRequest;
    try (DataInputStream requestInputData = new DataInputStream(baseRequest.getInputStream());
        OutputStream tempFileOutputStream = projectFilesystem.newFileOutputStream(temp)) {
      storeRequest =
          HttpArtifactCacheBinaryProtocol.readStoreRequest(
              requestInputData, tempFileOutputStream);
    }

    if (!storeRequest.getActualHashCode().equals(storeRequest.getExpectedHashCode())) {
      response.getWriter().write("Checksum mismatch.");
      return HttpServletResponse.SC_NOT_ACCEPTABLE;
    }

    artifactCache
        .get()
        .store(
            ArtifactInfo.builder()
                .setRuleKeys(storeRequest.getRuleKeys())
                .setMetadata(storeRequest.getMetadata())
                .build(),
            BorrowablePath.borrowablePath(temp));
    return HttpServletResponse.SC_ACCEPTED;
  } finally {
    if (temp != null) {
      projectFilesystem.deleteFileAtPathIfExists(temp);
    }
  }
}
 
Example 8
Source File: DownloadsEntityResource.java    From alfresco-remote-api with GNU Lesser General Public License v3.0 4 votes vote down vote up
@WebApiDescription(title = "Cancel download", description = "Stop the zip creation if still in progress.", successStatus = HttpServletResponse.SC_ACCEPTED)
@Override
public void delete(String nodeId, Parameters parameters)
{
    downloads.cancel(nodeId);
}