当前位置: 首页>>代码示例>>Java>>正文


Java NotSupportedException类代码示例

本文整理汇总了Java中javax.ws.rs.NotSupportedException的典型用法代码示例。如果您正苦于以下问题:Java NotSupportedException类的具体用法?Java NotSupportedException怎么用?Java NotSupportedException使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


NotSupportedException类属于javax.ws.rs包,在下文中一共展示了NotSupportedException类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: convertValue

import javax.ws.rs.NotSupportedException; //导入依赖的package包/类
public Value convertValue(Object object) {
  if (object instanceof Value) {
    return (Value) object;
  }

  ValueFactory valueFactory = SimpleValueFactory.getInstance();
  if (object instanceof String) {
    return valueFactory.createLiteral((String) object);
  }
  if (object instanceof Integer) {
    return valueFactory.createLiteral((Integer) object);
  }
  if (object instanceof Double) {
    return valueFactory.createLiteral((Double) object);
  }

  throw new NotSupportedException("Value is not supported: " + object.getClass());
}
 
开发者ID:dotwebstack,项目名称:dotwebstack-framework,代码行数:19,代码来源:SparqlHttpStub.java

示例2: toResponse

import javax.ws.rs.NotSupportedException; //导入依赖的package包/类
@Override
public Response toResponse(Exception e) {

    WrapperResponseEntity response = null;
    if (e instanceof NotFoundException) {
        response = new WrapperResponseEntity(ResponseCode.NOT_FOUND);
    } else if (e instanceof NotAllowedException) {
        response = new WrapperResponseEntity(ResponseCode.FORBIDDEN);
    } else if (e instanceof JsonProcessingException) {
        response = new WrapperResponseEntity(ResponseCode.ERROR_JSON);
    } else if (e instanceof NotSupportedException) {
        response = new WrapperResponseEntity(ResponseCode.UNSUPPORTED_MEDIA_TYPE);
    } else {
        response = excetionWrapper != null ? excetionWrapper.toResponse(e) : null;
        if (response == null)
            response = new WrapperResponseEntity(ResponseCode.INTERNAL_SERVER_ERROR);
    }
    return Response.status(response.httpStatus()).type(MediaType.APPLICATION_JSON)
        .entity(response).build();
}
 
开发者ID:warlock-china,项目名称:azeroth,代码行数:21,代码来源:BaseExceptionMapper.java

示例3: toResponse

import javax.ws.rs.NotSupportedException; //导入依赖的package包/类
@Override
public Response toResponse(Exception e) {

	WrapperResponseEntity response = null;
	if (e instanceof NotFoundException) {
		response = new WrapperResponseEntity(ResponseCode.NOT_FOUND);
	} else if (e instanceof NotAllowedException) {
		response = new WrapperResponseEntity(ResponseCode.FORBIDDEN);
	} else if (e instanceof JsonProcessingException) {
		response = new WrapperResponseEntity(ResponseCode.ERROR_JSON);
	} else if (e instanceof NotSupportedException) {
		response = new WrapperResponseEntity(ResponseCode.UNSUPPORTED_MEDIA_TYPE);
	} else {
		response = excetionWrapper != null ? excetionWrapper.toResponse(e) : null;
		if(response == null)response = new WrapperResponseEntity(ResponseCode.INTERNAL_SERVER_ERROR);
	}
	return Response.status(response.httpStatus()).type(MediaType.APPLICATION_JSON).entity(response).build();
}
 
开发者ID:vakinge,项目名称:jeesuite-libs,代码行数:19,代码来源:BaseExceptionMapper.java

示例4: testCreateException

import javax.ws.rs.NotSupportedException; //导入依赖的package包/类
@Test
public void testCreateException() {
    assertExceptionType(Response.Status.INTERNAL_SERVER_ERROR, InternalServerErrorException.class);
    assertExceptionType(Response.Status.NOT_FOUND, NotFoundException.class);
    assertExceptionType(Response.Status.FORBIDDEN, ForbiddenException.class);
    assertExceptionType(Response.Status.BAD_REQUEST, BadRequestException.class);
    assertExceptionType(Response.Status.METHOD_NOT_ALLOWED, NotAllowedException.class);
    assertExceptionType(Response.Status.UNAUTHORIZED, NotAuthorizedException.class);
    assertExceptionType(Response.Status.NOT_ACCEPTABLE, NotAcceptableException.class);
    assertExceptionType(Response.Status.UNSUPPORTED_MEDIA_TYPE, NotSupportedException.class);
    assertExceptionType(Response.Status.SERVICE_UNAVAILABLE, ServiceUnavailableException.class);
    assertExceptionType(Response.Status.TEMPORARY_REDIRECT, RedirectionException.class);
    assertExceptionType(Response.Status.LENGTH_REQUIRED, ClientErrorException.class);
    assertExceptionType(Response.Status.BAD_GATEWAY, ServerErrorException.class);
    assertExceptionType(Response.Status.NO_CONTENT, WebApplicationException.class);
}
 
开发者ID:Microbule,项目名称:microbule,代码行数:17,代码来源:AbstractErrorResponseStrategyTest.java

示例5: loginDialog

import javax.ws.rs.NotSupportedException; //导入依赖的package包/类
public void loginDialog(String message) {
	try {
		if (!getTrpSets().isServerSideActivated()) {
			throw new NotSupportedException("Connecting to the server not supported yet!");
		}

		// detachListener();

		if (loginDialog != null && !loginDialog.isDisposed()) {
			loginDialog.close();
		}

		List<String> storedUsers = TrpGuiPrefs.getUsers();
		
		loginDialog = new TrpLoginDialog(getShell(), this, message, storedUsers.toArray(new String[0]), TrpServerConn.SERVER_URIS, TrpServerConn.DEFAULT_URI_INDEX);
		loginDialog.open();

		// attachListener();
	} catch (Throwable e) {
		onError("Error during login", "Unable to login to server", e);
		ui.updateLoginInfo(false, "", "");
	}
}
 
开发者ID:Transkribus,项目名称:TranskribusSwtGui,代码行数:24,代码来源:TrpMainWidget.java

示例6: writeTo

import javax.ws.rs.NotSupportedException; //导入依赖的package包/类
@Override
@SuppressWarnings("unchecked")
public void writeTo(PMessage entity,
                    Class<?> type,
                    Type genericType,
                    Annotation[] annotations,
                    MediaType mediaType,
                    MultivaluedMap<String, Object> httpHeaders,
                    OutputStream entityStream) throws IOException, WebApplicationException {
    try {
        provider.getSerializer(mediaType.toString())
                .serialize(entityStream, entity);
    } catch (NotSupportedException e) {
        throw new ProcessingException("Unknown media type: " + mediaType, e);
    } catch (SerializerException se) {
        throw new ProcessingException("Unable to serialize entity", se);
    }
}
 
开发者ID:morimekta,项目名称:providence,代码行数:19,代码来源:ProvidenceMessageBodyWriter.java

示例7: toResponse

import javax.ws.rs.NotSupportedException; //导入依赖的package包/类
@Override
public Response toResponse(NotSupportedException exception) {
    return ExceptionMapperUtils.buildResponse(exception, Response.Status.UNSUPPORTED_MEDIA_TYPE);
}
 
开发者ID:hawkular,项目名称:hawkular-metrics,代码行数:5,代码来源:NotSupportedExceptionMapper.java

示例8: toResponse

import javax.ws.rs.NotSupportedException; //导入依赖的package包/类
/**
 * {@inheritDoc}
 */
@Override
public Response toResponse(final NotSupportedException exception) {
    if (L.isDebugEnabled()) {
        L.debug(R.getString("D-REST-JERSEY-MAPPER#0009"));
    }
    ErrorMessage error = ErrorMessages.create(exception)
        .code(ErrorCode.UNSUPPORTED_MEDIA_TYPE.code())
        .resolve()
        .get();
    L.warn(error.log(), exception);
    return Response.status(exception.getResponse().getStatusInfo())
        .entity(error)
        .type(MediaType.APPLICATION_JSON)
        .build();
}
 
开发者ID:ctc-g,项目名称:sinavi-jfw,代码行数:19,代码来源:NotSupportedExceptionMapper.java

示例9: send

import javax.ws.rs.NotSupportedException; //导入依赖的package包/类
private void send(Collection<Trace> traces) {
  try {
    apmApi.reportTraces(traces);
  } catch (NotFoundException | NotSupportedException cee) {
    // 404, 415
    if (apmApi instanceof ApmApi0_3) {
      log.info("falling back to json");
      fallbackTo0_2();
      send(traces);
    }
  } catch (BadRequestException bre) {
    log.error("{}: {}", bre.getMessage(), traces);
  }
}
 
开发者ID:chonton,项目名称:apm-client,代码行数:15,代码来源:Writer.java

示例10: toResponse

import javax.ws.rs.NotSupportedException; //导入依赖的package包/类
@Override
public Response toResponse(NotSupportedException e) {
    return Response.status(Response.Status.UNSUPPORTED_MEDIA_TYPE)
            .entity(new org.crunchytorch.coddy.application.data.Response(e.getMessage()))
            .type(MediaType.APPLICATION_JSON)
            .build();
}
 
开发者ID:Crunchy-Torch,项目名称:coddy,代码行数:8,代码来源:NotSupportedMapper.java

示例11: handleErrorStatus

import javax.ws.rs.NotSupportedException; //导入依赖的package包/类
private static <T> T handleErrorStatus(Response response) {
	final int status = response.getStatus();
	switch (status) {
	case 400:
		throw new BadRequestException(response);
	case 401:
		throw new NotAuthorizedException(response);
	case 404:
		throw new NotFoundException(response);
	case 405:
		throw new NotAllowedException(response);
	case 406:
		throw new NotAcceptableException(response);
	case 415:
		throw new NotSupportedException(response);
	case 500:
		throw new InternalServerErrorException(response);
	case 503:
		throw new ServiceUnavailableException(response);
	default:
		break;
	}

	if (status >= 400 && status < 500){
		throw new ClientErrorException(response);
	} else if (status >= 500) {
		throw new ServerErrorException(response);
	}

	throw new WebApplicationException(response);
}
 
开发者ID:Blazebit,项目名称:blaze-storage,代码行数:32,代码来源:ResponseObjectInvocation.java

示例12: bindExceptionhandlers

import javax.ws.rs.NotSupportedException; //导入依赖的package包/类
protected void bindExceptionhandlers(ApplicationBindingBuilder builder)
{
    builder
        .addProviderInstance(new GenericJsonExceptionHandler<ResourceNotFoundException>(Response.Status.NOT_FOUND) { })
        .addProviderInstance(new GenericJsonExceptionHandler<StorageFileNotFoundException>(Response.Status.NOT_FOUND) { })
        .addProviderInstance(new GenericJsonExceptionHandler<ResourceConflictException>(Response.Status.CONFLICT) { })
        .addProviderInstance(new GenericJsonExceptionHandler<NotSupportedException>(Response.Status.BAD_REQUEST) { })
        .addProviderInstance(new GenericJsonExceptionHandler<IOException>(Response.Status.BAD_REQUEST) { })  // happens if input is not gzip
        .addProviderInstance(new GenericJsonExceptionHandler<ModelValidationException>(Response.Status.BAD_REQUEST) { })
        .addProviderInstance(new GenericJsonExceptionHandler<ConfigException>(Response.Status.BAD_REQUEST) { })
        .addProviderInstance(new GenericJsonExceptionHandler<IllegalArgumentException>(Response.Status.BAD_REQUEST) { })
        .addProviderInstance(new GenericJsonExceptionHandler<ResourceLimitExceededException>(Response.Status.BAD_REQUEST) { })
        ;
}
 
开发者ID:treasure-data,项目名称:digdag,代码行数:15,代码来源:ServerModule.java

示例13: create

import javax.ws.rs.NotSupportedException; //导入依赖的package包/类
/**
 * POST method for creating an instance of ReservationResource
 *
 * @param content representation for the new resource
 * @return an HTTP response with content of the created resource
 */
@POST
@Consumes(MediaType.APPLICATION_JSON)
@Produces(MediaType.APPLICATION_JSON)
public Response create(String content) {
	throw new NotSupportedException();
}
 
开发者ID:romainGuiet,项目名称:fablab-web,代码行数:13,代码来源:ReservationsResource.java

示例14: toApiErrorResponse

import javax.ws.rs.NotSupportedException; //导入依赖的package包/类
@Override
protected ApiErrorResponse toApiErrorResponse(NotSupportedException exception) {
	return new ApiErrorResponse(
		"The media type of the request body is unsupported.", 
		getCode(), 
		getLocationType(), 
		"Content-Type"
	);
}
 
开发者ID:lotaris,项目名称:jee-rest,代码行数:10,代码来源:NotSupportedExceptionMapper.java

示例15: setValueFromResultSet

import javax.ws.rs.NotSupportedException; //导入依赖的package包/类
/**
 * @see DataValueDescriptor#setValueFromResultSet
 *
 */
public void setValueFromResultSet(ResultSet resultSet, int colNumber,
								  boolean isNullable) throws SQLException {
	Array array = resultSet.getArray(colNumber);
	int type = array.getBaseType();
	throw new NotSupportedException("still need to implement " + array + " : " + type);
}
 
开发者ID:splicemachine,项目名称:spliceengine,代码行数:11,代码来源:SQLArray.java


注:本文中的javax.ws.rs.NotSupportedException类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。