Package org.faceless.publisher.type
Class AbstractURLConnectionProcessor
java.lang.Object
org.faceless.publisher.type.AbstractURLConnectionProcessor
- All Implemented Interfaces:
URLConnectionProcessor
- Direct Known Subclasses:
AWS4AuthenticationURLConnectionProcessor
,CookieStoreURLConnectionProcessor
,OAuth2AuthenticationURLConnectionProcessor
,PasswordAuthenticationURLConnectionProcessor
,SSLURLConnectionProcessor
A base implementation of
URLConnectionProcessor
that does nothing,
but is suitable for extending. It has a pattern matching implementation
based on a list of Pattern
objects.-
Constructor Summary
-
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.Return the modifiable list ofPattern
objects that will be matched against the URL to see if this processor should be applied.boolean
matches
(URL2Connection con) Return true if this URLConnectionProcessor should be called for the specified connection
-
Constructor Details
-
AbstractURLConnectionProcessor
public AbstractURLConnectionProcessor()
-
-
Method Details
-
getMatches
Return the modifiable list ofPattern
objects that will be matched against the URL to see if this processor should be applied. An empty list (the default) matches all URLs.- Returns:
- the list of Pattern objects which can be modified.
-
matches
Description copied from interface:URLConnectionProcessor
Return true if this URLConnectionProcessor should be called for the specified connection- Specified by:
matches
in interfaceURLConnectionProcessor
- Parameters:
con
- the connection
-
before
Description copied from interface:URLConnectionProcessor
If this processermatches
, this method is called before the supplied URL connection is made. It can alter any request headers.- Specified by:
before
in interfaceURLConnectionProcessor
- Parameters:
con
- the connection- Throws:
IOException
-
after
Description copied from interface:URLConnectionProcessor
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; }
- Specified by:
after
in interfaceURLConnectionProcessor
- Parameters:
con
- the connection- Returns:
- the next connection to make, or
null
to accept this response - Throws:
IOException
-