} else { throw new NotAcceptableException();
} else { throw new NotAcceptableException();
effectiveResponseType = MediaType.APPLICATION_OCTET_STREAM_TYPE; } else { throw new NotAcceptableException(); throw new NotAcceptableException();
effectiveResponseType = MediaType.APPLICATION_OCTET_STREAM_TYPE; } else { throw new NotAcceptableException(); throw new NotAcceptableException();
@Override public ContainerResponse apply(final ContainerResponse responseContext) { // we only need to compute and set the effective media type if: // - it hasn't been set already, and // - either there is an entity, or we are responding to a HEAD request if (responseContext.getMediaType() == null && ((responseContext.hasEntity() || HttpMethod.HEAD.equals(request.getMethod())))) { MediaType effectiveResponseType = determineResponseMediaType( responseContext.getEntityClass(), responseContext.getEntityType(), methodSelector.selected, acceptableMediaTypes); if (MediaTypes.isWildcard(effectiveResponseType)) { if (effectiveResponseType.isWildcardType() || "application".equalsIgnoreCase(effectiveResponseType.getType())) { effectiveResponseType = MediaType.APPLICATION_OCTET_STREAM_TYPE; } else { throw new NotAcceptableException(); } } responseContext.setMediaType(effectiveResponseType); } return responseContext; } });
@Override public ContainerResponse apply(final ContainerResponse responseContext) { // we only need to compute and set the effective media type if: // - it hasn't been set already, and // - either there is an entity, or we are responding to a HEAD request if (responseContext.getMediaType() == null && ((responseContext.hasEntity() || HttpMethod.HEAD.equals(request.getMethod())))) { MediaType effectiveResponseType = determineResponseMediaType( responseContext.getEntityClass(), responseContext.getEntityType(), methodSelector.selected, acceptableMediaTypes); if (MediaTypes.isWildcard(effectiveResponseType)) { if (effectiveResponseType.isWildcardType() || "application".equalsIgnoreCase(effectiveResponseType.getType())) { effectiveResponseType = MediaType.APPLICATION_OCTET_STREAM_TYPE; } else { throw new NotAcceptableException(); } } responseContext.setMediaType(effectiveResponseType); } return responseContext; } });
break; case NOT_ACCEPTABLE: webAppException = new NotAcceptableException(response); break; case UNSUPPORTED_MEDIA_TYPE:
break; case NOT_ACCEPTABLE: webAppException = new NotAcceptableException(response); break; case UNSUPPORTED_MEDIA_TYPE:
break; case NOT_ACCEPTABLE: webAppException = new NotAcceptableException(response); break; case UNSUPPORTED_MEDIA_TYPE:
throw new NotAcceptableException(); throw new NotAcceptableException();
} else { throw new NotAcceptableException();
effectiveResponseType = MediaType.APPLICATION_OCTET_STREAM_TYPE; } else { throw new NotAcceptableException(); throw new NotAcceptableException();
throw new NotAcceptableException(Messages.MESSAGES.noMatchForAcceptHeader());
@Override public ContainerResponse apply(final ContainerResponse responseContext) { // we only need to compute and set the effective media type if: // - it hasn't been set already, and // - either there is an entity, or we are responding to a HEAD request if (responseContext.getMediaType() == null && ((responseContext.hasEntity() || HttpMethod.HEAD.equals(request.getMethod())))) { MediaType effectiveResponseType = determineResponseMediaType( responseContext.getEntityClass(), responseContext.getEntityType(), methodSelector.selected, acceptableMediaTypes); if (MediaTypes.isWildcard(effectiveResponseType)) { if (effectiveResponseType.isWildcardType() || "application".equalsIgnoreCase(effectiveResponseType.getType())) { effectiveResponseType = MediaType.APPLICATION_OCTET_STREAM_TYPE; } else { throw new NotAcceptableException(); } } responseContext.setMediaType(effectiveResponseType); } return responseContext; } });
return new NotAllowedException(response); case NOT_ACCEPTABLE: return new NotAcceptableException(response); case UNSUPPORTED_MEDIA_TYPE: return new NotSupportedException(response);
throw new NotAllowedException(response); case 406 : throw new NotAcceptableException(response); case 415 : throw new NotSupportedException(response);
private <F> void putCheckNotTwice(Map<String, F> map, String fieldName, F newField) { final F duplicateField = map.put(fieldName, newField); if (duplicateField != null) throw new NotAcceptableException( "This field name has been defined twice: " + fieldName + " - Fields: " + duplicateField + "/" + newField); }
@Override public Boolean deleteRow(final String tableName, final String rowId) { if (StringUtils.isEmpty(rowId)) throw new NotAcceptableException("The key is missing"); return tableTarget.path(tableName) .path("row") .path(rowId) .request(MediaType.APPLICATION_JSON) .delete(Boolean.class); }
@Override public SortedSet<String> getActiveNodesByService(final String serviceName, final String group) { try { if (serviceName == null) throw new NotAcceptableException(); return manager.getNodesByGroupByService(group, serviceName); } catch (Exception e) { throw ServerException.getJsonException(LOGGER, e); } }
@Override public String getActiveNodeLeaderByService(final String serviceName, final String group) { try { if (serviceName == null) throw new NotAcceptableException(); return manager.getLeaderNode(group, serviceName); } catch (ServerException e) { throw ServerException.getTextException(LOGGER, e); } }