public final class RsWithHeader extends RsWrap
Remember, if a header is already present in the response, this
decorator will add another one, with the same name. It doesn't check
for duplicates. If you want to avoid duplicate headers, use this
decorator in combination with RsWithoutHeader
,
for example:
new RsWithHeader( new RsWithoutHeader(res, "Host"), "Host", "www.example.com" )
In this example, RsWithoutHeader
will remove the
Host
header first and RsWithHeader
will
add a new one.
The class is immutable and thread-safe.
Constructor and Description |
---|
RsWithHeader(CharSequence hdr)
Ctor.
|
RsWithHeader(CharSequence name,
CharSequence value)
Ctor.
|
RsWithHeader(Response res,
CharSequence header)
Ctor.
|
RsWithHeader(Response res,
CharSequence name,
CharSequence value)
Ctor.
|
public RsWithHeader(CharSequence hdr)
hdr
- Headerpublic RsWithHeader(CharSequence name, CharSequence value)
name
- Header namevalue
- Header valuepublic RsWithHeader(Response res, CharSequence name, CharSequence value)
res
- Original responsename
- Header namevalue
- Header valuepublic RsWithHeader(Response res, CharSequence header)
res
- Original responseheader
- Header to addCopyright © 2015–2019 Take. All rights reserved.