Example usage for org.apache.commons.httpclient HttpStatus SC_INTERNAL_SERVER_ERROR

List of usage examples for org.apache.commons.httpclient HttpStatus SC_INTERNAL_SERVER_ERROR

Introduction

In this page you can find the example usage for org.apache.commons.httpclient HttpStatus SC_INTERNAL_SERVER_ERROR.

Prototype

int SC_INTERNAL_SERVER_ERROR

To view the source code for org.apache.commons.httpclient HttpStatus SC_INTERNAL_SERVER_ERROR.

Click Source Link

Document

<tt>500 Server Error</tt> (HTTP/1.0 - RFC 1945)

Usage

From source file:com.cloud.cluster.ClusterServiceServletHttpHandler.java

@Override
public void handle(HttpRequest request, HttpResponse response, HttpContext context)
        throws HttpException, IOException {

    try {/*from w ww  .  j av a 2 s  .  c  o m*/
        if (s_logger.isTraceEnabled()) {
            s_logger.trace("Start Handling cluster HTTP request");
        }

        parseRequest(request);
        handleRequest(request, response);

        if (s_logger.isTraceEnabled()) {
            s_logger.trace("Handle cluster HTTP request done");
        }

    } catch (Throwable e) {
        if (s_logger.isDebugEnabled()) {
            s_logger.debug("Exception " + e.toString());
        }

        try {
            writeResponse(response, HttpStatus.SC_INTERNAL_SERVER_ERROR, null);
        } catch (Throwable e2) {
            if (s_logger.isDebugEnabled()) {
                s_logger.debug("Exception " + e2.toString());
            }
        }
    }
}

From source file:com.eviware.soapui.impl.rest.mock.RestMockDispatcher.java

private MockResult createServerErrorMockResult(RestMockRequest restMockRequest) {
    restMockRequest.getHttpResponse().setStatus(HttpStatus.SC_INTERNAL_SERVER_ERROR);
    return new RestMockResult(restMockRequest);
}

From source file:edu.unc.lib.dl.cdr.sword.server.servlets.ContainerServlet.java

@RequestMapping(value = { "/{pid}", "/{pid}/*" }, method = RequestMethod.PUT)
public void replaceMetadataOrMetadataAndContent(HttpServletRequest req, HttpServletResponse resp) {
    try {/*from   w  w w . ja  v a 2 s .c o m*/
        this.api.put(req, resp);
    } catch (Exception e) {
        log.error("Failed to update container " + req.getQueryString(), e);
        resp.setStatus(HttpStatus.SC_INTERNAL_SERVER_ERROR);
    }
}

From source file:com.thoughtworks.go.server.service.result.HttpLocalizedOperationResult.java

public void internalServerError(Localizable message) {
    this.message = message;
    httpCode = HttpStatus.SC_INTERNAL_SERVER_ERROR;
}

From source file:com.dotcms.rest.SyncPollsResource.java

@POST
@Path("/sync")
@Consumes(MediaType.MULTIPART_FORM_DATA)
public Response publish(@FormDataParam("csvZip") InputStream csvZip,
        @FormDataParam("csvZip") FormDataContentDisposition fileDetail, @Context HttpServletRequest req) {

    try {//  w w w.j  a  va2  s.  c o m
        String csvPath = pAPI.loadProperty(PollsConstants.PLUGIN_ID, PollsConstants.PROP_GET_CSV_JOB_SRC_PATH);

        //Scompatto il file
        untar(csvZip, csvPath, fileDetail.getFileName());

        return Response.status(HttpStatus.SC_OK).build();

    } catch (DotDataException e) {
        Logger.error(SyncPollsResource.class, e.getMessage(), e);
    }

    return Response.status(HttpStatus.SC_INTERNAL_SERVER_ERROR).build();
}

From source file:es.carebear.rightmanagement.client.user.AddAllowedUserId.java

public void AddUser(String authName, String target, String rigthTarget, String rightMask)
        throws BadRequestException, InternalServerErrorException, IOException, UnknownResponseException {
    PostMethod postMethod = new PostMethod(baseUri + "/client/users/change/allowed/" + target);
    postMethod.addParameter("authName", authName);
    postMethod.addParameter("rigthTarget", rigthTarget);
    postMethod.addParameter("rightMask", rightMask);
    int responseCode = httpClient.executeMethod(postMethod);

    switch (responseCode) {
    case HttpStatus.SC_OK:
        break;//from  w w  w .  j a  v  a 2 s .co m
    case HttpStatus.SC_BAD_REQUEST:
        throw new BadRequestException();
    case HttpStatus.SC_INTERNAL_SERVER_ERROR:
        throw new InternalServerErrorException();
    case HttpStatus.SC_FORBIDDEN:
        throw new ForbiddenException();
    default:
        throw new UnknownResponseException((new Integer(responseCode)).toString());
    }
}

From source file:edu.unc.lib.dl.cdr.sword.server.servlets.ContainerServlet.java

@RequestMapping(value = { "/{pid}", "/{pid}/*" }, method = RequestMethod.POST)
public void addMetadataOrMetadataAndContent(HttpServletRequest req, HttpServletResponse resp) {
    try {//  w ww .  ja  va  2s .  co m
        this.api.post(req, resp);
    } catch (Exception e) {
        log.error("Failed to update container " + req.getQueryString(), e);
        resp.setStatus(HttpStatus.SC_INTERNAL_SERVER_ERROR);
    }
}

From source file:com.sdm.core.resource.RestResource.java

@Override
public IBaseResponse getNamedQueries() {
    DefaultResponse response = this.validateCache();
    // Cache validation
    if (response != null) {
        return response;
    }/*from   ww w.j a va2 s.  c om*/

    try {
        T instance = getEntityClass().newInstance();
        response = new DefaultResponse<>(instance.getQueries());
        response.setCode(HttpStatus.SC_OK);
        response.setStatus(ResponseType.SUCCESS);
        // Set Cache Header Info
        response.setHeaders(this.buildCache());
        return response;
    } catch (InstantiationException | IllegalAccessException e) {
        throw new WebApplicationException(e.getLocalizedMessage(), HttpStatus.SC_INTERNAL_SERVER_ERROR);
    }

}

From source file:edu.unc.lib.dl.cdr.sword.server.servlets.ContainerServlet.java

@RequestMapping(value = { "/{pid}", "/{pid}/*" }, method = RequestMethod.GET)
public void getDepositReceiptOrStatement(HttpServletRequest req, HttpServletResponse resp) {
    try {/*from  w  w w.  j av  a 2  s.  c o  m*/
        this.api.get(req, resp);
    } catch (Exception e) {
        log.error("Failed to get deposit receipt for " + req.getQueryString(), e);
        resp.setStatus(HttpStatus.SC_INTERNAL_SERVER_ERROR);
    }
}

From source file:exception.handler.configuration.ExceptionNotHandlerConfigTest.java

@Test
public void notHandlerConfiguration() throws HttpException, IOException {
    HttpClient client = new HttpClient();
    GetMethod method = new GetMethod(deploymentUrl + "/index.jsf");

    assertEquals(HttpStatus.SC_INTERNAL_SERVER_ERROR, client.executeMethod(method));
}