Package io.github.espresso4j.espresso
Class Request
- java.lang.Object
-
- io.github.espresso4j.espresso.ExtensionHolder
-
- io.github.espresso4j.espresso.Request
-
public class Request extends ExtensionHolder
Espresso request
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
Request.Method
static class
Request.Scheme
-
Constructor Summary
Constructors Constructor Description Request()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.io.InputStream
getBody()
Get HTTP request body as InputStreamjava.util.Map<java.lang.String,java.lang.String>
getHeaders()
Get request headersjava.lang.String
getProtcol()
Get the protocol line of http request, http/1.1 or http/2 for example.java.lang.String
getQueryString()
Get the query string part of request URL, typically it's the string after "?"java.lang.String
getRemoteAddr()
Get the client address stringRequest.Method
getRequestMethod()
Get the HTTP request methodRequest.Scheme
getScheme()
Get the request scheme, HTTP or HTTPSjava.lang.String
getServerName()
Get the hostname of current serverjava.lang.Integer
getServerPort()
Get the serving port of current serverjava.security.cert.X509Certificate
getSslClientCert()
Get the TLS client certificate if availablejava.lang.String
getUri()
Get the request URIvoid
setBody(java.io.InputStream body)
Set the HTTP request bodyvoid
setHeaders(java.util.Map<java.lang.String,java.lang.String> headers)
Set the request headersvoid
setProtcol(java.lang.String protcol)
Set the protocol linevoid
setQueryString(java.lang.String queryString)
Set the query stringvoid
setRemoteAddr(java.lang.String remoteAddr)
Set the client address stringvoid
setRequestMethod(Request.Method requestMethod)
Set the request methodvoid
setScheme(Request.Scheme scheme)
Set current request scheme, HTTP or HTTPSvoid
setServerName(java.lang.String serverName)
Set the hostname of current servervoid
setServerPort(java.lang.Integer serverPort)
Set the serving port of current servervoid
setSslClientCert(java.security.cert.X509Certificate sslClientCert)
Set the certificate for current request if anyvoid
setUri(java.lang.String uri)
Set the request URIjava.lang.String
toString()
-
Methods inherited from class io.github.espresso4j.espresso.ExtensionHolder
extension, extension, extensions
-
-
-
-
Method Detail
-
getServerPort
@Nonnull public java.lang.Integer getServerPort()
Get the serving port of current server- Returns:
- the port number
-
setServerPort
public void setServerPort(@Nonnull java.lang.Integer serverPort)
Set the serving port of current server- Parameters:
serverPort
- the port number
-
getServerName
@Nonnull public java.lang.String getServerName()
Get the hostname of current server- Returns:
- the hostname
-
setServerName
public void setServerName(@Nonnull java.lang.String serverName)
Set the hostname of current server- Parameters:
serverName
- the hostname
-
getRemoteAddr
@Nonnull public java.lang.String getRemoteAddr()
Get the client address string- Returns:
- the client address
-
setRemoteAddr
public void setRemoteAddr(@Nonnull java.lang.String remoteAddr)
Set the client address string- Parameters:
remoteAddr
- the address string
-
getUri
@Nonnull public java.lang.String getUri()
Get the request URI- Returns:
- the URI
-
setUri
public void setUri(@Nonnull java.lang.String uri)
Set the request URI- Parameters:
uri
- the URI
-
getQueryString
@Nullable public java.lang.String getQueryString()
Get the query string part of request URL, typically it's the string after "?"- Returns:
- the query string line
-
setQueryString
public void setQueryString(@Nullable java.lang.String queryString)
Set the query string- Parameters:
queryString
- the query string
-
getScheme
@Nonnull public Request.Scheme getScheme()
Get the request scheme, HTTP or HTTPS- Returns:
- the scheme
-
setScheme
public void setScheme(@Nonnull Request.Scheme scheme)
Set current request scheme, HTTP or HTTPS- Parameters:
scheme
- the scheme
-
getRequestMethod
@Nonnull public Request.Method getRequestMethod()
Get the HTTP request method- Returns:
- the method
-
setRequestMethod
public void setRequestMethod(@Nonnull Request.Method requestMethod)
Set the request method- Parameters:
requestMethod
- the method
-
getProtcol
@Nonnull public java.lang.String getProtcol()
Get the protocol line of http request, http/1.1 or http/2 for example.- Returns:
- the protocol line
-
setProtcol
public void setProtcol(@Nonnull java.lang.String protcol)
Set the protocol line- Parameters:
protcol
- the protocol line
-
getSslClientCert
@Nullable public java.security.cert.X509Certificate getSslClientCert()
Get the TLS client certificate if available- Returns:
- the certificate
-
setSslClientCert
public void setSslClientCert(@Nullable java.security.cert.X509Certificate sslClientCert)
Set the certificate for current request if any- Parameters:
sslClientCert
- the certificate
-
getHeaders
@Nonnull public java.util.Map<java.lang.String,java.lang.String> getHeaders()
Get request headers- Returns:
- the header map
-
setHeaders
public void setHeaders(@Nonnull java.util.Map<java.lang.String,java.lang.String> headers)
Set the request headers- Parameters:
headers
- the header map
-
getBody
@Nullable public java.io.InputStream getBody()
Get HTTP request body as InputStream- Returns:
- the InputStream
-
setBody
public void setBody(@Nullable java.io.InputStream body)
Set the HTTP request body- Parameters:
body
- the InputStream
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
-