Package org.faceless.publisher.type
Interface URLConnectionProcessor
- All Known Implementing Classes:
AbstractURLConnectionProcessor
,AWS4AuthenticationURLConnectionProcessor
,CookieStoreURLConnectionProcessor
,OAuth2AuthenticationURLConnectionProcessor
,PasswordAuthenticationURLConnectionProcessor
,SSLURLConnectionProcessor
public interface URLConnectionProcessor
A URLConnectionProcessor can be applied to any
URL2Connection
to modify it either before or after connection is made. Any modifications
can be made, such as
- Configuring SSL, with
SSLURLConnectionProcessor
- Managing Cookies, with
CookieStoreURLConnectionProcessor
- Managing Passwords, with
PasswordAuthenticationURLConnectionProcessor
- More exotic forms of authenticaion, eg
OAuth2AuthenticationURLConnectionProcessor
orAWS4AuthenticationURLConnectionProcessor
- Other types of processing, eg handling HTTP redirects (which are handled by a private instance)
-
Method Summary
Modifier and TypeMethodDescriptionafter
(URL2Connection con) If this processermatches
, this method is called after the supplied URL connection is made.void
before
(URL2Connection con) If this processermatches
, this method is called before the supplied URL connection is made.boolean
matches
(URL2Connection con) Return true if this URLConnectionProcessor should be called for the specified connection
-
Method Details
-
matches
Return true if this URLConnectionProcessor should be called for the specified connection- Parameters:
con
- the connection
-
before
If this processermatches
, this method is called before the supplied URL connection is made. It can alter any request headers.- Parameters:
con
- the connection- Throws:
IOException
-
after
If this processermatches
, this method is called after the supplied URL connection is made. It can act on the response headers, modify them for the next processor, and if it returns non-null, the request headers and URI of the returned value will be used for another request. For example to implement a redirect on a return code of 301if (con.getCode() == 301) { con.setURI(parse(con.getResponseHeader("location"))); return con; } else { return null; }
- Parameters:
con
- the connection- Returns:
- the next connection to make, or
null
to accept this response - Throws:
IOException
-