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


Java Status.INTERNAL_SERVER_ERROR屬性代碼示例

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


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

示例1: getExtraData

private String getExtraData() {
  try {
    Microservice microservice = RegistryUtils.getMicroservice();
    MicroserviceInstance instance = RegistryUtils.getMicroserviceInstance();
    return JsonUtils.writeValueAsString(new DefaultHealthCheckExtraData(
        instance.getInstanceId(),
        instance.getHostName(),
        microservice.getAppId(),
        microservice.getServiceName(),
        microservice.getVersion(),
        String.join(",", instance.getEndpoints())));
  } catch (Exception e) {
    String error = "unable load microservice info from RegistryUtils";
    logger.error(error, e);
    throw new InvocationException(Status.INTERNAL_SERVER_ERROR, error);
  }
}
 
開發者ID:apache,項目名稱:incubator-servicecomb-java-chassis,代碼行數:17,代碼來源:DefaultMicroserviceHealthChecker.java

示例2: readFrom

@Override
public PropertyBox readFrom(Class<PropertyBox> type, Type genericType, Annotation[] annotations,
		MediaType mediaType, MultivaluedMap<String, String> httpHeaders, InputStream entityStream)
		throws IOException, WebApplicationException {
	try (final Reader reader = new InputStreamReader(entityStream, CHARSET)) {

		// check property set
		PropertySet<?> propertySet = null;
		if (!com.holonplatform.core.Context.get().resource(PropertySet.CONTEXT_KEY, PropertySet.class)
				.isPresent()) {
			PropertySetRef propertySetRef = PropertySetRefIntrospector.getPropertySetRef(annotations).orElse(null);
			if (propertySetRef != null) {
				try {
					propertySet = getPropertySetRefIntrospector().getPropertySet(propertySetRef);
				} catch (PropertySetIntrospectionException e) {
					throw new WebApplicationException(e.getMessage(), e, Status.INTERNAL_SERVER_ERROR);
				}
			}
		}
		if (propertySet != null) {
			return propertySet.execute(() -> readPropertyBox(reader));
		} else {
			return readPropertyBox(reader);
		}
	}
}
 
開發者ID:holon-platform,項目名稱:holon-json,代碼行數:26,代碼來源:JacksonJsonPropertyBoxProvider.java

示例3: toResponse

@Override
public Response toResponse(Throwable t) {
    if (t instanceof WebApplicationException) {
        return ((WebApplicationException) t).getResponse();
    }

    Status status = Status.INTERNAL_SERVER_ERROR;
    String message = Messages.ERROR_EXECUTING_REST_API_CALL;

    if (t instanceof ContentException) {
        status = Status.BAD_REQUEST;
    } else if (t instanceof NotFoundException) {
        status = Status.NOT_FOUND;
    } else if (t instanceof ConflictException) {
        status = Status.CONFLICT;
    }

    if (t instanceof SLException || t instanceof VirusScannerException) {
        message = t.getMessage();
    }

    LOGGER.error(Messages.ERROR_EXECUTING_REST_API_CALL, t);
    return Response.status(status).entity(message).type(MediaType.TEXT_PLAIN_TYPE).build();
}
 
開發者ID:SAP,項目名稱:cf-mta-deploy-service,代碼行數:24,代碼來源:CFExceptionMapper.java

示例4: startMultipart

@Override
public MultipartBean startMultipart(String uuid, String filepath, Boolean uploads)
{
	if( uploads == null )
	{
		throw new BadRequestException("Must use PUT for uploading files");
	}
	StagingFile stagingFile = getStagingFile(uuid);
	String uploadId = UUID.randomUUID().toString();
	String folderPath = "multipart/" + uploadId;
	ensureMultipartDir(stagingFile);
	try
	{
		fileSystemService.mkdir(stagingFile, folderPath);
		return new MultipartBean(uploadId);
	}
	catch( Exception e )
	{
		throw new WebApplicationException(Status.INTERNAL_SERVER_ERROR);
	}
}
 
開發者ID:equella,項目名稱:Equella,代碼行數:21,代碼來源:StagingResourceImpl.java

示例5: logout

@GET
@Path("/logout")
@Produces("text/plain")
@ApiResponses(value = { @ApiResponse(code = 500, message = "CustomerService Internal Server Error") })
public String logout(@QueryParam("login") String login, @CookieParam("sessionid") String sessionid) {
    try {
        customerService.invalidateSession(sessionid);
        // The following call will trigger query against all partitions, disable for now
        //          customerService.invalidateAllUserSessions(login);

        // TODO:  Want to do this with setMaxAge to zero, but to do that I need to have the same path/domain as cookie
        // created in login.  Unfortunately, until we have a elastic ip and domain name its hard to do that for "localhost".
        // doing this will set the cookie to the empty string, but the browser will still send the cookie to future requests
        // and the server will need to detect the value is invalid vs actually forcing the browser to time out the cookie and
        // not send it to begin with
        //                NewCookie sessCookie = new NewCookie(SESSIONID_COOKIE_NAME, "");
        return "logged out";
    }
    catch (Exception e) {
        throw new InvocationException(Status.INTERNAL_SERVER_ERROR, "Internal Server Error");
    }
}
 
開發者ID:WillemJiang,項目名稱:acmeair,代碼行數:22,代碼來源:LoginREST.java

示例6: readFrom

@Override
public Object readFrom(Class<Object> type, Type genericType, Annotation[] annotations, MediaType mediaType,
		MultivaluedMap<String, String> httpHeaders, InputStream entityStream)
		throws IOException, WebApplicationException {

	final Type jsonType = type.equals(genericType) ? type : genericType;

	try (final Reader reader = new InputStreamReader(entityStream, CHARSET)) {

		// check property set
		PropertySet<?> propertySet = null;
		if (isPropertyBoxType(jsonType) && !com.holonplatform.core.Context.get()
				.resource(PropertySet.CONTEXT_KEY, PropertySet.class).isPresent()) {
			PropertySetRef propertySetRef = PropertySetRefIntrospector.getPropertySetRef(annotations).orElse(null);
			if (propertySetRef != null) {
				try {
					propertySet = getPropertySetRefIntrospector().getPropertySet(propertySetRef);
				} catch (PropertySetIntrospectionException e) {
					throw new WebApplicationException(e.getMessage(), e, Status.INTERNAL_SERVER_ERROR);
				}
			}
		}
		if (propertySet != null) {
			return propertySet.execute(() -> readPropertyBox(reader, jsonType));
		} else {
			return readPropertyBox(reader, jsonType);
		}
	}
}
 
開發者ID:holon-platform,項目名稱:holon-json,代碼行數:29,代碼來源:GsonJsonProvider.java

示例7: initServiceProviders

/**
 * Retrieve a list of products from Bugzilla and construct a service provider for each.
 *
 * Each product ID is added to the parameter map which will be used during service provider
 * creation to create unique URI paths for each Bugzilla product.  See @Path definition at
 * the top of BugzillaChangeRequestService.
 *
 * @param httpServletRequest
 */
protected static void initServiceProviders (HttpServletRequest httpServletRequest)
{
    try {
        // Start of user code initServiceProviders
        // End of user code

        String basePath = OSLC4JUtils.getServletURI();

        ServiceProviderInfo [] serviceProviderInfos = PlannerReasonerManager.getServiceProviderInfos(httpServletRequest);
        //Register each service provider
        for (ServiceProviderInfo serviceProviderInfo : serviceProviderInfos) {
            String identifier = serviceProviderIdentifier(serviceProviderInfo.serviceProviderId);
            if (!serviceProviders.containsKey(identifier)) {
                String serviceProviderName = serviceProviderInfo.name;
                String title = String.format("Service Provider '%s'", serviceProviderName);
                String description = String.format("%s (id: %s; kind: %s)",
                    "Robot planner provider",
                    identifier,
                    "robot");
                Publisher publisher = null;
                Map<String, Object> parameterMap = new HashMap<String, Object>();
                parameterMap.put("serviceProviderId", serviceProviderInfo.serviceProviderId);
                final ServiceProvider aServiceProvider = ServiceProvidersFactory.createServiceProvider(basePath, title, description, publisher, parameterMap);
                registerServiceProvider(aServiceProvider, serviceProviderInfo.serviceProviderId);
            }
        }
    } catch (Exception e) {
        e.printStackTrace();
        throw new WebApplicationException(e,Status.INTERNAL_SERVER_ERROR);
    }
}
 
開發者ID:EricssonResearch,項目名稱:scott-eu,代碼行數:40,代碼來源:ServiceProviderCatalogSingleton.java

示例8: readFrom

@Override
public PropertyBox readFrom(Class<PropertyBox> type, Type genericType, Annotation[] annotations,
		MediaType mediaType, MultivaluedMap<String, String> httpHeaders, InputStream entityStream)
		throws IOException, WebApplicationException {
	try (InputStreamReader isr = new InputStreamReader(entityStream, CHARSET);
			BufferedReader reader = new BufferedReader(isr)) {

		// read into String
		StringBuffer content = new StringBuffer();
		String line = null;
		while ((line = reader.readLine()) != null) {
			content.append(line);
		}

		// check property set
		PropertySet<?> propertySet = null;
		if (!com.holonplatform.core.Context.get().resource(PropertySet.CONTEXT_KEY, PropertySet.class)
				.isPresent()) {
			PropertySetRef propertySetRef = PropertySetRefIntrospector.getPropertySetRef(annotations).orElse(null);
			if (propertySetRef != null) {
				try {
					propertySet = getPropertySetRefIntrospector().getPropertySet(propertySetRef);
				} catch (PropertySetIntrospectionException e) {
					throw new WebApplicationException(e.getMessage(), e, Status.INTERNAL_SERVER_ERROR);
				}
			}
		}
		if (propertySet != null) {
			return propertySet.execute(() -> readPropertyBox(content.toString()));
		} else {
			return readPropertyBox(content.toString());
		}

	}
}
 
開發者ID:holon-platform,項目名稱:holon-jaxrs,代碼行數:35,代碼來源:PropertyBoxFormDataProvider.java

示例9: deleteFile

@Override
public Response deleteFile(String stagingUuid, String filepath)
{
	final StagingFile stagingFile = getStagingFile(stagingUuid);
	ensureFileExists(stagingFile, filepath);

	boolean removed = fileSystemService.removeFile(stagingFile, filepath);
	if( !removed )
	{
		throw new WebApplicationException(Status.INTERNAL_SERVER_ERROR);
	}

	return Response.status(Status.NO_CONTENT).build();
}
 
開發者ID:equella,項目名稱:Equella,代碼行數:14,代碼來源:FileResourceImpl.java

示例10: listFiles

@Override
public FileListBean listFiles(UriInfo uriInfo, String uuid, int version)
{
	ItemId itemId = new ItemId(uuid, version);
	checkViewItem(itemId);
	ItemFile itemFile = itemFileService.getItemFile(itemId, null);

	FileEntry base;
	try
	{
		base = fileSystemService.enumerateTree(itemFile, "", null);
	}
	catch( IOException e )
	{
		throw new WebApplicationException(Status.INTERNAL_SERVER_ERROR);
	}
	List<BlobBean> blobs = Lists.newArrayList();
	for( FileEntry fileEntry : base.getFiles() )
	{
		buildBlobBeans(itemFile, uuid, version, blobs, fileEntry, "");
	}
	Collections.sort(blobs, new Comparator<BlobBean>()
	{
		@Override
		public int compare(BlobBean o1, BlobBean o2)
		{
			return o1.getName().compareToIgnoreCase(o2.getName());
		}
	});

	final FileListBean fileList = new FileListBean();
	fileList.setFiles(blobs);
	return fileList;
}
 
開發者ID:equella,項目名稱:Equella,代碼行數:34,代碼來源:ItemResourceImpl.java

示例11: deleteFile

@Override
public Response deleteFile(String stagingUuid, String filepath, String uploadId) throws IOException
{
	final StagingFile stagingFile = getStagingFile(stagingUuid);
	ensureFileExists(stagingFile, filepath);

	boolean removed = fileSystemService.removeFile(stagingFile, filepath);
	if( !removed )
	{
		throw new WebApplicationException(Status.INTERNAL_SERVER_ERROR);
	}

	return Response.status(Status.NO_CONTENT).build();
}
 
開發者ID:equella,項目名稱:Equella,代碼行數:14,代碼來源:StagingResourceImpl.java

示例12: ensureMultipartDir

private void ensureMultipartDir(StagingFile handle)
{
	try
	{
		if( !fileSystemService.fileExists(handle, "multipart") )
		{
			fileSystemService.mkdir(handle, "multipart");
		}
	}
	catch( Exception e )
	{
		throw new WebApplicationException(Status.INTERNAL_SERVER_ERROR);
	}
}
 
開發者ID:equella,項目名稱:Equella,代碼行數:14,代碼來源:StagingResourceImpl.java

示例13: initServiceProviders

/**
 * Retrieve a list of products from Bugzilla and construct a service provider for each.
 *
 * Each product ID is added to the parameter map which will be used during service provider
 * creation to create unique URI paths for each Bugzilla product.  See @Path definition at
 * the top of BugzillaChangeRequestService.
 *
 * @param httpServletRequest
 */
protected static void initServiceProviders (HttpServletRequest httpServletRequest)
{
    try {
        // Start of user code initServiceProviders
        // End of user code

        String basePath = OSLC4JUtils.getServletURI();

        ServiceProviderInfo [] serviceProviderInfos = WarehouseControllerManager.getServiceProviderInfos(httpServletRequest);
        //Register each service provider
        for (ServiceProviderInfo serviceProviderInfo : serviceProviderInfos) {
            String identifier = serviceProviderIdentifier(serviceProviderInfo.serviceProviderId);
            if (!serviceProviders.containsKey(identifier)) {
                String serviceProviderName = serviceProviderInfo.name;
                String title = String.format("Service Provider '%s'", serviceProviderName);
                String description = String.format("%s (id: %s; kind: %s)",
                    "Service Provider",
                    identifier,
                    "Service Provider");
                Publisher publisher = null;
                Map<String, Object> parameterMap = new HashMap<String, Object>();
                parameterMap.put("serviceProviderId", serviceProviderInfo.serviceProviderId);
                final ServiceProvider aServiceProvider = ServiceProvidersFactory.createServiceProvider(basePath, title, description, publisher, parameterMap);
                registerServiceProvider(aServiceProvider, serviceProviderInfo.serviceProviderId);
            }
        }
    } catch (Exception e) {
        e.printStackTrace();
        throw new WebApplicationException(e,Status.INTERNAL_SERVER_ERROR);
    }
}
 
開發者ID:EricssonResearch,項目名稱:scott-eu,代碼行數:40,代碼來源:ServiceProviderCatalogSingleton.java

示例14: ApiException

public ApiException(Throwable cause){
	super(cause);
	status = Status.INTERNAL_SERVER_ERROR;
}
 
開發者ID:FroMage,項目名稱:redpipe,代碼行數:4,代碼來源:ApiException.java

示例15: RollbackExceptionMapper

public RollbackExceptionMapper() {
  super(Status.INTERNAL_SERVER_ERROR);
}
 
開發者ID:Nexmo,項目名稱:comms-router,代碼行數:3,代碼來源:RollbackExceptionMapper.java


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