// This throws Exception to remind the caller to deal with arbitrary exceptions including // RuntimeException // in a way appropriate for the public method that was originally invoked. private RestRequest buildRequest( URI uri, ResourceMethod method, DataMap dataMap, Map<String, String> headers, List<String> cookies, ProtocolVersion protocolVersion, ContentType contentType, List<AcceptType> acceptTypes) throws Exception { RestRequestBuilder requestBuilder = new RestRequestBuilder(uri).setMethod(method.getHttpMethod().toString()); requestBuilder.setHeaders(headers); requestBuilder.setCookies(cookies); addAcceptHeaders(requestBuilder, acceptTypes); addEntityAndContentTypeHeaders(requestBuilder, dataMap, contentType); addProtocolVersionHeader(requestBuilder, protocolVersion); if (method.getHttpMethod() == HttpMethod.POST) { requestBuilder.setHeader(RestConstants.HEADER_RESTLI_REQUEST_METHOD, method.toString()); } return requestBuilder.build(); }
/** * Computes the hashCode using the new fields * * @return */ @Override public int hashCode() { int hashCode = _method.hashCode(); hashCode = 31 * hashCode + (_inputRecord != null ? _inputRecord.hashCode() : 0); hashCode = 31 * hashCode + (_headers != null ? _headers.hashCode() : 0); hashCode = 31 * hashCode + (_baseUriTemplate != null ? _baseUriTemplate.hashCode() : 0); hashCode = 31 * hashCode + (_pathKeys != null ? _pathKeys.hashCode() : 0); hashCode = 31 * hashCode + (_resourceSpec != null ? _resourceSpec.hashCode() : 0); hashCode = 31 * hashCode + (_queryParams != null ? _queryParams.hashCode() : 0); hashCode = 31 * hashCode + (_methodName != null ? _methodName.hashCode() : 0); hashCode = 31 * hashCode + (_requestOptions != null ? _requestOptions.hashCode() : 0); return hashCode; }
/** @see HttpMethod#isIdempotent() */ public boolean isIdempotent() { return _method.getHttpMethod().isIdempotent(); }
/** @see HttpMethod#isSafe() */ public boolean isSafe() { return _method.getHttpMethod().isSafe(); }