當前位置: 首頁>>代碼示例>>Java>>正文


Java HttpURLConnection.HTTP_NOT_FOUND屬性代碼示例

本文整理匯總了Java中java.net.HttpURLConnection.HTTP_NOT_FOUND屬性的典型用法代碼示例。如果您正苦於以下問題:Java HttpURLConnection.HTTP_NOT_FOUND屬性的具體用法?Java HttpURLConnection.HTTP_NOT_FOUND怎麽用?Java HttpURLConnection.HTTP_NOT_FOUND使用的例子?那麽, 這裏精選的屬性代碼示例或許可以為您提供幫助。您也可以進一步了解該屬性所在java.net.HttpURLConnection的用法示例。


在下文中一共展示了HttpURLConnection.HTTP_NOT_FOUND屬性的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: readResponse

/**
 * Reads a response from the Amazon EC2 Instance Metadata Service and
 * returns the content as a string.
 *
 * @param connection
 *            The connection to the Amazon EC2 Instance Metadata Service.
 *
 * @return The content contained in the response from the Amazon EC2
 *         Instance Metadata Service.
 *
 * @throws IOException
 *             If any problems ocurred while reading the response.
 */
private String readResponse(HttpURLConnection connection) throws IOException {
    if (connection.getResponseCode() == HttpURLConnection.HTTP_NOT_FOUND)
        throw new SdkClientException("The requested metadata is not found at " + connection.getURL());

    InputStream inputStream = connection.getInputStream();

    try {
        StringBuilder buffer = new StringBuilder();
        while (true) {
            int c = inputStream.read();
            if (c == -1) break;
            buffer.append((char)c);
        }

        return buffer.toString();
    } finally {
        inputStream.close();
    }
}
 
開發者ID:IBM,項目名稱:ibm-cos-sdk-java,代碼行數:32,代碼來源:EC2MetadataClient.java

示例2: getThrowable

@NonNull
private Throwable getThrowable(String message, int code, Throwable throwable) {
    Throwable exception;
    switch (code) {
        case  HttpURLConnection.HTTP_NOT_FOUND:
            exception = new NotFoundException();
            break;
        case HttpURLConnection.HTTP_FORBIDDEN:
            exception = new UnauthorizedException();
            break;
        case HttpURLConnection.HTTP_UNAUTHORIZED:
            exception = new UncheckedException(message);
            break;
        case HttpURLConnection.HTTP_INTERNAL_ERROR:
            exception = new ServerNotAvailableException();
            break;
        case HttpURLConnection.HTTP_NOT_IMPLEMENTED:
        case HttpURLConnection.HTTP_BAD_GATEWAY:
        case HttpURLConnection.HTTP_UNAVAILABLE:
        case HttpURLConnection.HTTP_GATEWAY_TIMEOUT:
            exception = new ServerException(throwable);
            break;
        default:
            exception = new UncheckedException(message);
            break;
    }
    return exception;
}
 
開發者ID:graviton57,項目名稱:TheNounProject,代碼行數:28,代碼來源:ErrorHandlerHelper.java

示例3: getInvoiceForm

@GET
@Path("/{id}/invoiceform")
@Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
@ApiOperation(value = "Get the PaymentConfig by primekey", response = PaymentConfigSingleInputModel.class)
@ApiResponses(value = {
		@ApiResponse(code = HttpURLConnection.HTTP_OK, message = "Returns detail 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 getInvoiceForm(@Context HttpServletRequest request, @Context HttpHeaders header,
		@Context Company company, @Context Locale locale, @Context User user,
		@Context ServiceContext serviceContext, @PathParam("id") long id);
 
開發者ID:VietOpenCPS,項目名稱:opencps-v2,代碼行數:13,代碼來源:PaymentConfigManagement.java

示例4: getServerConfigDetail

@GET
@Path("/{id}")
@Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
@ApiOperation(value = "Get the ServerConfig detail", response = ServerConfigDetailModel.class)
@ApiResponses(value = {
		@ApiResponse(code = HttpURLConnection.HTTP_OK, message = "Returns detail of ServerConfig", response = ServerConfigDetailModel.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 getServerConfigDetail(@Context HttpServletRequest request, @Context HttpHeaders header,
		@Context Company company, @Context Locale locale, @Context User user,
		@Context ServiceContext serviceContext, @PathParam("id") String id);
 
開發者ID:VietOpenCPS,項目名稱:opencps-v2,代碼行數:13,代碼來源:ServerConfigManagement.java

示例5: generateException

private LoginError generateException(int statusCode) {
    switch (statusCode) {
        case HttpURLConnection.HTTP_NOT_FOUND:
            return new LoginError(LoginError.ErrorType.USER_NOT_EXISTS,
                    USER_NOT_EXISTS_MESSAGE);
        case HttpURLConnection.HTTP_UNAUTHORIZED:
            return new LoginError(LoginError.ErrorType.INVALID_CREDENTIALS,
                    INVALID_CREDENTIALS_MESSAGE);
        default:
            return null;
    }
}
 
開發者ID:ArnauBlanch,項目名稱:civify-app,代碼行數:12,代碼來源:LoginAdapterImpl.java

示例6: updateDossierTemplateDetail

@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);
 
開發者ID:VietOpenCPS,項目名稱:opencps-v2,代碼行數:15,代碼來源:DossierTemplateManagement.java

示例7: id

@GET
@Path("/{id}")
@Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
@ApiOperation(value = "Get the detail of Dossier by its id (or referenceId)", response = DossierDetailModel.class)
@ApiResponses(value = {
		@ApiResponse(code = HttpURLConnection.HTTP_OK, message = "Returns a list of Dossiers have been filtered", response = DossierDetailModel.class),
		@ApiResponse(code = HttpURLConnection.HTTP_UNAUTHORIZED, message = "Unauthorized", response = ExceptionModel.class),
		@ApiResponse(code = HttpURLConnection.HTTP_NOT_FOUND, message = "Not found", response = ExceptionModel.class),
		@ApiResponse(code = HttpURLConnection.HTTP_FORBIDDEN, message = "Access denied", response = ExceptionModel.class) })

public Response getDetailDossier(@Context HttpServletRequest request, @Context HttpHeaders header,
		@Context Company company, @Context Locale locale, @Context User user,
		@Context ServiceContext serviceContext, @PathParam("id") String id);
 
開發者ID:VietOpenCPS,項目名稱:opencps-v2,代碼行數:13,代碼來源:DossierManagement.java

示例8: getListContacts

@GET
@Path("/{id}/contacts")
@Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
@ApiOperation(value = "Get List Contacts", response = ListContacts.class)
@ApiResponses(value = {
		@ApiResponse(code = HttpURLConnection.HTTP_OK, message = "Returns list contacts", response = ListContacts.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 getListContacts(@Context HttpServletRequest request, @Context HttpHeaders header,
		@Context Company company, @Context Locale locale, @Context User user,
		@Context ServiceContext serviceContext, @PathParam("id") long id);
 
開發者ID:VietOpenCPS,項目名稱:opencps-v2,代碼行數:13,代碼來源:DossierActionManagement.java

示例9: 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);
 
開發者ID:VietOpenCPS,項目名稱:opencps-v2,代碼行數:15,代碼來源:PaymentConfigManagement.java

示例10: getFormScript

@GET
@Path("/deliverables/{id}/formscript")
@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 formscript for deliverable id")
@ApiResponses(value = {
		@ApiResponse(code = HttpURLConnection.HTTP_OK, message = "Returns"),
		@ApiResponse(code = HttpURLConnection.HTTP_UNAUTHORIZED, message = "Unauthorized", response = ExceptionModel.class),
		@ApiResponse(code = HttpURLConnection.HTTP_NOT_FOUND, message = "Not Found", response = ExceptionModel.class),
		@ApiResponse(code = HttpURLConnection.HTTP_FORBIDDEN, message = "Access defined", response = ExceptionModel.class) })
public Response getFormScript(@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);
 
開發者ID:VietOpenCPS,項目名稱:opencps-v2,代碼行數:13,代碼來源:DeliverablesManagement.java

示例11: downloadByDossierId

@GET
@Path("/{id}/download")
@Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
@ApiOperation(value = "downloadByDossierId")
@ApiResponses(value = { @ApiResponse(code = HttpURLConnection.HTTP_OK, message = "downloadByDossierId"),
		@ApiResponse(code = HttpURLConnection.HTTP_UNAUTHORIZED, message = "Unauthorized", response = ExceptionModel.class),
		@ApiResponse(code = HttpURLConnection.HTTP_NOT_FOUND, message = "Not found", response = ExceptionModel.class),
		@ApiResponse(code = HttpURLConnection.HTTP_FORBIDDEN, message = "Access denied", response = ExceptionModel.class) })

public Response downloadByDossierId(@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") long id,
		@ApiParam(value = "password for access dossier file", required = false) @PathParam("password") String password);
 
開發者ID:VietOpenCPS,項目名稱:opencps-v2,代碼行數:14,代碼來源:DossierFileManagement.java

示例12: removeProcessOption

@DELETE
@Path("/{id}/processes/{optionId}")
@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 ProcessOption", response = ProcessOptionInputModel.class)
@ApiResponses(value = {
		@ApiResponse(code = HttpURLConnection.HTTP_OK, message = "Returns a ProcessOption was updated", response = ProcessOptionInputModel.class),
		@ApiResponse(code = HttpURLConnection.HTTP_UNAUTHORIZED, message = "Unauthorized", response = ExceptionModel.class),
		@ApiResponse(code = HttpURLConnection.HTTP_NOT_FOUND, message = "Not found", response = ExceptionModel.class),
		@ApiResponse(code = HttpURLConnection.HTTP_FORBIDDEN, message = "Access denied", response = ExceptionModel.class) })
public Response removeProcessOption(@Context HttpServletRequest request, @Context HttpHeaders header,
		@Context Company company, @Context Locale locale, @Context User user,
		@Context ServiceContext serviceContext,
		@ApiParam(value = "serviceconfigId for remove") @PathParam("id") long id,
		@ApiParam(value = "processOptionId for remove") @PathParam("optionId") long optionId);
 
開發者ID:VietOpenCPS,項目名稱:opencps-v2,代碼行數:15,代碼來源:ServiceConfigManagement.java

示例13: updateRegistrationTemplateFormScript

@PUT
@Path("/{id}/formscript")
@Consumes({ MediaType.APPLICATION_FORM_URLENCODED })
@Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
@ApiOperation(value = "update FormScript")
@ApiResponses(value = { @ApiResponse(code = HttpURLConnection.HTTP_OK, message = "Returns"),
		@ApiResponse(code = HttpURLConnection.HTTP_UNAUTHORIZED, message = "Unauthorized", response = ExceptionModel.class),
		@ApiResponse(code = HttpURLConnection.HTTP_NOT_FOUND, message = "Not found", response = ExceptionModel.class),
		@ApiResponse(code = HttpURLConnection.HTTP_FORBIDDEN, message = "Access denied", response = ExceptionModel.class) })
public Response updateRegistrationTemplateFormScript(@Context HttpServletRequest request,
		@Context HttpHeaders header, @Context Company company, @Context Locale locale, @Context User user,
		@Context ServiceContext serviceContext,
		@ApiParam(value = "id of  registrationTemplate", required = true) @PathParam("id") long registrationTemplateId,
		@ApiParam(value = "FormScript of  registrationTemplate", required = true) @FormParam("formScript") String formScript);
 
開發者ID:VietOpenCPS,項目名稱:opencps-v2,代碼行數:14,代碼來源:RegistrationTemplatesManagement.java

示例14: getFormReportByRegistrationTemplateId

@GET
@Path("/{id}/formreport")
@Consumes({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON, MediaType.APPLICATION_FORM_URLENCODED })
@Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON, MediaType.APPLICATION_FORM_URLENCODED })
@ApiOperation(value = "getFormReportByDeliverableTypeId", response = JSONObject.class)
@ApiResponses(value = {
		@ApiResponse(code = HttpURLConnection.HTTP_OK, message = "Returns a formdata", response = JSONObject.class),
		@ApiResponse(code = HttpURLConnection.HTTP_NOT_FOUND, message = "Not found", response = ExceptionModel.class),
		@ApiResponse(code = HttpURLConnection.HTTP_FORBIDDEN, message = "Access denied", response = ExceptionModel.class) })
public Response getFormReportByRegistrationTemplateId(@Context HttpServletRequest request,
		@Context HttpHeaders header, @Context Company company, @Context Locale locale, @Context User user,
		@Context ServiceContext serviceContext,
		@ApiParam(value = "id of registrationTemplate", required = true) @PathParam("id") long id);
 
開發者ID:VietOpenCPS,項目名稱:opencps-v2,代碼行數:13,代碼來源:RegistrationTemplatesManagement.java

示例15: submittingDossier

@GET
@Path("/{id}/submitting")
@Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
@ApiOperation(value = "Owner submitting Dossier", response = DossierDetailModel.class)
@ApiResponses(value = {
		@ApiResponse(code = HttpURLConnection.HTTP_OK, message = "Returns a Dossier has been submitted", response = DossierDetailModel.class),
		@ApiResponse(code = HttpURLConnection.HTTP_UNAUTHORIZED, message = "Unauthorized", response = ExceptionModel.class),
		@ApiResponse(code = HttpURLConnection.HTTP_NOT_FOUND, message = "Not found", response = ExceptionModel.class),
		@ApiResponse(code = HttpURLConnection.HTTP_FORBIDDEN, message = "Access denied", response = ExceptionModel.class) })

public Response submittingDossier(@Context HttpServletRequest request, @Context HttpHeaders header,
		@Context Company company, @Context Locale locale, @Context User user,
		@Context ServiceContext serviceContext, @PathParam("id") String id);
 
開發者ID:VietOpenCPS,項目名稱:opencps-v2,代碼行數:13,代碼來源:DossierManagement.java


注:本文中的java.net.HttpURLConnection.HTTP_NOT_FOUND屬性示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。