@ProviderType
public interface SlingHttpServletRequestBuilder
Fluent helper for building a request.
Note: instances of this interface are not thread-safe.
Modifier and Type | Method and Description |
---|---|
@NotNull SlingHttpServletRequest |
build()
Builds the request.
|
@NotNull SlingHttpServletRequestBuilder |
useAttributesFrom(@NotNull javax.servlet.http.HttpServletRequest request)
Uses the attributes backed by the provided request.
|
@NotNull SlingHttpServletRequestBuilder |
useRequestDispatcherFrom(@NotNull SlingHttpServletRequest request)
Uses the request dispatcher from the provided request.
|
@NotNull SlingHttpServletRequestBuilder |
useServletContextFrom(@NotNull javax.servlet.http.HttpServletRequest request)
Uses the servlet context from the provided request.
|
@NotNull SlingHttpServletRequestBuilder |
useSessionFrom(@NotNull javax.servlet.http.HttpServletRequest request)
Uses the session from the provided request.
|
@NotNull SlingHttpServletRequestBuilder |
withBody(@Nullable java.lang.String content)
Uses the supplied content as the request's body content.
|
@NotNull SlingHttpServletRequestBuilder |
withContentType(@Nullable java.lang.String contentType)
Sets the HTTP request's
Content-Type header. |
@NotNull SlingHttpServletRequestBuilder |
withExtension(@Nullable java.lang.String extension)
Sets the optional extension of the internal request, which influences the servlet/script resolution.
|
@NotNull SlingHttpServletRequestBuilder |
withParameter(@NotNull java.lang.String key,
@NotNull java.lang.String value)
Sets a request parameter.
|
@NotNull SlingHttpServletRequestBuilder |
withParameter(@NotNull java.lang.String key,
@NotNull java.lang.String[] values)
Sets a request parameter.
|
@NotNull SlingHttpServletRequestBuilder |
withParameters(@Nullable java.util.Map<java.lang.String,java.lang.String[]> parameters)
Adds the supplied request parameters to the current ones.
|
@NotNull SlingHttpServletRequestBuilder |
withRequestMethod(@NotNull java.lang.String method)
Sets the HTTP request method to use - defaults to
GET . |
@NotNull SlingHttpServletRequestBuilder |
withSelectors(java.lang.String... selectors)
Sets the optional selectors of the internal request, which influence the servlet/script resolution.
|
@NotNull SlingHttpServletRequestBuilder |
withSuffix(@Nullable java.lang.String suffix)
Sets the optional suffix of the internal request.
|
@NotNull @NotNull SlingHttpServletRequestBuilder withRequestMethod(@NotNull @NotNull java.lang.String method)
GET
.method
- the HTTP methodjava.lang.IllegalArgumentException
- If method is null
@NotNull @NotNull SlingHttpServletRequestBuilder withContentType(@Nullable @Nullable java.lang.String contentType)
Content-Type
header.contentType
- the Content-Type
value@NotNull @NotNull SlingHttpServletRequestBuilder withBody(@Nullable @Nullable java.lang.String content)
content
- the request body content@NotNull @NotNull SlingHttpServletRequestBuilder withSelectors(@Nullable java.lang.String... selectors)
selectors
- the selectors@NotNull @NotNull SlingHttpServletRequestBuilder withExtension(@Nullable @Nullable java.lang.String extension)
extension
- the extension@NotNull @NotNull SlingHttpServletRequestBuilder withSuffix(@Nullable @Nullable java.lang.String suffix)
suffix
- the suffix@NotNull @NotNull SlingHttpServletRequestBuilder withParameter(@NotNull @NotNull java.lang.String key, @NotNull @NotNull java.lang.String value)
key
- the name of the parametervalue
- the value of the parameterjava.lang.IllegalArgumentException
- if either key
or value
is null
@NotNull @NotNull SlingHttpServletRequestBuilder withParameter(@NotNull @NotNull java.lang.String key, @NotNull @NotNull java.lang.String[] values)
key
- the name of the parametervalues
- the values of the parameterjava.lang.IllegalArgumentException
- if either key
or values
is null
@NotNull @NotNull SlingHttpServletRequestBuilder withParameters(@Nullable @Nullable java.util.Map<java.lang.String,java.lang.String[]> parameters)
parameters
- additional parameters@NotNull @NotNull SlingHttpServletRequestBuilder useRequestDispatcherFrom(@NotNull @NotNull SlingHttpServletRequest request)
request
- the request from which to use the dispatcherjava.lang.IllegalArgumentException
- if request
is null
@NotNull @NotNull SlingHttpServletRequestBuilder useSessionFrom(@NotNull @NotNull javax.servlet.http.HttpServletRequest request)
request
- the request from which to use the sessionjava.lang.IllegalArgumentException
- if request
is null
@NotNull @NotNull SlingHttpServletRequestBuilder useAttributesFrom(@NotNull @NotNull javax.servlet.http.HttpServletRequest request)
request
- the request from which to use the attributesjava.lang.IllegalArgumentException
- if request
is null
@NotNull @NotNull SlingHttpServletRequestBuilder useServletContextFrom(@NotNull @NotNull javax.servlet.http.HttpServletRequest request)
request
- the request from which to use the servlet contextjava.lang.IllegalArgumentException
- if request
is null
@NotNull @NotNull SlingHttpServletRequest build()
Copyright © 2022 The Apache Software Foundation. All rights reserved.