本文整理汇总了Java中java.net.HttpURLConnection.HTTP_INTERNAL_ERROR属性的典型用法代码示例。如果您正苦于以下问题:Java HttpURLConnection.HTTP_INTERNAL_ERROR属性的具体用法?Java HttpURLConnection.HTTP_INTERNAL_ERROR怎么用?Java HttpURLConnection.HTTP_INTERNAL_ERROR使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类java.net.HttpURLConnection
的用法示例。
在下文中一共展示了HttpURLConnection.HTTP_INTERNAL_ERROR属性的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: route
@Override
public final Opt<Response> route(final RqFallback req) throws IOException {
return new Opt.Single<>(
new RsWithStatus(
new RsHtml(
new RsVelocity(
TkApp.class.getResource("error.html.vm"),
new RsVelocity.Pair(
"err",
new TextOf(req.throwable()).asString()
),
new RsVelocity.Pair(
"rev",
Manifests.read("Rehttp-Revision")
)
)
),
HttpURLConnection.HTTP_INTERNAL_ERROR
)
);
}
示例2: readResponseHeader
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: getStatus
private static int getStatus(int statusCode) {
int status = HttpUrlConnectionUtil.STATUS_ERROR; // default to -1, if status isnt 200, it would be an error
// anyway
switch (statusCode) {
case HttpURLConnection.HTTP_OK:
status = HttpUrlConnectionUtil.STATUS_OK;
break;
case HttpURLConnection.HTTP_INTERNAL_ERROR: // 500
status = HttpUrlConnectionUtil.STATUS_ERROR;
break;
case HttpURLConnection.HTTP_NOT_FOUND: // 404
status = HttpUrlConnectionUtil.STATUS_ERROR;
break;
}
return status;
}
示例4: updateInvoiceForm
@PUT
@Path("/{id}/invoiceform")
@Consumes({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON, MediaType.APPLICATION_FORM_URLENCODED })
@Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
@ApiOperation(value = "Update InvoiceForm", response = PaymentConfigSingleInputModel.class)
@ApiResponses(value = {
@ApiResponse(code = HttpURLConnection.HTTP_OK, message = "Returns InvoiceForm was updated", 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 updateInvoiceForm(@Context HttpServletRequest request, @Context HttpHeaders header,
@Context Company company, @Context Locale locale, @Context User user,
@Context ServiceContext serviceContext, @PathParam("id") long id,
@BeanParam PaymentConfigSingleInputModel input);
示例5: getEpaymentconfig
@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);
示例6: getEpaymentProfile
@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);
示例7: insertDeliverables
@POST
@Path("/deliverables")
@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 Deliverable", response = DeliverableInputModel.class)
@ApiResponses(value = {
@ApiResponse(code = HttpURLConnection.HTTP_OK, message = "Returns a Deliverable was created", response = DeliverableInputModel.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 insertDeliverables(@Context HttpServletRequest request, @Context HttpHeaders header,
@Context Company company, @Context Locale locale, @Context User user,
@Context ServiceContext serviceContext, @BeanParam DeliverableInputModel input);
示例8: getRollback
@GET
@Path("/{id}/rollback")
@ApiOperation(value = "rollback", response = String.class)
@ApiResponses(value = {
@ApiResponse(code = HttpURLConnection.HTTP_OK, message = "Returns rollback 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 getRollback(@Context HttpServletRequest request, @Context HttpHeaders header,
@Context Company company, @Context Locale locale, @Context User user,
@Context ServiceContext serviceContext, @PathParam("id") String id);
示例9: addDeliverableType
@POST
@Consumes({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON, MediaType.APPLICATION_FORM_URLENCODED })
@Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
@ApiOperation(value = "Add a Deliverabletypes", response = DeliverableTypesModel.class)
@ApiResponses(value = {
@ApiResponse(code = HttpURLConnection.HTTP_OK, message = "Returns a Deliverabletypes was created", response = DeliverableTypesModel.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 addDeliverableType(@Context HttpServletRequest request, @Context HttpHeaders header,
@Context Company company, @Context Locale locale, @Context User user,
@Context ServiceContext serviceContext, @BeanParam DeliverableTypeInputModel input);
示例10: addDossier
@POST
@Consumes({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON, MediaType.APPLICATION_FORM_URLENCODED })
@Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
@ApiOperation(value = "Add a Dossier", response = DossierDetailModel.class)
@ApiResponses(value = {
@ApiResponse(code = HttpURLConnection.HTTP_OK, message = "Returns a Dossier was created", response = DossierDetailModel.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 addDossier(@Context HttpServletRequest request, @Context HttpHeaders header,
@Context Company company, @Context Locale locale, @Context User user,
@Context ServiceContext serviceContext, @BeanParam DossierInputModel input);
示例11: getDeliverablesDetail
@GET
@Path("/deliverables/{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 = "Get info a Deliverable")
@ApiResponses(value = {
@ApiResponse(code = HttpURLConnection.HTTP_OK, message = "Returns info a Deliverable "),
@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 getDeliverablesDetail(@Context HttpServletRequest request, @Context HttpHeaders header,
@Context Company company, @Context Locale locale, @Context User user, @Context ServiceContext serviceContext,
@ApiParam(value = "id of Deliverable", required = true) @PathParam("id") Long id);
示例12: validateHeaders
/**
* Examines the headers in the response and throws an exception if appropriate.
**/
private void validateHeaders( WebResponse response ) throws HttpException {
if (!getExceptionsThrownOnErrorStatus()) return;
if (response.getHeaderField( "WWW-Authenticate" ) != null) {
throw new AuthorizationRequiredException( response.getHeaderField( "WWW-Authenticate" ) );
} else if (response.getResponseCode() == HttpURLConnection.HTTP_INTERNAL_ERROR) {
throw new HttpInternalErrorException( response.getURL() );
} else if (response.getResponseCode() == HttpURLConnection.HTTP_NOT_FOUND) {
throw new HttpNotFoundException( response.getResponseMessage(), response.getURL() );
} else if (response.getResponseCode() >= HttpURLConnection.HTTP_BAD_REQUEST) {
throw new HttpException( response.getResponseCode(), response.getResponseMessage(), response.getURL() );
}
}
示例13: getConfig
@GET
@Path("/{id}/configs")
@Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
@ApiOperation(value = "Get the config info of ServerConfig", response = ServerConfigSingleInputModel.class)
@ApiResponses(value = {
@ApiResponse(code = HttpURLConnection.HTTP_OK, message = "Returns the config info of ServerConfig", response = ServerConfigSingleInputModel.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 getConfig(@Context HttpServletRequest request, @Context HttpHeaders header,
@Context Company company, @Context Locale locale, @Context User user,
@Context ServiceContext serviceContext, @PathParam("id") long id);
示例14: addEpaymentconfig
@POST
@Path("/{id}/epaymentconfig")
@Consumes({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON, MediaType.APPLICATION_FORM_URLENCODED })
@Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
@ApiOperation(value = "Add epaymentconfig", response = PaymentConfigSingleInputModel.class)
@ApiResponses(value = {
@ApiResponse(code = HttpURLConnection.HTTP_OK, message = "Returns epaymentconfig was added", 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 addEpaymentconfig(@Context HttpServletRequest request, @Context HttpHeaders header,
@Context Company company, @Context Locale locale, @Context User user,
@Context ServiceContext serviceContext, @PathParam("id") long id,
@BeanParam PaymentConfigSingleInputModel input);
示例15: validateHeaders
/**
* Examines the headers in the response and throws an exception if appropriate.
* @parm response - the response to validate
**/
private void validateHeaders( WebResponse response ) throws HttpException {
if (!getExceptionsThrownOnErrorStatus())
return;
// see feature request [ 914314 ] Add HttpException.getResponse for better reporting
// for possible improvements here
if (response.getResponseCode() == HttpURLConnection.HTTP_INTERNAL_ERROR) {
throw new HttpInternalErrorException( response.getURL() );
} else if (response.getResponseCode() == HttpURLConnection.HTTP_NOT_FOUND) {
throw new HttpNotFoundException( response.getResponseMessage(), response.getURL() );
} else if (response.getResponseCode() >= HttpURLConnection.HTTP_BAD_REQUEST) {
throw new HttpException( response.getResponseCode(), response.getResponseMessage(), response.getURL() );
}
}