private void validateHttpMethodAndEntity(final ClientRequest request) { boolean suppressExceptions; suppressExceptions = PropertiesHelper.isProperty( request.getConfiguration().getProperty(ClientProperties.SUPPRESS_HTTP_COMPLIANCE_VALIDATION)); final Object shcvProperty = request.getProperty(ClientProperties.SUPPRESS_HTTP_COMPLIANCE_VALIDATION); if (shcvProperty != null) { // override global configuration with request-specific suppressExceptions = PropertiesHelper.isProperty(shcvProperty); } final String method = request.getMethod(); final EntityPresence entityPresence = METHODS.get(method.toUpperCase()); if (entityPresence == EntityPresence.MUST_BE_NULL && request.hasEntity()) { if (suppressExceptions) { LOGGER.warning(LocalizationMessages.ERROR_HTTP_METHOD_ENTITY_NOT_NULL(method)); } else { throw new IllegalStateException(LocalizationMessages.ERROR_HTTP_METHOD_ENTITY_NOT_NULL(method)); } } else if (entityPresence == EntityPresence.MUST_BE_PRESENT && !request.hasEntity()) { if (suppressExceptions) { LOGGER.warning(LocalizationMessages.ERROR_HTTP_METHOD_ENTITY_NULL(method)); } else { throw new IllegalStateException(LocalizationMessages.ERROR_HTTP_METHOD_ENTITY_NULL(method)); } } }
private void validateHttpMethodAndEntity(final ClientRequest request) { boolean suppressExceptions; suppressExceptions = PropertiesHelper.isProperty( request.getConfiguration().getProperty(ClientProperties.SUPPRESS_HTTP_COMPLIANCE_VALIDATION)); final Object shcvProperty = request.getProperty(ClientProperties.SUPPRESS_HTTP_COMPLIANCE_VALIDATION); if (shcvProperty != null) { // override global configuration with request-specific suppressExceptions = PropertiesHelper.isProperty(shcvProperty); } final String method = request.getMethod(); final EntityPresence entityPresence = METHODS.get(method.toUpperCase()); if (entityPresence == EntityPresence.MUST_BE_NULL && request.hasEntity()) { if (suppressExceptions) { LOGGER.warning(LocalizationMessages.ERROR_HTTP_METHOD_ENTITY_NOT_NULL(method)); } else { throw new IllegalStateException(LocalizationMessages.ERROR_HTTP_METHOD_ENTITY_NOT_NULL(method)); } } else if (entityPresence == EntityPresence.MUST_BE_PRESENT && !request.hasEntity()) { if (suppressExceptions) { LOGGER.warning(LocalizationMessages.ERROR_HTTP_METHOD_ENTITY_NULL(method)); } else { throw new IllegalStateException(LocalizationMessages.ERROR_HTTP_METHOD_ENTITY_NULL(method)); } } }
private void validateHttpMethodAndEntity(final ClientRequest request) { boolean suppressExceptions; suppressExceptions = PropertiesHelper.isProperty( request.getConfiguration().getProperty(ClientProperties.SUPPRESS_HTTP_COMPLIANCE_VALIDATION)); final Object shcvProperty = request.getProperty(ClientProperties.SUPPRESS_HTTP_COMPLIANCE_VALIDATION); if (shcvProperty != null) { // override global configuration with request-specific suppressExceptions = PropertiesHelper.isProperty(shcvProperty); } final String method = request.getMethod(); final EntityPresence entityPresence = METHODS.get(method.toUpperCase()); if (entityPresence == EntityPresence.MUST_BE_NULL && request.hasEntity()) { if (suppressExceptions) { LOGGER.warning(LocalizationMessages.ERROR_HTTP_METHOD_ENTITY_NOT_NULL(method)); } else { throw new IllegalStateException(LocalizationMessages.ERROR_HTTP_METHOD_ENTITY_NOT_NULL(method)); } } else if (entityPresence == EntityPresence.MUST_BE_PRESENT && !request.hasEntity()) { if (suppressExceptions) { LOGGER.warning(LocalizationMessages.ERROR_HTTP_METHOD_ENTITY_NULL(method)); } else { throw new IllegalStateException(LocalizationMessages.ERROR_HTTP_METHOD_ENTITY_NULL(method)); } } }
private ClientResponse _apply(final ClientRequest request) { checkNotClosed(); final ClientResponse response = new ClientResponse(LOOPBACK_STATUS, request); // Headers. response.headers(HeaderUtils.asStringHeaders(request.getHeaders())); // Entity. if (request.hasEntity()) { response.setEntityStream(new ByteArrayInputStream(bufferEntity(request))); } return response; }
if (jerseyRequest.hasEntity()) { nettyRequest = new DefaultHttpRequest(HttpVersion.HTTP_1_1, HttpMethod.valueOf(jerseyRequest.getMethod()), if (jerseyRequest.hasEntity()) { if (jerseyRequest.getLengthLong() == -1) { HttpUtil.setTransferEncodingChunked(nettyRequest, true); if (jerseyRequest.hasEntity()) {
if (requestContext.hasEntity()) {
private void validateHttpMethodAndEntity(final ClientRequest request) { boolean suppressExceptions; suppressExceptions = PropertiesHelper.isProperty( request.getConfiguration().getProperty(ClientProperties.SUPPRESS_HTTP_COMPLIANCE_VALIDATION)); final Object shcvProperty = request.getProperty(ClientProperties.SUPPRESS_HTTP_COMPLIANCE_VALIDATION); if (shcvProperty != null) { // override global configuration with request-specific suppressExceptions = PropertiesHelper.isProperty(shcvProperty); } final String method = request.getMethod(); final EntityPresence entityPresence = METHODS.get(method.toUpperCase()); if (entityPresence == EntityPresence.MUST_BE_NULL && request.hasEntity()) { if (suppressExceptions) { LOGGER.warning(LocalizationMessages.ERROR_HTTP_METHOD_ENTITY_NOT_NULL(method)); } else { throw new IllegalStateException(LocalizationMessages.ERROR_HTTP_METHOD_ENTITY_NOT_NULL(method)); } } else if (entityPresence == EntityPresence.MUST_BE_PRESENT && !request.hasEntity()) { if (suppressExceptions) { LOGGER.warning(LocalizationMessages.ERROR_HTTP_METHOD_ENTITY_NULL(method)); } else { throw new IllegalStateException(LocalizationMessages.ERROR_HTTP_METHOD_ENTITY_NULL(method)); } } }
private void validateHttpMethodAndEntity(final ClientRequest request) { boolean suppressExceptions; suppressExceptions = PropertiesHelper.isProperty( request.getConfiguration().getProperty(ClientProperties.SUPPRESS_HTTP_COMPLIANCE_VALIDATION)); final Object shcvProperty = request.getProperty(ClientProperties.SUPPRESS_HTTP_COMPLIANCE_VALIDATION); if (shcvProperty != null) { // override global configuration with request-specific suppressExceptions = PropertiesHelper.isProperty(shcvProperty); } final String method = request.getMethod(); final EntityPresence entityPresence = METHODS.get(method.toUpperCase()); if (entityPresence == EntityPresence.MUST_BE_NULL && request.hasEntity()) { if (suppressExceptions) { LOGGER.warning(LocalizationMessages.ERROR_HTTP_METHOD_ENTITY_NOT_NULL(method)); } else { throw new IllegalStateException(LocalizationMessages.ERROR_HTTP_METHOD_ENTITY_NOT_NULL(method)); } } else if (entityPresence == EntityPresence.MUST_BE_PRESENT && !request.hasEntity()) { if (suppressExceptions) { LOGGER.warning(LocalizationMessages.ERROR_HTTP_METHOD_ENTITY_NULL(method)); } else { throw new IllegalStateException(LocalizationMessages.ERROR_HTTP_METHOD_ENTITY_NULL(method)); } } }
private void validateHttpMethodAndEntity(final ClientRequest request) { boolean suppressExceptions; suppressExceptions = PropertiesHelper.isProperty( request.getConfiguration().getProperty(ClientProperties.SUPPRESS_HTTP_COMPLIANCE_VALIDATION)); final Object shcvProperty = request.getProperty(ClientProperties.SUPPRESS_HTTP_COMPLIANCE_VALIDATION); if (shcvProperty != null) { // override global configuration with request-specific suppressExceptions = PropertiesHelper.isProperty(shcvProperty); } final String method = request.getMethod(); final EntityPresence entityPresence = METHODS.get(method.toUpperCase()); if (entityPresence == EntityPresence.MUST_BE_NULL && request.hasEntity()) { if (suppressExceptions) { LOGGER.warning(LocalizationMessages.ERROR_HTTP_METHOD_ENTITY_NOT_NULL(method)); } else { throw new IllegalStateException(LocalizationMessages.ERROR_HTTP_METHOD_ENTITY_NOT_NULL(method)); } } else if (entityPresence == EntityPresence.MUST_BE_PRESENT && !request.hasEntity()) { if (suppressExceptions) { LOGGER.warning(LocalizationMessages.ERROR_HTTP_METHOD_ENTITY_NULL(method)); } else { throw new IllegalStateException(LocalizationMessages.ERROR_HTTP_METHOD_ENTITY_NULL(method)); } } }
private void validateHttpMethodAndEntity(final ClientRequest request) { boolean suppressExceptions; suppressExceptions = PropertiesHelper.isProperty( request.getConfiguration().getProperty(ClientProperties.SUPPRESS_HTTP_COMPLIANCE_VALIDATION)); final Object shcvProperty = request.getProperty(ClientProperties.SUPPRESS_HTTP_COMPLIANCE_VALIDATION); if (shcvProperty != null) { // override global configuration with request-specific suppressExceptions = PropertiesHelper.isProperty(shcvProperty); } final String method = request.getMethod(); final EntityPresence entityPresence = METHODS.get(method.toUpperCase()); if (entityPresence == EntityPresence.MUST_BE_NULL && request.hasEntity()) { if (suppressExceptions) { LOGGER.warning(LocalizationMessages.ERROR_HTTP_METHOD_ENTITY_NOT_NULL(method)); } else { throw new IllegalStateException(LocalizationMessages.ERROR_HTTP_METHOD_ENTITY_NOT_NULL(method)); } } else if (entityPresence == EntityPresence.MUST_BE_PRESENT && !request.hasEntity()) { if (suppressExceptions) { LOGGER.warning(LocalizationMessages.ERROR_HTTP_METHOD_ENTITY_NULL(method)); } else { throw new IllegalStateException(LocalizationMessages.ERROR_HTTP_METHOD_ENTITY_NULL(method)); } } }
private String buildSignature(ClientRequest request, String timestamp) { String method = getMethod(request); String path = getPath(request); byte[] content = request.hasEntity() ? getContent(request) : null; return signatureGenerator.generate(secretKey, method, timestamp, path, content); }
private ClientResponse _apply(final ClientRequest request) { checkNotClosed(); final ClientResponse response = new ClientResponse(LOOPBACK_STATUS, request); // Headers. response.headers(HeaderUtils.asStringHeaders(request.getHeaders())); // Entity. if (request.hasEntity()) { response.setEntityStream(new ByteArrayInputStream(bufferEntity(request))); } return response; }
if (requestContext.hasEntity()) {