java.net.HttpURLConnection#HTTP_INTERNAL_ERROR源码实例Demo

下面列出了java.net.HttpURLConnection#HTTP_INTERNAL_ERROR 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

源代码1 项目: hono   文件: JmsBasedTenantClient.java
/**
 * {@inheritDoc}
 */
@Override
protected TenantResult<TenantObject> getResult(final int status, final Buffer payload, final CacheDirective cacheDirective) {

    if (payload == null) {
        return TenantResult.from(status);
    } else {
        try {
            final JsonObject json = payload.toJsonObject();
            final TenantObject tenant = json.mapTo(TenantObject.class);
            return TenantResult.from(status, tenant, cacheDirective);
        } catch (DecodeException e) {
            LOGGER.warn("Tenant service returned malformed payload", e);
            throw new ServiceInvocationException(
                    HttpURLConnection.HTTP_INTERNAL_ERROR,
                    "Tenant service returned malformed payload");
        }
    }
}
 
源代码2 项目: lams   文件: HttpWebResponse.java
private void readResponseHeader( HttpURLConnection connection ) throws IOException {
    if (!needStatusWorkaround()) {
        _responseCode = connection.getResponseCode();
        _responseMessage = connection.getResponseMessage();
    } else {
         if (connection.getHeaderField(0) == null) throw new UnknownHostException( connection.getURL().toExternalForm() );

        StringTokenizer st = new StringTokenizer( connection.getHeaderField(0) );
        st.nextToken();
        if (!st.hasMoreTokens()) {
            _responseCode = HttpURLConnection.HTTP_OK;
            _responseMessage = "OK";
        } else try {
            _responseCode = Integer.parseInt( st.nextToken() );
            _responseMessage = getRemainingTokens( st );
        } catch (NumberFormatException e) {
            _responseCode = HttpURLConnection.HTTP_INTERNAL_ERROR;
            _responseMessage = "Cannot parse response header";
        }
    }
}
 
源代码3 项目: jare   文件: TkAppFallback.java
/**
 * Make fatal error page.
 * @param req Request
 * @return Response
 * @throws IOException If fails
 */
private static Response fatal(final RqFallback req) throws IOException {
    return new RsWithStatus(
        new RsWithType(
            new RsVelocity(
                TkAppFallback.class.getResource("error.html.vm"),
                new RsVelocity.Pair(
                    "err",
                    ExceptionUtils.getStackTrace(req.throwable())
                ),
                new RsVelocity.Pair("rev", TkAppFallback.REV)
            ),
            "text/html"
        ),
        HttpURLConnection.HTTP_INTERNAL_ERROR
    );
}
 
源代码4 项目: opencps-v2   文件: DossierTemplateManagement.java
@PUT
@Path("/{id}")
@Consumes({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON, MediaType.APPLICATION_FORM_URLENCODED })
@Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
@ApiOperation(value = "Update a DossierTemplate", response = DossierTemplateInputModel.class)
@ApiResponses(value = {
		@ApiResponse(code = HttpURLConnection.HTTP_OK, message = "Returns the DossierTemplate was update", response = DossierTemplateInputModel.class),
		@ApiResponse(code = HttpURLConnection.HTTP_FORBIDDEN, message = "Access denied", response = ExceptionModel.class),
		@ApiResponse(code = HttpURLConnection.HTTP_NOT_FOUND, message = "Not found", response = ExceptionModel.class),
		@ApiResponse(code = HttpURLConnection.HTTP_INTERNAL_ERROR, message = "Internal error", response = ExceptionModel.class) })

public Response updateDossierTemplateDetail(@Context HttpServletRequest request, @Context HttpHeaders header,
		@Context Company company, @Context Locale locale, @Context User user,
		@Context ServiceContext serviceContext, @PathParam("id") long id,
		@BeanParam DossierTemplateInputModel input);
 
源代码5 项目: opencps-v2   文件: MenuRoleManagement.java
@POST
@Path("/autogenerate")
@Consumes({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON, MediaType.APPLICATION_FORM_URLENCODED })
@Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON, MediaType.APPLICATION_FORM_URLENCODED })
@ApiResponses(value = {
		@ApiResponse(code = HttpURLConnection.HTTP_FORBIDDEN, message = "Access denied", response = ExceptionModel.class),
		@ApiResponse(code = HttpURLConnection.HTTP_INTERNAL_ERROR, message = "Internal error", response = ExceptionModel.class) })
public Response autoGenerateId(@Context HttpServletRequest request, @Context HttpHeaders header, @Context Company company,
		@Context Locale locale, @Context User user, @Context ServiceContext serviceContext);
 
源代码6 项目: openjdk-jdk9   文件: HttpTransportPipe.java
private void checkStatusCode(InputStream in, HttpClientTransport con) throws IOException {
    int statusCode = con.statusCode;
    String statusMessage = con.statusMessage;
    // SOAP1.1 and SOAP1.2 differ here
    if (binding instanceof SOAPBinding) {
        if (binding.getSOAPVersion() == SOAPVersion.SOAP_12) {
            //In SOAP 1.2, Fault messages can be sent with 4xx and 5xx error codes
            if (statusCode == HttpURLConnection.HTTP_OK || statusCode == HttpURLConnection.HTTP_ACCEPTED || isErrorCode(statusCode)) {
                // acceptable status codes for SOAP 1.2
                if (isErrorCode(statusCode) && in == null) {
                    // No envelope for the error, so throw an exception with http error details
                    throw new ClientTransportException(ClientMessages.localizableHTTP_STATUS_CODE(statusCode, statusMessage));
                }
                return;
            }
        } else {
            // SOAP 1.1
            if (statusCode == HttpURLConnection.HTTP_OK || statusCode == HttpURLConnection.HTTP_ACCEPTED || statusCode == HttpURLConnection.HTTP_INTERNAL_ERROR) {
                // acceptable status codes for SOAP 1.1
                if (statusCode == HttpURLConnection.HTTP_INTERNAL_ERROR && in == null) {
                    // No envelope for the error, so throw an exception with http error details
                    throw new ClientTransportException(ClientMessages.localizableHTTP_STATUS_CODE(statusCode, statusMessage));
                }
                return;
            }
        }
        if (in != null) {
            in.close();
        }
        throw new ClientTransportException(ClientMessages.localizableHTTP_STATUS_CODE(statusCode, statusMessage));
    }
    // Every status code is OK for XML/HTTP
}
 
源代码7 项目: opencps-v2   文件: SystemManagement.java
@GET
@Path("/progress/{backgroundTaskId}")
@Consumes({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON, MediaType.APPLICATION_FORM_URLENCODED })
@Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
@ApiOperation(value = "Clean a site", response = BackgroundTaskProgress.class)
@ApiResponses(value = {
		@ApiResponse(code = HttpURLConnection.HTTP_OK, message = "Returns a background was created", response = BackgroundTaskProgress.class),
		@ApiResponse(code = HttpURLConnection.HTTP_UNAUTHORIZED, message = "Unauthorized", response = ExceptionModel.class),
		@ApiResponse(code = HttpURLConnection.HTTP_FORBIDDEN, message = "Access denied", response = ExceptionModel.class),
		@ApiResponse(code = HttpURLConnection.HTTP_INTERNAL_ERROR, message = "Internal error", response = ExceptionModel.class) })

public Response getProgress(@Context HttpServletRequest request, @Context HttpHeaders header,
		@Context Company company, @Context Locale locale, @Context User user,
		@Context ServiceContext serviceContext, @PathParam("backgroundTaskId") Long backgroundTaskId);
 
源代码8 项目: openjdk-8-source   文件: HttpTransportPipe.java
private void checkStatusCode(InputStream in, HttpClientTransport con) throws IOException {
    int statusCode = con.statusCode;
    String statusMessage = con.statusMessage;
    // SOAP1.1 and SOAP1.2 differ here
    if (binding instanceof SOAPBinding) {
        if (binding.getSOAPVersion() == SOAPVersion.SOAP_12) {
            //In SOAP 1.2, Fault messages can be sent with 4xx and 5xx error codes
            if (statusCode == HttpURLConnection.HTTP_OK || statusCode == HttpURLConnection.HTTP_ACCEPTED || isErrorCode(statusCode)) {
                // acceptable status codes for SOAP 1.2
                if (isErrorCode(statusCode) && in == null) {
                    // No envelope for the error, so throw an exception with http error details
                    throw new ClientTransportException(ClientMessages.localizableHTTP_STATUS_CODE(statusCode, statusMessage));
                }
                return;
            }
        } else {
            // SOAP 1.1
            if (statusCode == HttpURLConnection.HTTP_OK || statusCode == HttpURLConnection.HTTP_ACCEPTED || statusCode == HttpURLConnection.HTTP_INTERNAL_ERROR) {
                // acceptable status codes for SOAP 1.1
                if (statusCode == HttpURLConnection.HTTP_INTERNAL_ERROR && in == null) {
                    // No envelope for the error, so throw an exception with http error details
                    throw new ClientTransportException(ClientMessages.localizableHTTP_STATUS_CODE(statusCode, statusMessage));
                }
                return;
            }
        }
        if (in != null) {
            in.close();
        }
        throw new ClientTransportException(ClientMessages.localizableHTTP_STATUS_CODE(statusCode, statusMessage));
    }
    // Every status code is OK for XML/HTTP
}
 
源代码9 项目: opencps-v2   文件: PaymentConfigManagement.java
@GET
@Path("/{id}")
@Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
@ApiOperation(value = "Get the PaymentConfig by primekey", response = PaymentConfigInputModel.class)
@ApiResponses(value = {
		@ApiResponse(code = HttpURLConnection.HTTP_OK, message = "Returns detail of PaymentConfig", response = PaymentConfigInputModel.class),
		@ApiResponse(code = HttpURLConnection.HTTP_FORBIDDEN, message = "Access denied", response = ExceptionModel.class),
		@ApiResponse(code = HttpURLConnection.HTTP_NOT_FOUND, message = "Not found", response = ExceptionModel.class),
		@ApiResponse(code = HttpURLConnection.HTTP_INTERNAL_ERROR, message = "Internal error", response = ExceptionModel.class) })

public Response getPaymentConfigDetail(@Context HttpServletRequest request, @Context HttpHeaders header,
		@Context Company company, @Context Locale locale, @Context User user,
		@Context ServiceContext serviceContext, @PathParam("id") long id);
 
源代码10 项目: opencps-v2   文件: PaymentFileManagement.java
@GET
@Path("/{id}/payments/{referenceUid}/epaymentprofile")
@Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON})
@ApiOperation(value = "get info epayment profile", response = String.class)
@ApiResponses(value = {
			@ApiResponse (code = HttpURLConnection.HTTP_OK, message = "Get info epayment profile", response = String.class),
			@ApiResponse (code = HttpURLConnection.HTTP_NOT_FOUND, message = "Not Found", response = ExceptionModel.class),
			@ApiResponse (code = HttpURLConnection.HTTP_FORBIDDEN, message = "Accsess denied", response = ExceptionModel.class),
			@ApiResponse(code = HttpURLConnection.HTTP_INTERNAL_ERROR, message = "Internal error", response = ExceptionModel.class)})
public Response getEpaymentProfile(@Context HttpServletRequest request, @Context HttpHeaders header, @Context Company company,
		@Context Locale locale, @Context User user, @Context ServiceContext serviceContext,
		@ApiParam(value = "id of dossier", required = true) @PathParam("id") String id,
		@ApiParam (value = "referenceUid of Payment", required = true) @PathParam("referenceUid") String referenceUid);
 
源代码11 项目: opencps-v2   文件: VNPostManagement.java
@POST
@Path("/cancelOrder")
@ApiOperation(value = "requestsToken")
@Consumes({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON, MediaType.APPLICATION_FORM_URLENCODED })
@Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
@ApiResponses(value = {
		@ApiResponse(code = HttpURLConnection.HTTP_OK, message = "Send request to VNPost successful", response = String.class),
		@ApiResponse(code = HttpURLConnection.HTTP_FORBIDDEN, message = "Access denied", response = ExceptionModel.class),
		@ApiResponse(code = HttpURLConnection.HTTP_NOT_FOUND, message = "Not found", response = ExceptionModel.class),
		@ApiResponse(code = HttpURLConnection.HTTP_INTERNAL_ERROR, message = "Internal error", response = ExceptionModel.class) 
})
public Response cancelOrder(@Context HttpServletRequest request, @Context HttpHeaders header,
		@Context Company company, @Context Locale locale, @Context User user,
		@Context ServiceContext serviceContext,@BeanParam VNPostCancelOrderModel input);
 
源代码12 项目: opencps-v2   文件: FaqManagement.java
@PUT
@Path("/questions/{id}")
@Consumes({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON, MediaType.APPLICATION_FORM_URLENCODED })
@Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON, MediaType.APPLICATION_FORM_URLENCODED })
@ApiOperation(value = "Add a question", response = QuestionDetailModel.class)
@ApiResponses(value = {
		@ApiResponse(code = HttpURLConnection.HTTP_OK, message = "Returns a question was created", response = QuestionDetailModel.class),
		@ApiResponse(code = HttpURLConnection.HTTP_FORBIDDEN, message = "Access denied", response = ExceptionModel.class),
		@ApiResponse(code = HttpURLConnection.HTTP_INTERNAL_ERROR, message = "Internal error", response = ExceptionModel.class) })
public Response updateQuestion(@Context HttpServletRequest request, @Context HttpHeaders header, @Context Company company,
		@Context Locale locale, @Context User user, @Context ServiceContext serviceContext,
		@PathParam("id") String id,
		@BeanParam QuestionInputModel input);
 
源代码13 项目: opencps-v2   文件: ApplicantManagement.java
@POST
@Path("/withcaptcha")
@Consumes({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON, MediaType.APPLICATION_FORM_URLENCODED })
@Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON, MediaType.APPLICATION_FORM_URLENCODED })
@ApiOperation(value = "Register a applicant", response = ApplicantModel.class)
@ApiResponses(value = {
		@ApiResponse(code = HttpURLConnection.HTTP_OK, message = "Returns a applicant was created", response = ApplicantModel.class),
		@ApiResponse(code = HttpURLConnection.HTTP_FORBIDDEN, message = "Access denied", response = ExceptionModel.class),
		@ApiResponse(code = HttpURLConnection.HTTP_INTERNAL_ERROR, message = "Internal error", response = ExceptionModel.class) })
public Response registerWithCaptcha(@Context HttpServletRequest request, @Context HttpHeaders header, @Context Company company,
		@Context Locale locale, @Context User user, @Context ServiceContext serviceContext,
		@BeanParam ApplicantInputModel input, @FormParam("j_captcha_response") String jCaptchaResponse);
 
源代码14 项目: opencps-v2   文件: PaymentConfigManagement.java
@GET
@Path("/{id}/epaymentconfig")
@Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
@ApiOperation(value = "Get the epaymentconfig", response = PaymentConfigSingleInputModel.class)
@ApiResponses(value = {
		@ApiResponse(code = HttpURLConnection.HTTP_OK, message = "Returns epaymentconfig of PaymentConfig", response = PaymentConfigSingleInputModel.class),
		@ApiResponse(code = HttpURLConnection.HTTP_FORBIDDEN, message = "Access denied", response = ExceptionModel.class),
		@ApiResponse(code = HttpURLConnection.HTTP_NOT_FOUND, message = "Not found", response = ExceptionModel.class),
		@ApiResponse(code = HttpURLConnection.HTTP_INTERNAL_ERROR, message = "Internal error", response = ExceptionModel.class) })

public Response getEpaymentconfig(@Context HttpServletRequest request, @Context HttpHeaders header,
		@Context Company company, @Context Locale locale, @Context User user,
		@Context ServiceContext serviceContext, @PathParam("id") long id);
 
源代码15 项目: opencps-v2   文件: DossierActionManagement.java
@GET
@Path("/{id}/deliverableState/{state}")
@ApiOperation(value = "deliverableState")
@ApiResponses(value = {
		@ApiResponse(code = HttpURLConnection.HTTP_OK, message = "Returns list deliverable is success", response = String.class),
		@ApiResponse(code = HttpURLConnection.HTTP_FORBIDDEN, message = "Access denied", response = ExceptionModel.class),
		@ApiResponse(code = HttpURLConnection.HTTP_NOT_FOUND, message = "Not found", response = ExceptionModel.class),
		@ApiResponse(code = HttpURLConnection.HTTP_INTERNAL_ERROR, message = "Internal error", response = ExceptionModel.class) })
public Response getByDeliverableState(@Context HttpServletRequest request, @Context HttpHeaders header,
		@Context Company company, @Context Locale locale, @Context User user,
		@Context ServiceContext serviceContext, @PathParam("id") Long id, @PathParam("state") String state);
 
源代码16 项目: opencps-v2   文件: ServiceProcessManagement.java
@POST
@Consumes({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON, MediaType.APPLICATION_FORM_URLENCODED })
@Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
@ApiOperation(value = "Add a ServiceProcesses", response = ServiceProcessInputModel.class)
@ApiResponses(value = {
		@ApiResponse(code = HttpURLConnection.HTTP_OK, message = "Returns the ServiceProcesses was created", response = ServiceProcessInputModel.class),
		@ApiResponse(code = HttpURLConnection.HTTP_UNAUTHORIZED, message = "Unauthorized", response = ExceptionModel.class),
		@ApiResponse(code = HttpURLConnection.HTTP_FORBIDDEN, message = "Access denied", response = ExceptionModel.class),
		@ApiResponse(code = HttpURLConnection.HTTP_INTERNAL_ERROR, message = "Internal error", response = ExceptionModel.class) })

public Response addServiceProcesses(@Context HttpServletRequest request, @Context HttpHeaders header,
		@Context Company company, @Context Locale locale, @Context User user,
		@Context ServiceContext serviceContext, @BeanParam ServiceProcessInputModel input);
 
源代码17 项目: sa-sdk-android   文件: AnalyticsMessages.java
/**
 * 在服务器正常返回状态码的情况下,目前只有 (>= 500 && < 600) || 404 || 403 才不删数据
 *
 * @param httpCode 状态码
 * @return true: 删除数据,false: 不删数据
 */
private boolean isDeleteEventsByCode(int httpCode) {
    boolean shouldDelete = true;
    if (httpCode == HttpURLConnection.HTTP_NOT_FOUND ||
            httpCode == HttpURLConnection.HTTP_FORBIDDEN ||
            (httpCode >= HttpURLConnection.HTTP_INTERNAL_ERROR && httpCode < 600)) {
        shouldDelete = false;
    }
    return shouldDelete;
}
 
源代码18 项目: cellery-distribution   文件: RequestProcessor.java
/**
 * Validate the http response.
 * @param statusCode status code
 * @return boolean to validate response
 */
private boolean responseValidate(int statusCode, String response) throws IOException {
    boolean isValid = false;
    switch (statusCode) {
        case HttpURLConnection.HTTP_OK:
            isValid = true;
            break;
        case HttpURLConnection.HTTP_CREATED:
            isValid = true;
            break;
        case HttpURLConnection.HTTP_ACCEPTED:
            isValid = true;
            break;
        case HttpURLConnection.HTTP_BAD_REQUEST:
            if (response != null && !Constants.Utils.EMPTY_STRING.equals(response)) {
                if (response.contains(Constants.Utils.DIFFERENT_CONTEXT_ERROR) ||
                    response.contains(Constants.Utils.DUPLICATE_CONTEXT_ERROR)) {
                    // skip the error when trying to add the same api with different context.
                    isValid = true;
                }
            }
            break;
        case HttpURLConnection.HTTP_UNAUTHORIZED:
            isValid = false;
            break;
        case HttpURLConnection.HTTP_NOT_FOUND:
            isValid = false;
            break;
        case HttpURLConnection.HTTP_CONFLICT:
            if (response != null && !Constants.Utils.EMPTY_STRING.equals(response)) {
                if (response.contains(Constants.Utils.DUPLICATE_API_ERROR)) {
                    // skip the error when trying to add the same api.
                    isValid = true;
                }
            }
            break;
        case HttpURLConnection.HTTP_INTERNAL_ERROR:
            if (response != null && !Constants.Utils.EMPTY_STRING.equals(response)) {
                if (response.contains(Constants.Utils.DUPLICATE_LABEL_ERROR)) {
                    // skip the error when trying to add the same label.
                    isValid = true;
                }
            }
            break;
        default:
            isValid = false;
    }
    return isValid;
}
 
源代码19 项目: genie   文件: GenieServerException.java
/**
 * Constructor.
 *
 * @param msg   human readable message
 * @param cause reason for this exception
 */
public GenieServerException(final String msg, final Throwable cause) {
    super(HttpURLConnection.HTTP_INTERNAL_ERROR, msg, cause);
}
 
源代码20 项目: genie   文件: GenieServerException.java
/**
 * Constructor.
 *
 * @param msg human readable message
 */
public GenieServerException(final String msg) {
    super(HttpURLConnection.HTTP_INTERNAL_ERROR, msg);
}