Class MockRestRequest
- All Implemented Interfaces:
- AutoCloseable,- Configurable,- HttpUriRequest,- HttpMessage,- HttpRequest
RestRequest with additional features for mocked testing.
 
 Instances of this class are instantiated through methods on MockRestClient such as MockRestClient.post(Object,Object)
 
Notes:
- This class is not thread safe.
See Also:
- 
Nested Class SummaryNested classes/interfaces inherited from class org.apache.juneau.BeanSessionBeanSession.Builder
- 
Constructor SummaryConstructorsModifierConstructorDescriptionprotectedMockRestRequest(RestClient client, URI uri, String method, boolean hasBody) Constructs a REST call with the specified method name.
- 
Method SummaryModifier and TypeMethodDescriptionSets the value for theAccept request header.acceptCharset(String value) Sets the value for theAccept-Charset request header.Adds an attribute to the underlyingHttpServletRequestobject.attributes(Map<String, Object> value) Replaces the attributes on the underlyingHttpServletRequestobject.Overrides the authorization type value on the underlyingHttpServletRequestobject.cancellable(Cancellable cancellable) SetsCancellablefor the ongoing operation.characterEncoding(String value) Overrides the character encoding value on the underlyingHttpServletRequestobject.config(RequestConfig value) Sets the actual request configuration.Sets the body of this request.content(Object input, HttpPartSchema schema) Sets the body of this request.contentString(Object input) Sets the body of this request as straight text bypassing the serializer.contentType(String value) Sets the value for theContent-Type request header.context(HttpContext context) Override the context to use for the execution.contextPath(String value) Overrides the context path on the underlyingHttpServletRequestobject.cookies(jakarta.servlet.http.Cookie[] value) Overrides the cookies on the underlyingHttpServletRequestobject.debug()SetsDebug: value header on this request.dispatcherType(jakarta.servlet.DispatcherType value) Overrides the dispatcher type value on the underlyingHttpServletRequestobject.errorCodes(Predicate<Integer> value) Allows you to override what status codes are considered error codes that would result in aRestCallException.Adds a form-data parameter to the request body.formData(NameValuePair... parts) Appends multiple form-data parameters to the request.formDataBean(Object value) Appends multiple form-data parameters to the request from properties defined on a Java bean.formDataCustom(Object value) Adds form-data parameters as the entire body of the request.formDataPairs(String... pairs) Adds form-data parameters to the request body using free-form key/value pairs.Returns the attributes to add to the underlyingHttpServletRequestobject.Returns the authorization type value to set on the underlyingHttpServletRequestobject.Returns the value to set for the return value on the underlyingServletRequest.getCharacterEncoding()method.Returns the context path to set on the underlyingHttpServletRequestobject.jakarta.servlet.http.Cookie[]Returns the cookies to set on the underlyingHttpServletRequestobject.jakarta.servlet.DispatcherTypeReturns the dispatcher type value to set on the underlyingHttpServletRequestobject.jakarta.servlet.http.HttpSessionReturns the HTTP session to set on the underlyingHttpServletRequestobject.Returns the local address value to set on the underlyingHttpServletRequestobject.Returns the locale to set on the underlyingHttpServletRequestobject.Returns the local name value to set on the underlyingHttpServletRequestobject.Returns the local port value to set on the underlyingHttpServletRequestobject.Returns the path-info value to set on the underlyingHttpServletRequestobject.Returns the path-translated value to set on the underlyingHttpServletRequestobject.Returns the HTTP protocol value to set on the underlyingHttpServletRequestobject.Returns the query string to set on the underlyingHttpServletRequestobject.Returns the remote address value to set on the underlyingHttpServletRequestobject.Returns the remote host value to set on the underlyingHttpServletRequestobject.Returns the remote port value to set on the underlyingHttpServletRequestobject.Returns the remote user to set on the underlyingHttpServletRequestobject.Returns the request dispatcher to set on the underlyingHttpServletRequestobhject.Returns the requested session ID to set on the underlyingHttpServletRequestobject.Returns the request URI to set on the underlyingHttpServletRequestobject.String[]getRoles()Returns the user roles to set on the underlyingHttpServletRequestobject.Returns the HTTP schema value to set on the underlyingHttpServletRequestobject.Returns the server name value to set on the underlyingHttpServletRequestobject.Returns the server port value to set on the underlyingHttpServletRequestobject.jakarta.servlet.ServletContextReturns the servlet context to set on the underlyingHttpServletRequestobject.Returns the servlet path to set on the underlyingHttpServletRequestobject.Returns the user principal to set on the underlyingHttpServletRequestobject.Appends a header to the request.Appends a header to the request.headerPairs(String... pairs) Appends multiple headers to the request using freeform key/value pairs.Appends multiple headers to the request.headersBean(Object value) Appends multiple headers to the request from properties defined on a Java bean.html()Convenience method for specifying HTML as the marshalling transmission media type for this request only.htmlDoc()Convenience method for specifying HTML DOC as the marshalling transmission media type for this request only.Convenience method for specifying Stripped HTML DOC as the marshalling transmission media type for this request only.httpSession(jakarta.servlet.http.HttpSession value) Overrides the HTTP session on the underlyingHttpServletRequestobject.PreventRestCallExceptionsfrom being thrown when HTTP status 400+ is encountered.interceptors(RestCallInterceptor... interceptors) Add one or more interceptors for this call only.json()Convenience method for specifying JSON as the marshalling transmission media type for this request only.json5()Convenience method for specifying Simplified JSON as the marshalling transmission media type for this request only.Overrides the local address value on the underlyingHttpServletRequestobject.Overrides the locale on the underlyingHttpServletRequestobject.Overrides the local name value on the underlyingHttpServletRequestobject.localPort(int value) Overrides the local port value on the underlyingHttpServletRequestobject.Shortcut for setting theAccept andContent-Type headers on a request.msgPack()Convenience method for specifying MessagePack as the marshalling transmission media type for this request only.noTrace()When called,No-Trace: true is added to requests.openApi()Convenience method for specifying OpenAPI as the marshalling transmission media type for this request only.Specifies the parser to use on the response body.Specifies the parser to use on the response body.Sets or replaces a path parameter of the form"{name}" in the URI.pathData(NameValuePair... parts) Sets or replaces multiple path parameters on the request.pathDataBean(Object value) Sets multiple path parameters to the request from properties defined on a Java bean.pathDataPairs(String... pairs) Replaces path parameters of the form"{name}" in the URI using free-form key/value pairs.Overrides the path-info value on the underlyingHttpServletRequestobject.pathTranslated(String value) Overrides the path-translated value on the underlyingHttpServletRequestobject.Convenience method for specifying Plain Text as the marshalling transmission media type for this request only.Overrides the HTTP protocol value on the underlyingHttpServletRequestobject.protocolVersion(ProtocolVersion version) Sets the protocol version for this request.queryCustom(Object value) Adds a free-form custom query.Appends a query parameter to the URI of the request.queryData(NameValuePair... parts) Appends multiple query parameters to the request.queryDataBean(Object value) Appends multiple query parameters to the request from properties defined on a Java bean.queryDataPairs(String... pairs) Adds query parameters to the URI query using free-form key/value pairs..queryString(String value) Overrides the query string on the underlyingHttpServletRequestobject.remoteAddr(String value) Overrides the remote address value on the underlyingHttpServletRequestobject.remoteHost(String value) Overrides the remote host value on the underlyingHttpServletRequestobject.remotePort(int value) Overrides the remote port value on the underlyingHttpServletRequestobject.remoteUser(String value) Overrides the remote user on the underlyingHttpServletRequestobject.requestDispatcher(String path, jakarta.servlet.RequestDispatcher value) Overrides the request dispatcher on the underlyingHttpServletRequestobject.requestedSessionId(String value) Overrides the requested session ID on the underlyingHttpServletRequestobject.requestURI(String value) Overrides the request URI on the underlyingHttpServletRequestobject.Rethrow any of the specified exception types if a matchingException-Name header is found.Specifies the value for the security roles on the underlyingHttpServletRequestobject.Specifies the user roles on the underlyingHttpServletRequestobject.serializer(Class<? extends Serializer> serializer) Specifies the serializer to use on the request body.serializer(Serializer serializer) Specifies the serializer to use on the request body.serverName(String value) Overrides the server name value on the underlyingHttpServletRequestobject.serverPort(int value) Overrides the server port value on the underlyingHttpServletRequestobject.servletContext(jakarta.servlet.ServletContext value) Overrides the servlet context on the underlyingHttpServletRequestobject.servletPath(String value) Overrides the servlet path on the underlyingHttpServletRequestobject.Causes logging to be suppressed for the duration of this request.Specifies the target host for the request.uon()Convenience method for specifying UON as the marshalling transmission media type for this request only.Sets the URI for this request.uriFragment(String fragment) Sets the URI fragment.Sets the URI host.uriPort(int port) Sets the URI port.Overrides the HTTP schema value on the underlyingHttpServletRequestobject.uriUserInfo(String userInfo) Sets the URI user info.uriUserInfo(String username, String password) Sets the URI user info.urlEnc()Convenience method for specifying URL-Encoding as the marshalling transmission media type for this request only.userPrincipal(Principal value) Overrides the user principal on the underlyingHttpServletRequestobject.xml()Convenience method for specifying XML as the marshalling transmission media type for this request only.Methods inherited from class org.apache.juneau.rest.client.RestRequestabort, addHeader, addHeader, close, complete, completed, completeFuture, containsHeader, createHeader, createInnerRequest, createPart, getAllHeaders, getConfig, getFirstHeader, getFormData, getHeaders, getHeaders, getHttpEntity, getLastHeader, getMethod, getParams, getPathData, getProtocolVersion, getQueryData, getRequestLine, getResponse, getResponse, getResponseAsString, getURI, hasHttpEntity, headerIterator, headerIterator, isAborted, isDebug, log, log, properties, removeHeader, removeHeaders, run, runFuture, setHeader, setHeader, setHeaders, setParamsMethods inherited from class org.apache.juneau.BeanSession_class, addWarning, convertToMemberType, convertToMemberType, convertToType, convertToType, convertToType, create, getArgsClassMeta, getBeanClassVisibility, getBeanConstructorVisibility, getBeanDictionary, getBeanFieldVisibility, getBeanMeta, getBeanMethodVisibility, getBeanRegistry, getBeanTypePropertyName, getBeanTypePropertyName, getClassMeta, getClassMeta, getClassMetaForObject, getClassMetaForObject, getMediaType, getNamePropertyName, getNotBeanClasses, getNotBeanPackagesNames, getNotBeanPackagesPrefixes, getPropertyNamer, getSwaps, getTimeZone, getTimeZoneId, isBean, isBean, isBeanMapPutReturnsOldValue, isBeansRequireDefaultConstructor, isBeansRequireSerializable, isBeansRequireSettersForGetters, isBeansRequireSomeProperties, isFindFluentSetters, isIgnoreInvocationExceptionsOnGetters, isIgnoreInvocationExceptionsOnSetters, isIgnoreMissingSetters, isIgnoreUnknownBeanProperties, isIgnoreUnknownNullBeanProperties, isSortProperties, isUseEnumNames, isUseInterfaceProxies, isUseJavaBeanIntrospector, newBean, newBean, newBeanMap, newBeanMap, newGenericMap, object, string, toArray, toBeanMap, toBeanMap, toBeanMapMethods inherited from class org.apache.juneau.ContextSessioncheckForWarnings, getContext, getSessionProperties, getWarnings, toString
- 
Constructor Details- 
MockRestRequestprotected MockRestRequest(RestClient client, URI uri, String method, boolean hasBody) throws RestCallException Constructs a REST call with the specified method name.- Parameters:
- client- The client that created this request.
- uri- The target URI.
- method- The HTTP method name (uppercase).
- hasBody- Whether this method has a body.
- Throws:
- RestCallException- If an exception or non-200 response code occurred during the connection attempt.
 
 
- 
- 
Method Details- 
attributeAdds an attribute to the underlyingHttpServletRequestobject.This value gets copied to the servlet request after the call to HttpClientConnection.sendRequestHeader(HttpRequest)and right beforeHttpClientConnection.sendRequestEntity(HttpEntityEnclosingRequest).- Parameters:
- name- The servlet request attribute name.
- value- The servlet request attribute value.
- Returns:
- This object.
 
- 
attributesReplaces the attributes on the underlyingHttpServletRequestobject.This value gets copied to the servlet request after the call to HttpClientConnection.sendRequestHeader(HttpRequest)and right beforeHttpClientConnection.sendRequestEntity(HttpEntityEnclosingRequest).- Parameters:
- value- The new servlet attribute values.
- Returns:
- This object.
 
- 
getAttributeMapReturns the attributes to add to the underlyingHttpServletRequestobject.- Returns:
- The attributes to add to the underlying HttpServletRequestobject.
 
- 
rolesSpecifies the user roles on the underlyingHttpServletRequestobject.Affects the results of calling HttpServletRequest.isUserInRole(String).This value gets copied to the servlet request after the call to HttpClientConnection.sendRequestHeader(HttpRequest)and right beforeHttpClientConnection.sendRequestEntity(HttpEntityEnclosingRequest).- Parameters:
- roles- The roles to add to this request (e.g.- "ROLE_ADMIN" ).
- Returns:
- This object.
 
- 
getRolesReturns the user roles to set on the underlyingHttpServletRequestobject.- Returns:
- The user roles to set on the underlying HttpServletRequestobject.
 
- 
roleSpecifies the value for the security roles on the underlyingHttpServletRequestobject.Affects the results of calling HttpServletRequest.isUserInRole(String).This value gets copied to the servlet request after the call to HttpClientConnection.sendRequestHeader(HttpRequest)and right beforeHttpClientConnection.sendRequestEntity(HttpEntityEnclosingRequest).- Parameters:
- role- The role to add to this request (e.g.- "ROLE_ADMIN" ).
- Returns:
- This object.
 
- 
characterEncodingOverrides the character encoding value on the underlyingHttpServletRequestobject.Affects the results of calling ServletRequest.getCharacterEncoding().This value gets copied to the servlet request after the call to HttpClientConnection.sendRequestHeader(HttpRequest)and right beforeHttpClientConnection.sendRequestEntity(HttpEntityEnclosingRequest).- Parameters:
- value- The new value for this setting.
- Returns:
- This object.
 
- 
getCharacterEncodingReturns the value to set for the return value on the underlyingServletRequest.getCharacterEncoding()method.- Returns:
- The value to set for the return value on the underlying ServletRequest.getCharacterEncoding()method.
 
- 
protocolOverrides the HTTP protocol value on the underlyingHttpServletRequestobject.Affects the results of calling ServletRequest.getProtocol().This value gets copied to the servlet request after the call to HttpClientConnection.sendRequestHeader(HttpRequest)and right beforeHttpClientConnection.sendRequestEntity(HttpEntityEnclosingRequest).- Parameters:
- value- The new value for this setting.
- Returns:
- This object.
 
- 
getProtocolReturns the HTTP protocol value to set on the underlyingHttpServletRequestobject.- Returns:
- The HTTP protocol value to set on the underlying HttpServletRequestobject.
 
- 
uriSchemeOverrides the HTTP schema value on the underlyingHttpServletRequestobject.Affects the results of calling ServletRequest.getScheme().This value gets copied to the servlet request after the call to HttpClientConnection.sendRequestHeader(HttpRequest)and right beforeHttpClientConnection.sendRequestEntity(HttpEntityEnclosingRequest).- Overrides:
- uriSchemein class- RestRequest
- Parameters:
- value- The new value for this setting.
- Returns:
- This object.
 
- 
getSchemeReturns the HTTP schema value to set on the underlyingHttpServletRequestobject.- Returns:
- The HTTP schema value to set on the underlying HttpServletRequestobject.
 
- 
serverNameOverrides the server name value on the underlyingHttpServletRequestobject.Affects the results of calling ServletRequest.getServerName().This value gets copied to the servlet request after the call to HttpClientConnection.sendRequestHeader(HttpRequest)and right beforeHttpClientConnection.sendRequestEntity(HttpEntityEnclosingRequest).- Parameters:
- value- The new value for this setting.
- Returns:
- This object.
 
- 
getServerNameReturns the server name value to set on the underlyingHttpServletRequestobject.- Returns:
- The server name value to set on the underlying HttpServletRequestobject.
 
- 
serverPortOverrides the server port value on the underlyingHttpServletRequestobject.Affects the results of calling ServletRequest.getServerPort().This value gets copied to the servlet request after the call to HttpClientConnection.sendRequestHeader(HttpRequest)and right beforeHttpClientConnection.sendRequestEntity(HttpEntityEnclosingRequest).- Parameters:
- value- The new value for this setting.
- Returns:
- This object.
 
- 
getServerPortReturns the server port value to set on the underlyingHttpServletRequestobject.- Returns:
- The server port value to set on the underlying HttpServletRequestobject.
 
- 
remoteAddrOverrides the remote address value on the underlyingHttpServletRequestobject.Affects the results of calling ServletRequest.getRemoteAddr().This value gets copied to the servlet request after the call to HttpClientConnection.sendRequestHeader(HttpRequest)and right beforeHttpClientConnection.sendRequestEntity(HttpEntityEnclosingRequest).- Parameters:
- value- The new value for this setting.
- Returns:
- This object.
 
- 
getRemoteAddrReturns the remote address value to set on the underlyingHttpServletRequestobject.- Returns:
- The remote address value to set on the underlying HttpServletRequestobject.
 
- 
remoteHostOverrides the remote host value on the underlyingHttpServletRequestobject.Affects the results of calling ServletRequest.getRemoteHost().This value gets copied to the servlet request after the call to HttpClientConnection.sendRequestHeader(HttpRequest)and right beforeHttpClientConnection.sendRequestEntity(HttpEntityEnclosingRequest).- Parameters:
- value- The new value for this setting.
- Returns:
- This object.
 
- 
getRemoteHostReturns the remote host value to set on the underlyingHttpServletRequestobject.- Returns:
- The remote host value to set on the underlying HttpServletRequestobject.
 
- 
localeOverrides the locale on the underlyingHttpServletRequestobject.Affects the results of calling ServletRequest.getLocale().This value gets copied to the servlet request after the call to HttpClientConnection.sendRequestHeader(HttpRequest)and right beforeHttpClientConnection.sendRequestEntity(HttpEntityEnclosingRequest).- Parameters:
- value- The new value for this setting.
- Returns:
- This object.
 
- 
getLocaleReturns the locale to set on the underlyingHttpServletRequestobject.- Overrides:
- getLocalein class- BeanSession
- Returns:
- The locale to set on the underlying HttpServletRequestobject.
- See Also:
 
- 
remotePortOverrides the remote port value on the underlyingHttpServletRequestobject.Affects the results of calling ServletRequest.getRemotePort().This value gets copied to the servlet request after the call to HttpClientConnection.sendRequestHeader(HttpRequest)and right beforeHttpClientConnection.sendRequestEntity(HttpEntityEnclosingRequest).- Parameters:
- value- The new value for this setting.
- Returns:
- This object.
 
- 
getRemotePortReturns the remote port value to set on the underlyingHttpServletRequestobject.- Returns:
- The remote port value to set on the underlying HttpServletRequestobject.
 
- 
localNameOverrides the local name value on the underlyingHttpServletRequestobject.Affects the results of calling ServletRequest.getLocalName().This value gets copied to the servlet request after the call to HttpClientConnection.sendRequestHeader(HttpRequest)and right beforeHttpClientConnection.sendRequestEntity(HttpEntityEnclosingRequest).- Parameters:
- value- The new value for this setting.
- Returns:
- This object.
 
- 
getLocalNameReturns the local name value to set on the underlyingHttpServletRequestobject.- Returns:
- The local name value to set on the underlying HttpServletRequestobject.
 
- 
localAddrOverrides the local address value on the underlyingHttpServletRequestobject.Affects the results of calling ServletRequest.getLocalAddr().This value gets copied to the servlet request after the call to HttpClientConnection.sendRequestHeader(HttpRequest)and right beforeHttpClientConnection.sendRequestEntity(HttpEntityEnclosingRequest).- Parameters:
- value- The new value for this setting.
- Returns:
- This object.
 
- 
getLocalAddrReturns the local address value to set on the underlyingHttpServletRequestobject.- Returns:
- The local address value to set on the underlying HttpServletRequestobject.
 
- 
localPortOverrides the local port value on the underlyingHttpServletRequestobject.Affects the results of calling ServletRequest.getLocalPort().This value gets copied to the servlet request after the call to HttpClientConnection.sendRequestHeader(HttpRequest)and right beforeHttpClientConnection.sendRequestEntity(HttpEntityEnclosingRequest).- Parameters:
- value- The new value for this setting.
- Returns:
- This object.
 
- 
getLocalPortReturns the local port value to set on the underlyingHttpServletRequestobject.- Returns:
- The local port value to set on the underlying HttpServletRequestobject.
 
- 
requestDispatcherOverrides the request dispatcher on the underlyingHttpServletRequestobject.Affects the results of calling ServletRequest.getRequestDispatcher(String).This value gets copied to the servlet request after the call to HttpClientConnection.sendRequestHeader(HttpRequest)and right beforeHttpClientConnection.sendRequestEntity(HttpEntityEnclosingRequest).- Parameters:
- path- The path to the resource being resolved.
- value- The new value for this setting.
- Returns:
- This object.
 
- 
getRequestDispatcherMapReturns the request dispatcher to set on the underlyingHttpServletRequestobhject.- Returns:
- The value of the requestDispatcherMap property on this bean, ornull if it is not set.
 
- 
servletContextOverrides the servlet context on the underlyingHttpServletRequestobject.Affects the results of calling ServletRequest.getServletContext().This value gets copied to the servlet request after the call to HttpClientConnection.sendRequestHeader(HttpRequest)and right beforeHttpClientConnection.sendRequestEntity(HttpEntityEnclosingRequest).- Parameters:
- value- The new value for this setting.
- Returns:
- This object.
 
- 
getServletContextReturns the servlet context to set on the underlyingHttpServletRequestobject.- Returns:
- The servlet context to set on the underlying HttpServletRequestobject.
 
- 
dispatcherTypeOverrides the dispatcher type value on the underlyingHttpServletRequestobject.Affects the results of calling ServletRequest.getDispatcherType().This value gets copied to the servlet request after the call to HttpClientConnection.sendRequestHeader(HttpRequest)and right beforeHttpClientConnection.sendRequestEntity(HttpEntityEnclosingRequest).- Parameters:
- value- The new value for this setting.
- Returns:
- This object.
 
- 
getDispatcherTypeReturns the dispatcher type value to set on the underlyingHttpServletRequestobject.- Returns:
- The dispatcher type value to set on the underlying HttpServletRequestobject.
 
- 
authTypeOverrides the authorization type value on the underlyingHttpServletRequestobject.Affects the results of calling HttpServletRequest.getAuthType().This value gets copied to the servlet request after the call to HttpClientConnection.sendRequestHeader(HttpRequest)and right beforeHttpClientConnection.sendRequestEntity(HttpEntityEnclosingRequest).- Parameters:
- value- The new value for this setting.
- Returns:
- This object.
 
- 
getAuthTypeReturns the authorization type value to set on the underlyingHttpServletRequestobject.- Returns:
- The authorization type value to set on the underlying HttpServletRequestobject.
 
- 
cookiesOverrides the cookies on the underlyingHttpServletRequestobject.Affects the results of calling HttpServletRequest.getCookies().This value gets copied to the servlet request after the call to HttpClientConnection.sendRequestHeader(HttpRequest)and right beforeHttpClientConnection.sendRequestEntity(HttpEntityEnclosingRequest).- Parameters:
- value- The new value for this setting.
- Returns:
- This object.
 
- 
getCookiesReturns the cookies to set on the underlyingHttpServletRequestobject.- Returns:
- The cookies to set on the underlying HttpServletRequestobject.
 
- 
pathInfoOverrides the path-info value on the underlyingHttpServletRequestobject.Affects the results of calling HttpServletRequest.getPathInfo().This value gets copied to the servlet request after the call to HttpClientConnection.sendRequestHeader(HttpRequest)and right beforeHttpClientConnection.sendRequestEntity(HttpEntityEnclosingRequest).- Parameters:
- value- The new value for this setting.
- Returns:
- This object.
 
- 
getPathInfoReturns the path-info value to set on the underlyingHttpServletRequestobject.- Returns:
- The path-info value to set on the underlying HttpServletRequestobject.
 
- 
pathTranslatedOverrides the path-translated value on the underlyingHttpServletRequestobject.Affects the results of calling HttpServletRequest.getPathTranslated().This value gets copied to the servlet request after the call to HttpClientConnection.sendRequestHeader(HttpRequest)and right beforeHttpClientConnection.sendRequestEntity(HttpEntityEnclosingRequest).- Parameters:
- value- The new value for this setting.
- Returns:
- This object.
 
- 
getPathTranslatedReturns the path-translated value to set on the underlyingHttpServletRequestobject.- Returns:
- The path-translated value to set on the underlying HttpServletRequestobject.
 
- 
contextPathOverrides the context path on the underlyingHttpServletRequestobject.Affects the results of calling HttpServletRequest.getContextPath().This value gets copied to the servlet request after the call to HttpClientConnection.sendRequestHeader(HttpRequest)and right beforeHttpClientConnection.sendRequestEntity(HttpEntityEnclosingRequest).- Parameters:
- value- The new value for this setting.
- Returns:
- This object.
 
- 
getContextPathReturns the context path to set on the underlyingHttpServletRequestobject.- Returns:
- The context path to set on the underlying HttpServletRequestobject.
 
- 
queryStringOverrides the query string on the underlyingHttpServletRequestobject.Affects the results of calling HttpServletRequest.getQueryString().This value gets copied to the servlet request after the call to HttpClientConnection.sendRequestHeader(HttpRequest)and right beforeHttpClientConnection.sendRequestEntity(HttpEntityEnclosingRequest).- Parameters:
- value- The new value for this setting.
- Returns:
- This object.
 
- 
getQueryStringReturns the query string to set on the underlyingHttpServletRequestobject.- Returns:
- The query string to set on the underlying HttpServletRequestobject.
 
- 
remoteUserOverrides the remote user on the underlyingHttpServletRequestobject.Affects the results of calling HttpServletRequest.getRemoteUser().This value gets copied to the servlet request after the call to HttpClientConnection.sendRequestHeader(HttpRequest)and right beforeHttpClientConnection.sendRequestEntity(HttpEntityEnclosingRequest).- Parameters:
- value- The new value for this setting.
- Returns:
- This object.
 
- 
getRemoteUserReturns the remote user to set on the underlyingHttpServletRequestobject.- Returns:
- The remote user to set on the underlying HttpServletRequestobject.
 
- 
userPrincipalOverrides the user principal on the underlyingHttpServletRequestobject.Affects the results of calling HttpServletRequest.getUserPrincipal().This value gets copied to the servlet request after the call to HttpClientConnection.sendRequestHeader(HttpRequest)and right beforeHttpClientConnection.sendRequestEntity(HttpEntityEnclosingRequest).- Parameters:
- value- The new value for this setting.
- Returns:
- This object.
 
- 
getUserPrincipalReturns the user principal to set on the underlyingHttpServletRequestobject.- Returns:
- The user principal to set on the underlying HttpServletRequestobject.
 
- 
requestedSessionIdOverrides the requested session ID on the underlyingHttpServletRequestobject.Affects the results of calling HttpServletRequest.getRequestedSessionId().This value gets copied to the servlet request after the call to HttpClientConnection.sendRequestHeader(HttpRequest)and right beforeHttpClientConnection.sendRequestEntity(HttpEntityEnclosingRequest).- Parameters:
- value- The new value for this setting.
- Returns:
- This object.
 
- 
getRequestedSessionIdReturns the requested session ID to set on the underlyingHttpServletRequestobject.- Returns:
- The requested session ID to set on the underlying HttpServletRequestobject.
 
- 
requestURIOverrides the request URI on the underlyingHttpServletRequestobject.Affects the results of calling HttpServletRequest.getRequestURI().This value gets copied to the servlet request after the call to HttpClientConnection.sendRequestHeader(HttpRequest)and right beforeHttpClientConnection.sendRequestEntity(HttpEntityEnclosingRequest).- Parameters:
- value- The new value for this setting.
- Returns:
- This object.
 
- 
getRequestURIReturns the request URI to set on the underlyingHttpServletRequestobject.- Returns:
- The request URI to set on the underlying HttpServletRequestobject.
 
- 
servletPathOverrides the servlet path on the underlyingHttpServletRequestobject.Affects the results of calling HttpServletRequest.getServletPath().This value gets copied to the servlet request after the call to HttpClientConnection.sendRequestHeader(HttpRequest)and right beforeHttpClientConnection.sendRequestEntity(HttpEntityEnclosingRequest).- Parameters:
- value- The new value for this setting.
- Returns:
- This object.
 
- 
getServletPathReturns the servlet path to set on the underlyingHttpServletRequestobject.- Returns:
- The servlet path to set on the underlying HttpServletRequestobject.
 
- 
httpSessionOverrides the HTTP session on the underlyingHttpServletRequestobject.Affects the results of calling HttpServletRequest.getSession().This value gets copied to the servlet request after the call to HttpClientConnection.sendRequestHeader(HttpRequest)and right beforeHttpClientConnection.sendRequestEntity(HttpEntityEnclosingRequest).- Parameters:
- value- The new value for this setting.
- Returns:
- This object.
 
- 
getHttpSessionReturns the HTTP session to set on the underlyingHttpServletRequestobject.- Returns:
- The HTTP session to set on the underlying HttpServletRequestobject.
 
- 
acceptDescription copied from class:RestRequestSets the value for theAccept request header.This overrides the media type specified on the parser, but is overridden by calling header("Accept" , value);- Overrides:
- acceptin class- RestRequest
- Parameters:
- value- The new header value.
- Returns:
- This object.
- Throws:
- RestCallException- Invalid input.
 
- 
acceptCharsetDescription copied from class:RestRequestSets the value for theAccept-Charset request header.This is a shortcut for calling header("Accept-Charset" , value);- Overrides:
- acceptCharsetin class- RestRequest
- Parameters:
- value- The new header value.
- Returns:
- This object.
- Throws:
- RestCallException- Invalid input.
 
- 
cancellableDescription copied from class:RestRequestSetsCancellablefor the ongoing operation.- Overrides:
- cancellablein class- RestRequest
- Parameters:
- cancellable- The cancellable object.
- Returns:
- This object.
 
- 
configDescription copied from class:RestRequestSets the actual request configuration.- Overrides:
- configin class- RestRequest
- Parameters:
- value- The new value.
- Returns:
- This object.
 
- 
contentDescription copied from class:RestRequestSets the body of this request.- Overrides:
- contentin class- RestRequest
- Parameters:
- value- The input to be sent to the REST resource (only valid for PUT/POST/PATCH) requests.
 Can be of the following types:- 
         Reader- Raw contents ofReaderwill be serialized to remote resource.
- 
         InputStream- Raw contents ofInputStreamwill be serialized to remote resource.
- 
         HttpResource- Raw contents will be serialized to remote resource. Additional headers and media type will be set on request.
- 
         HttpEntity/BasicHttpEntity- Bypass Juneau serialization and pass HttpEntity directly to HttpClient.
- 
         Object- POJO to be converted to text using theSerializerregistered with theRestClient.
- 
         PartList- Converted to a URL-encoded FORM post.
- 
         A Supplierof anything on this list.
 
- 
         
- Returns:
- This object.
 
- 
contentDescription copied from class:RestRequestSets the body of this request.- Overrides:
- contentin class- RestRequest
- Parameters:
- input- The input to be sent to the REST resource (only valid for PUT/POST/PATCH) requests.
 Can be of the following types:- 
         Reader- Raw contents ofReaderwill be serialized to remote resource.
- 
         InputStream- Raw contents ofInputStreamwill be serialized to remote resource.
- 
         HttpResource- Raw contents will be serialized to remote resource. Additional headers and media type will be set on request.
- 
         HttpEntity/BasicHttpEntity- Bypass Juneau serialization and pass HttpEntity directly to HttpClient.
- 
         Object- POJO to be converted to text using theSerializerregistered with theRestClient.
- 
         PartList- Converted to a URL-encoded FORM post.
- 
         A Supplierof anything on this list.
 
- 
         
- schema- The schema object that defines the format of the output.- If null , defaults toHttpPartSchema.DEFAULT.
- Only used if serializer is schema-aware (e.g. OpenApiSerializer).
 
- If 
- Returns:
- This object.
 
- 
contentStringDescription copied from class:RestRequestSets the body of this request as straight text bypassing the serializer.client .put("/foo" ) .content(new StringReader("foo" )) .contentType("text/foo" ) .run();client .put("/foo" ) .bodyString("foo" ) .run();Note that this is different than the following which will serialize foo as a JSON string"foo" .client .put("/foo" ) .json() .content("foo" ) .run();- Overrides:
- contentStringin class- RestRequest
- Parameters:
- input- The input to be sent to the REST resource (only valid for PUT/POST/PATCH) requests.
- Returns:
- This object.
- Throws:
- RestCallException- If a retry was attempted, but the entity was not repeatable.
 
- 
contentTypeDescription copied from class:RestRequestSets the value for theContent-Type request header.This overrides the media type specified on the serializer, but is overridden by calling header("Content-Type" , value);- Overrides:
- contentTypein class- RestRequest
- Parameters:
- value- The new header value.
- Returns:
- This object.
- Throws:
- RestCallException- Invalid input.
 
- 
contextDescription copied from class:RestRequestOverride the context to use for the execution.- Overrides:
- contextin class- RestRequest
- Parameters:
- context- The context to use for the execution, or- null to use the default context.
- Returns:
- This object.
 
- 
debugDescription copied from class:RestRequestSetsDebug: value header on this request.- Overrides:
- debugin class- RestRequest
- Returns:
- This object.
- Throws:
- RestCallException- Invalid input.
 
- 
errorCodesDescription copied from class:RestRequestAllows you to override what status codes are considered error codes that would result in aRestCallException.The default error code predicate is: x -> x >= 400.- Overrides:
- errorCodesin class- RestRequest
- Parameters:
- value- The new predicate for calculating error codes.
- Returns:
- This object.
 
- 
formDataDescription copied from class:RestRequestAppends multiple form-data parameters to the request.Example:// Appends two form-data parameters to the request. client .get(URI ) .formData( BasicStringPart.of ("foo" ,"bar" ), BasicBooleanPart.of ("baz" ,true ) ) .run();- Overrides:
- formDatain class- RestRequest
- Parameters:
- parts- The parameters to set.- null values are ignored.
- Returns:
- This object.
 
- 
formDataDescription copied from class:RestRequestAdds a form-data parameter to the request body.Example:// Adds form data parameter "foo=bar". client .formPost(URI ) .formData("foo" ,"bar" ) .run();- Overrides:
- formDatain class- RestRequest
- Parameters:
- name- The parameter name.
- value- The parameter value.
 Non-string values are converted to strings using the- HttpPartSerializerdefined on the client.
- Returns:
- This object.
 
- 
formDataBeanDescription copied from class:RestRequestAppends multiple form-data parameters to the request from properties defined on a Java bean.Example:public class MyFormData {public String getFooBar() {return "baz" ; }public Integer getQux() {return 123; } }// Appends form data "fooBar=baz&qux=123". client .get(URI ) .formDataBean(new MyFormData()) .run();- Overrides:
- formDataBeanin class- RestRequest
- Parameters:
- value- The bean containing the properties to set as form-data parameter values.
- Returns:
- This object.
 
- 
formDataCustomDescription copied from class:RestRequestAdds form-data parameters as the entire body of the request.Example:// Creates form data "foo=bar&baz=qux". client .formPost(URI ) .formDataCustom("foo=bar&baz=qux" ) .run();// Creates form data "foo=bar&baz=qux" using StringEntity. client .formPost(URI ) .formDataCustom(new StringEntity("foo=bar&baz=qux" ,"application/x-www-form-urlencoded" )) .run();// Creates form data "foo=bar&baz=qux" using StringEntity and body(). client .formPost(URI ) .content(new StringEntity("foo=bar&baz=qux" ,"application/x-www-form-urlencoded" )) .run();- Overrides:
- formDataCustomin class- RestRequest
- Parameters:
- value- The parameter value.
 Can be any of the following types:- 
         CharSequence
- 
         Reader- Raw contents ofReaderwill be serialized to remote resource.
- 
         InputStream- Raw contents ofInputStreamwill be serialized to remote resource.
- 
         HttpResource- Raw contents will be serialized to remote resource. Additional headers and media type will be set on request.
- 
         HttpEntity/BasicHttpEntity- Bypass Juneau serialization and pass HttpEntity directly to HttpClient.
- 
         Object- POJO to be converted to text using theSerializerregistered with theRestClient.
- 
         PartList- Converted to a URL-encoded FORM post.
 
- 
         
- Returns:
- This object.
 
- 
formDataPairsDescription copied from class:RestRequestAdds form-data parameters to the request body using free-form key/value pairs.Example:// Creates form data "key1=val1&key2=val2". client .formPost(URI ) .formDataPairs("key1" ,"val1" ,"key2" ,"val2" ) .run();- Overrides:
- formDataPairsin class- RestRequest
- Parameters:
- pairs- The form-data key/value pairs.- Values can be any POJO.
- Values converted to a string using the configured part serializer.
 
- Returns:
- This object.
- Throws:
- RestCallException- Invalid input.
 
- 
headerDescription copied from class:RestRequestAppends a header to the request.Example:// Adds header "Foo: bar". client .get(URI ) .header(Accept.TEXT_XML ) .run();- Overrides:
- headerin class- RestRequest
- Parameters:
- part- The parameter to set.- null values are ignored.
- Returns:
- This object.
 
- 
headerDescription copied from class:RestRequestAppends a header to the request.Example:// Adds header "Foo: bar". client .get(URI ) .header("Foo" ,"bar" ) .run();- Overrides:
- headerin class- RestRequest
- Parameters:
- name- The parameter name.
- value- The parameter value.
 Non-string values are converted to strings using the- HttpPartSerializerdefined on the client.
- Returns:
- This object.
 
- 
headerPairsDescription copied from class:RestRequestAppends multiple headers to the request using freeform key/value pairs.Example:// Adds headers "Foo: bar" and "Baz: qux". client .get(URI ) .headerPairs("Foo" ,"bar" ,"Baz" ,"qux" ) .run();- Overrides:
- headerPairsin class- RestRequest
- Parameters:
- pairs- The form-data key/value pairs.
- Returns:
- This object.
 
- 
headersDescription copied from class:RestRequestAppends multiple headers to the request.Example:// Appends two headers to the request. client .get(URI ) .headers( BasicHeader.of ("Foo" ,"bar" ), Accept.TEXT_XML ) .run();- Overrides:
- headersin class- RestRequest
- Parameters:
- parts- The parameters to set.- null values are ignored.
- Returns:
- This object.
 
- 
headersBeanDescription copied from class:RestRequestAppends multiple headers to the request from properties defined on a Java bean.Uses PropertyNamerDUCSfor resolving the header names from property names.Example:@Bean public class MyHeaders {public String getFooBar() {return "baz" ; }public Integer getQux() {return 123; } }// Appends headers "Foo-Bar: baz" and "Qux: 123". client .get(URI ) .headersBean(new MyHeaders()) .run();- Overrides:
- headersBeanin class- RestRequest
- Parameters:
- value- The bean containing the properties to set as header values.
- Returns:
- This object.
 
- 
htmlDescription copied from class:RestRequestConvenience method for specifying HTML as the marshalling transmission media type for this request only.POJOs are converted to HTML without any sort of doc wrappers. HtmlSerializerwill be used to serialize POJOs to request bodies unless overridden per request viaRestRequest.serializer(Serializer).- The serializer can be configured using any of the serializer property setters (e.g. RestClient.Builder.sortCollections()) or bean context property setters (e.g.RestClient.Builder.swaps(Class...)) defined on this builder class.
 HtmlParserwill be used to parse POJOs from response bodies unless overridden per request viaRestRequest.parser(Parser).- The parser can be configured using any of the parser property setters (e.g. RestClient.Builder.strict()) or bean context property setters (e.g.RestClient.Builder.swaps(Class...)) defined on this builder class.
 Accept request header will be set to"text/html" unless overridden byRestRequest.header(String,Object)orRestRequest.accept(String).Content-Type request header will be set to"text/html" unless overridden byRestRequest.header(String,Object)orRestRequest.contentType(String).Identical to calling serializer(HtmlSerializer. .class ).parser(HtmlParser.class )- Overrides:
- htmlin class- RestRequest
- Returns:
- This object.
 
- The serializer can be configured using any of the serializer property setters (e.g. 
- 
htmlDocDescription copied from class:RestRequestConvenience method for specifying HTML DOC as the marshalling transmission media type for this request only.POJOs are converted to fully renderable HTML pages. HtmlDocSerializerwill be used to serialize POJOs to request bodies unless overridden per request viaRestRequest.serializer(Serializer).- The serializer can be configured using any of the serializer property setters (e.g. RestClient.Builder.sortCollections()) or bean context property setters (e.g.RestClient.Builder.swaps(Class...)) defined on this builder class.
 HtmlParserwill be used to parse POJOs from response bodies unless overridden per request viaRestRequest.parser(Parser).- The parser can be configured using any of the parser property setters (e.g. RestClient.Builder.strict()) or bean context property setters (e.g.RestClient.Builder.swaps(Class...)) defined on this builder class.
 Accept request header will be set to"text/html" unless overridden byRestRequest.header(String,Object)orRestRequest.accept(String).Content-Type request header will be set to"text/html" unless overridden byRestRequest.header(String,Object)orRestRequest.contentType(String).Identical to calling serializer(HtmlDocSerializer. .class ).parser(HtmlParser.class )- Overrides:
- htmlDocin class- RestRequest
- Returns:
- This object.
 
- The serializer can be configured using any of the serializer property setters (e.g. 
- 
htmlStrippedDocDescription copied from class:RestRequestConvenience method for specifying Stripped HTML DOC as the marshalling transmission media type for this request only.Same as RestRequest.htmlDoc()but without the header and body tags and page title and description.HtmlStrippedDocSerializerwill be used to serialize POJOs to request bodies unless overridden per request viaRestRequest.serializer(Serializer).- The serializer can be configured using any of the serializer property setters (e.g. RestClient.Builder.sortCollections()) or bean context property setters (e.g.RestClient.Builder.swaps(Class...)) defined on this builder class.
 HtmlParserwill be used to parse POJOs from response bodies unless overridden per request viaRestRequest.parser(Parser).- The parser can be configured using any of the parser property setters (e.g. RestClient.Builder.strict()) or bean context property setters (e.g.RestClient.Builder.swaps(Class...)) defined on this builder class.
 Accept request header will be set to"text/html+stripped" unless overridden byRestRequest.header(String,Object)orRestRequest.accept(String).Content-Type request header will be set to"text/html+stripped" unless overridden byRestRequest.header(String,Object)orRestRequest.contentType(String).Identical to calling serializer(HtmlStrippedDocSerializer. .class ).parser(HtmlParser.class )- Overrides:
- htmlStrippedDocin class- RestRequest
- Returns:
- This object.
 
- The serializer can be configured using any of the serializer property setters (e.g. 
- 
ignoreErrorsDescription copied from class:RestRequestPreventRestCallExceptionsfrom being thrown when HTTP status 400+ is encountered.This overrides the ignoreErrors property on the client.- Overrides:
- ignoreErrorsin class- RestRequest
- Returns:
- This object.
 
- 
interceptorsDescription copied from class:RestRequestAdd one or more interceptors for this call only.- Overrides:
- interceptorsin class- RestRequest
- Parameters:
- interceptors- The interceptors to add to this call.
- Returns:
- This object.
- Throws:
- RestCallException- If init method on interceptor threw an exception.
 
- 
jsonDescription copied from class:RestRequestConvenience method for specifying JSON as the marshalling transmission media type for this request only.JsonSerializerwill be used to serialize POJOs to request bodies unless overridden per request viaRestRequest.serializer(Serializer).- The serializer can be configured using any of the serializer property setters (e.g. RestClient.Builder.sortCollections()) or bean context property setters (e.g.RestClient.Builder.swaps(Class...)) defined on this builder class.
 JsonParserwill be used to parse POJOs from response bodies unless overridden per request viaRestRequest.parser(Parser).- The parser can be configured using any of the parser property setters (e.g. RestClient.Builder.strict()) or bean context property setters (e.g.RestClient.Builder.swaps(Class...)) defined on this builder class.
 Accept request header will be set to"application/json" unless overridden byRestRequest.header(String,Object)orRestRequest.accept(String).Content-Type request header will be set to"application/json" unless overriddenRestRequest.header(String,Object)orRestRequest.contentType(String).Identical to calling serializer(JsonSerializer. .class ).parser(JsonParser.class )- Overrides:
- jsonin class- RestRequest
- Returns:
- This object.
 
- The serializer can be configured using any of the serializer property setters (e.g. 
- 
mediaTypeDescription copied from class:RestRequestShortcut for setting theAccept andContent-Type headers on a request.- Overrides:
- mediaTypein class- RestRequest
- Parameters:
- value- The new header values.
- Returns:
- This object.
- Throws:
- RestCallException- Invalid input.
 
- 
msgPackDescription copied from class:RestRequestConvenience method for specifying MessagePack as the marshalling transmission media type for this request only.MessagePack is a binary equivalent to JSON that takes up considerably less space than JSON. MsgPackSerializerwill be used to serialize POJOs to request bodies unless overridden per request viaRestRequest.serializer(Serializer).- The serializer can be configured using any of the serializer property setters (e.g. RestClient.Builder.sortCollections()) or bean context property setters (e.g.RestClient.Builder.swaps(Class...)) defined on this builder class.
 MsgPackParserwill be used to parse POJOs from response bodies unless overridden per request viaRestRequest.parser(Parser).- The parser can be configured using any of the parser property setters (e.g. RestClient.Builder.strict()) or bean context property setters (e.g.RestClient.Builder.swaps(Class...)) defined on this builder class.
 Accept request header will be set to"octal/msgpack" unless overridden byRestRequest.header(String,Object)orRestRequest.accept(String).Content-Type request header will be set to"octal/msgpack" unless overridden byRestRequest.header(String,Object)orRestRequest.contentType(String).Identical to calling serializer(MsgPackSerializer. .class ).parser(MsgPackParser.class )- Overrides:
- msgPackin class- RestRequest
- Returns:
- This object.
 
- The serializer can be configured using any of the serializer property setters (e.g. 
- 
noTraceDescription copied from class:RestRequestWhen called,No-Trace: true is added to requests.This gives the opportunity for the servlet to not log errors on invalid requests. This is useful for testing purposes when you don't want your log file to show lots of errors that are simply the results of testing. - Overrides:
- noTracein class- RestRequest
- Returns:
- This object.
- Throws:
- RestCallException- Invalid input.
 
- 
openApiDescription copied from class:RestRequestConvenience method for specifying OpenAPI as the marshalling transmission media type for this request only.OpenAPI is a language that allows serialization to formats that use HttpPartSchemaobjects to describe their structure.OpenApiSerializerwill be used to serialize POJOs to request bodies unless overridden per request viaRestRequest.serializer(Serializer).- The serializer can be configured using any of the serializer property setters (e.g. RestClient.Builder.sortCollections()) or bean context property setters (e.g.RestClient.Builder.swaps(Class...)) defined on this builder class.
- Typically the RestRequest.content(Object, HttpPartSchema)method will be used to specify the body of the request with the schema describing it's structure.
 OpenApiParserwill be used to parse POJOs from response bodies unless overridden per request viaRestRequest.parser(Parser).- The parser can be configured using any of the parser property setters (e.g. RestClient.Builder.strict()) or bean context property setters (e.g.RestClient.Builder.swaps(Class...)) defined on this builder class.
- Typically the ResponseContent.schema(HttpPartSchema)method will be used to specify the structure of the response body.
 Accept request header will be set to"text/openapi" unless overridden byRestRequest.header(String,Object)orRestRequest.accept(String).Content-Type request header will be set to"text/openapi" unless overridden byRestRequest.header(String,Object)orRestRequest.contentType(String).Identical to calling serializer(OpenApiSerializer. .class ).parser(OpenApiParser.class )- Overrides:
- openApiin class- RestRequest
- Returns:
- This object.
 
- The serializer can be configured using any of the serializer property setters (e.g. 
- 
parserDescription copied from class:RestRequestSpecifies the parser to use on the response body.Overrides the parsers specified on the RestClient.The parser can be configured using any of the parser property setters (e.g. RestClient.Builder.strict()) or bean context property setters (e.g.RestClient.Builder.swaps(Class...)) defined on this builder class.If the Accept header is not set on the request, it will be set to the media type of this parser.- Overrides:
- parserin class- RestRequest
- Parameters:
- parser- The parser used to parse POJOs from the body of the HTTP response.
- Returns:
- This object.
 
- 
parserDescription copied from class:RestRequestSpecifies the parser to use on the response body.Overrides the parsers specified on the RestClient.The parser is not modified by any of the parser property setters (e.g. RestClient.Builder.strict()) or bean context property setters (e.g.RestClient.Builder.swaps(Class...)) defined on this builder class.If the Accept header is not set on the request, it will be set to the media type of this parser.- Overrides:
- parserin class- RestRequest
- Parameters:
- parser- The parser used to parse POJOs from the body of the HTTP response.
- Returns:
- This object.
 
- 
pathDataDescription copied from class:RestRequestSets or replaces multiple path parameters on the request.Example:// Appends two path parameters to the request. client .get(URI ) .pathData( BasicStringPart.of ("foo" ,"bar" ), BasicBooleanPart.of ("baz" ,true ) ) .run();- Overrides:
- pathDatain class- RestRequest
- Parameters:
- parts- The parameters to set.- null values are ignored.
- Returns:
- This object.
 
- 
pathDataDescription copied from class:RestRequestSets or replaces a path parameter of the form"{name}" in the URI.Example:// Sets path to "/bar". client .get("/{foo}" ) .pathData("foo" ,"bar" ) .run();- Overrides:
- pathDatain class- RestRequest
- Parameters:
- name- The parameter name.
- value- The parameter value.
 Non-string values are converted to strings using the- HttpPartSerializerdefined on the client.
- Returns:
- This object.
 
- 
pathDataBeanDescription copied from class:RestRequestSets multiple path parameters to the request from properties defined on a Java bean.Example:public class MyPathVars {public String getFooBar() {return "baz" ; }public Integer getQux() {return 123; } }// Given path "/{fooBar}/{qux}/", gets converted to "/baz/123/". client .get(URI ) .pathDataBean(new MyPathVars()) .run();- Overrides:
- pathDataBeanin class- RestRequest
- Parameters:
- value- The bean containing the properties to set as path parameter values.
- Returns:
- This object.
 
- 
pathDataPairsDescription copied from class:RestRequestReplaces path parameters of the form"{name}" in the URI using free-form key/value pairs.Example:// Sets path to "/baz/qux". client .get("/{foo}/{bar}" ) .pathDataPairs("foo" ,"baz" ,"bar" ,"qux" ) .run();- Overrides:
- pathDataPairsin class- RestRequest
- Parameters:
- pairs- The path key/value pairs.- Values can be any POJO.
- Values converted to a string using the configured part serializer.
 
- Returns:
- This object.
 
- 
plainTextDescription copied from class:RestRequestConvenience method for specifying Plain Text as the marshalling transmission media type for this request only.Plain text marshalling typically only works on simple POJOs that can be converted to and from strings using swaps, swap methods, etc... PlainTextSerializerwill be used to serialize POJOs to request bodies unless overridden per request viaRestRequest.serializer(Serializer).- The serializer can be configured using any of the serializer property setters (e.g. RestClient.Builder.sortCollections()) or bean context property setters (e.g.RestClient.Builder.swaps(Class...)) defined on this builder class.
 PlainTextParserwill be used to parse POJOs from response bodies unless overridden per request viaRestRequest.parser(Parser).- The parser can be configured using any of the parser property setters (e.g. RestClient.Builder.strict()) or bean context property setters (e.g.RestClient.Builder.swaps(Class...)) defined on this builder class.
 Accept request header will be set to"text/plain" unless overridden byRestRequest.header(String,Object)orRestRequest.accept(String).Content-Type request header will be set to"text/plain" unless overridden byRestRequest.header(String,Object)orRestRequest.contentType(String).Identical to calling serializer(PlainTextSerializer. .class ).parser(PlainTextParser.class )- Overrides:
- plainTextin class- RestRequest
- Returns:
- This object.
 
- The serializer can be configured using any of the serializer property setters (e.g. 
- 
protocolVersionDescription copied from class:RestRequestSets the protocol version for this request.- Overrides:
- protocolVersionin class- RestRequest
- Parameters:
- version- The protocol version for this request.
- Returns:
- This object.
 
- 
queryCustomDescription copied from class:RestRequestAdds a free-form custom query.Example:// Adds query parameter "foo=bar&baz=qux". client .get(URI ) .queryCustom("foo=bar&baz=qux" ) .run();- Overrides:
- queryCustomin class- RestRequest
- Parameters:
- value- The parameter value.
 Can be any of the following types:- 
         CharSequence
- 
         Reader- Raw contents ofReaderwill be serialized to remote resource.
- 
         InputStream- Raw contents ofInputStreamwill be serialized to remote resource.
- 
         PartList- Converted to a URL-encoded query.
 
- 
         
- Returns:
- This object.
 
- 
queryDataDescription copied from class:RestRequestAppends multiple query parameters to the request.Example:// Appends two query parameters to the request. client .get(URI ) .queryData( BasicStringPart.of ("foo" ,"bar" ), BasicBooleanPart.of ("baz" ,true ) ) .run();- Overrides:
- queryDatain class- RestRequest
- Parameters:
- parts- The parameters to set.- null values are ignored.
- Returns:
- This object.
 
- 
queryDataDescription copied from class:RestRequestAppends a query parameter to the URI of the request.Example:// Adds query parameter "foo=bar". client .get(URI ) .queryData("foo" ,"bar" ) .run();- Overrides:
- queryDatain class- RestRequest
- Parameters:
- name- The parameter name.
- value- The parameter value.
 Non-string values are converted to strings using the- HttpPartSerializerdefined on the client.
- Returns:
- This object.
 
- 
queryDataBeanDescription copied from class:RestRequestAppends multiple query parameters to the request from properties defined on a Java bean.Example:public class MyQuery {public String getFooBar() {return "baz" ; }public Integer getQux() {return 123; } }// Appends query "fooBar=baz&qux=123". client .get(URI ) .queryDataBean(new MyQuery()) .run();- Overrides:
- queryDataBeanin class- RestRequest
- Parameters:
- value- The bean containing the properties to set as query parameter values.
- Returns:
- This object.
 
- 
queryDataPairsDescription copied from class:RestRequestAdds query parameters to the URI query using free-form key/value pairs..Example:// Adds query parameters "foo=bar&baz=qux". client .get(URI ) .queryDataPairs("foo" ,"bar" ,"baz" ,"qux" ) .run();- Overrides:
- queryDataPairsin class- RestRequest
- Parameters:
- pairs- The query key/value pairs.- Values can be any POJO.
- Values converted to a string using the configured part serializer.
 
- Returns:
- This object.
- Throws:
- RestCallException- Invalid input.
 
- 
rethrowDescription copied from class:RestRequestRethrow any of the specified exception types if a matchingException-Name header is found.Rethrown exceptions will be set on the caused-by exception of RestCallExceptionwhen thrown from theRestRequest.run()method.Can be called multiple times to append multiple rethrows. - Overrides:
- rethrowin class- RestRequest
- Parameters:
- values- The classes to rethrow.
- Returns:
- This object.
 
- 
serializerDescription copied from class:RestRequestSpecifies the serializer to use on the request body.Overrides the serializers specified on the RestClient.The serializer can be configured using any of the serializer property setters (e.g. RestClient.Builder.sortCollections()) or bean context property setters (e.g.RestClient.Builder.swaps(Class...)) defined on this builder class.If the Content-Type header is not set on the request, it will be set to the media type of this serializer.- Overrides:
- serializerin class- RestRequest
- Parameters:
- serializer- The serializer used to serialize POJOs to the body of the HTTP request.
- Returns:
- This object.
 
- 
serializerDescription copied from class:RestRequestSpecifies the serializer to use on the request body.Overrides the serializers specified on the RestClient.The serializer is not modified by an of the serializer property setters (e.g. RestClient.Builder.sortCollections()) or bean context property setters (e.g.RestClient.Builder.swaps(Class...)) defined on this builder class.If the Content-Type header is not set on the request, it will be set to the media type of this serializer.- Overrides:
- serializerin class- RestRequest
- Parameters:
- serializer- The serializer used to serialize POJOs to the body of the HTTP request.
- Returns:
- This object.
 
- 
json5Description copied from class:RestRequestConvenience method for specifying Simplified JSON as the marshalling transmission media type for this request only.Simplified JSON is typically useful for automated tests because you can do simple string comparison of results without having to escape lots of quotes. Json5Serializerwill be used to serialize POJOs to request bodies unless overridden per request viaRestRequest.serializer(Serializer).- The serializer can be configured using any of the serializer property setters (e.g. RestClient.Builder.sortCollections()) or bean context property setters (e.g.RestClient.Builder.swaps(Class...)) defined on this builder class.
 Json5Parserwill be used to parse POJOs from response bodies unless overridden per request viaRestRequest.parser(Parser).- The parser can be configured using any of the parser property setters (e.g. RestClient.Builder.strict()) or bean context property setters (e.g.RestClient.Builder.swaps(Class...)) defined on this builder class.
 Accept request header will be set to"application/json" unless overridden byRestRequest.header(String,Object)orRestRequest.accept(String), or per-request viaRestRequest.header(String,Object)orRestRequest.accept(String).Content-Type request header will be set to"application/json+simple" unless overridden byRestRequest.header(String,Object)orRestRequest.contentType(String), or per-request viaRestRequest.header(String,Object)orRestRequest.contentType(String).Can be combined with other marshaller setters such as RestRequest.xml()to provide support for multiple languages.- When multiple languages are supported, the Accept andContent-Type headers control which marshallers are used, or uses the last-enabled language if the headers are not set.
 Identical to calling serializer(Json5Serializer. .class ).parser(Json5Parser.class )- Overrides:
- json5in class- RestRequest
- Returns:
- This object.
 
- The serializer can be configured using any of the serializer property setters (e.g. 
- 
suppressLoggingDescription copied from class:RestRequestCauses logging to be suppressed for the duration of this request.Overrides the RestRequest.debug()setting on this request or client.- Overrides:
- suppressLoggingin class- RestRequest
- Returns:
- This object.
 
- 
targetDescription copied from class:RestRequestSpecifies the target host for the request.- Overrides:
- targetin class- RestRequest
- Parameters:
- target- The target host for the request. Implementations may accept- null if they can still determine a route, for example to a default target or by inspecting the request.
- Returns:
- This object.
 
- 
uonDescription copied from class:RestRequestConvenience method for specifying UON as the marshalling transmission media type for this request only.UON is Url-Encoding Object notation that is equivalent to JSON but suitable for transmission as URL-encoded query and form post values. UonSerializerwill be used to serialize POJOs to request bodies unless overridden per request viaRestRequest.serializer(Serializer).- The serializer can be configured using any of the serializer property setters (e.g. RestClient.Builder.sortCollections()) or bean context property setters (e.g.RestClient.Builder.swaps(Class...)) defined on this builder class.
 UonParserwill be used to parse POJOs from response bodies unless overridden per request viaRestRequest.parser(Parser).- The parser can be configured using any of the parser property setters (e.g. RestClient.Builder.strict()) or bean context property setters (e.g.RestClient.Builder.swaps(Class...)) defined on this builder class.
 Accept request header will be set to"text/uon" unless overridden byRestRequest.header(String,Object)orRestRequest.accept(String).Content-Type request header will be set to"text/uon" unless overridden byRestRequest.header(String,Object)orRestRequest.contentType(String).Identical to calling serializer(UonSerializer. .class ).parser(UonParser.class )- Overrides:
- uonin class- RestRequest
- Returns:
- This object.
 
- The serializer can be configured using any of the serializer property setters (e.g. 
- 
uriDescription copied from class:RestRequestSets the URI for this request.Can be any of the following types: - URI
- URL
- URIBuilder
- Anything else converted to a string using Object.toString().
 Relative URI strings will be interpreted as relative to the root URI defined on the client. - Overrides:
- uriin class- RestRequest
- Parameters:
- uri- The URI of the remote REST resource.
 This overrides the URI passed in from the client.
 Can be any of the following types:- URIBuilder
- URI
- URL
- String
- Object- Converted to- String using- toString() 
 
- Returns:
- This object.
- Throws:
- RestCallException- Invalid URI syntax detected.
 
- 
uriFragmentDescription copied from class:RestRequestSets the URI fragment.- Overrides:
- uriFragmentin class- RestRequest
- Parameters:
- fragment- The URI fragment. The value is expected to be unescaped and may contain non ASCII characters.
- Returns:
- This object.
 
- 
uriHostDescription copied from class:RestRequestSets the URI host.- Overrides:
- uriHostin class- RestRequest
- Parameters:
- host- The new URI host.
- Returns:
- This object.
 
- 
uriPortDescription copied from class:RestRequestSets the URI port.- Overrides:
- uriPortin class- RestRequest
- Parameters:
- port- The new URI port.
- Returns:
- This object.
 
- 
uriUserInfoDescription copied from class:RestRequestSets the URI user info.- Overrides:
- uriUserInfoin class- RestRequest
- Parameters:
- userInfo- The new URI user info.
- Returns:
- This object.
 
- 
uriUserInfoDescription copied from class:RestRequestSets the URI user info.- Overrides:
- uriUserInfoin class- RestRequest
- Parameters:
- username- The new URI username.
- password- The new URI password.
- Returns:
- This object.
 
- 
urlEncDescription copied from class:RestRequestConvenience method for specifying URL-Encoding as the marshalling transmission media type for this request only.UrlEncodingSerializerwill be used to serialize POJOs to request bodies unless overridden per request viaRestRequest.serializer(Serializer).- The serializer can be configured using any of the serializer property setters (e.g. RestClient.Builder.sortCollections()) or bean context property setters (e.g.RestClient.Builder.swaps(Class...)) defined on this builder class.
- This serializer is NOT used when using the RestRequest.formData(String, Object)(and related) methods for constructing the request body. Instead, the part serializer specified viaRestClient.Builder.partSerializer(Class)is used.
 UrlEncodingParserwill be used to parse POJOs from response bodies unless overridden per request viaRestRequest.parser(Parser).- The parser can be configured using any of the parser property setters (e.g. RestClient.Builder.strict()) or bean context property setters (e.g.RestClient.Builder.swaps(Class...)) defined on this builder class.
 Accept request header will be set to"application/x-www-form-urlencoded" unless overridden byRestRequest.header(String,Object)orRestRequest.accept(String).Content-Type request header will be set to"application/x-www-form-urlencoded" unless overridden byRestRequest.header(String,Object)orRestRequest.contentType(String).Identical to calling serializer(UrlEncodingSerializer. .class ).parser(UrlEncodingParser.class )- Overrides:
- urlEncin class- RestRequest
- Returns:
- This object.
 
- The serializer can be configured using any of the serializer property setters (e.g. 
- 
xmlDescription copied from class:RestRequestConvenience method for specifying XML as the marshalling transmission media type for this request only.XmlSerializerwill be used to serialize POJOs to request bodies unless overridden per request viaRestRequest.serializer(Serializer).- The serializer can be configured using any of the serializer property setters (e.g. RestClient.Builder.sortCollections()) or bean context property setters (e.g.RestClient.Builder.swaps(Class...)) defined on this builder class.
 XmlParserwill be used to parse POJOs from response bodies unless overridden per request viaRestRequest.parser(Parser).- The parser can be configured using any of the parser property setters (e.g. RestClient.Builder.strict()) or bean context property setters (e.g.RestClient.Builder.swaps(Class...)) defined on this builder class.
 Accept request header will be set to"text/xml" unless overridden byRestRequest.header(String,Object)orRestRequest.accept(String).Content-Type request header will be set to"text/xml" unless overridden byRestRequest.header(String,Object)orRestRequest.contentType(String).Identical to calling serializer(XmlSerializer. .class ).parser(XmlParser.class )- Overrides:
- xmlin class- RestRequest
- Returns:
- This object.
 
- The serializer can be configured using any of the serializer property setters (e.g. 
 
-