public final class FkEncoding extends Object implements Fork
Use this fork in order to deliver responses with different encoding, depending on user preferences. For example, you want to deliver GZIP-compressed response when "Accept-Encoding" request header contains "gzip". Here is how:
new TkFork( new FkEncoding("gzip", new RsGzip(response)), new FkEncoding("", response) )
Empty string as an encoding means that the fork should match in any case.
The class is immutable and thread-safe.
RsFork
Constructor and Description |
---|
FkEncoding(String enc,
Response response)
Ctor.
|
public Opt<Response> route(Request req) throws IOException
Fork
route
in interface Fork
req
- RequestIOException
- If failsCopyright © 2015–2016 Take. All rights reserved.