Package org.exoplatform.agenda.util
Class CalendarFeedFetcher
java.lang.Object
org.exoplatform.agenda.util.CalendarFeedFetcher
Reads a calendar link over HTTP (EXO-90278), within bounds, through the
platform's
SafeHttpFetcher.
Addresses are the shared guard's: it is the resolver of the HTTP client's connection manager, so the address of every connection is judged when the connection is opened, redirects followed one hop at a time with each target checked again. Bounds: a connect timeout, a read timeout, a deadline over the whole read — redirects included — a body limit counted on the decoded bytes, and a redirect count. Nothing of the platform's goes out: no cookie store, no credentials, no proxy, no retry; the only headers sent are the ones a conditional read needs. Nothing of the URL goes into a log: it may embed a secret.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final recordWhat a read of a link answered. -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final DurationLongest wait for a connection.static final longLargest body read, in bytes.static final intMost redirects followed.static final StringThe ports a link may reach unless the deployment says otherwise.static final DurationLongest wait between two reads.static final DurationLongest read of a link, redirects included. -
Constructor Summary
ConstructorsConstructorDescriptionCalendarFeedFetcher(boolean allowInternalAddresses, String allowedPorts) The fetcher of a deployment. -
Method Summary
-
Field Details
-
DEFAULT_MAX_BYTES
public static final long DEFAULT_MAX_BYTESLargest body read, in bytes.- See Also:
-
DEFAULT_CONNECT
Longest wait for a connection. -
DEFAULT_READ
Longest wait between two reads. -
DEFAULT_TOTAL
Longest read of a link, redirects included. -
DEFAULT_MAX_REDIRECTS
public static final int DEFAULT_MAX_REDIRECTSMost redirects followed.- See Also:
-
DEFAULT_PORTS
The ports a link may reach unless the deployment says otherwise.- See Also:
-
-
Constructor Details
-
CalendarFeedFetcher
@Autowired public CalendarFeedFetcher(@Value("${exo.agenda.calendarSubscription.allowInternalAddresses:false}") boolean allowInternalAddresses, @Value("${exo.agenda.calendarSubscription.allowedPorts:80,443,8080,8443}") String allowedPorts) The fetcher of a deployment.- Parameters:
allowInternalAddresses- whether internal addresses may be read, false by default: the deployment's opt-out, as caldav-integration'sexo.agenda.caldav.server.allowPrivateAddressesallowedPorts- comma-separated ports a link may reach
-
-
Method Details
-
getGuard
- Returns:
- the address guard, whose URL rules the service applies before a read
-
fetch
public CalendarFeedFetcher.FeedResponse fetch(URI uri, String etag, String lastModified) throws CalendarFeedException Reads a link, conditionally when validators are given; a stored validator carrying a control character (a tab included), which an earlier version kept, is not sent, and the read is then unconditional.- Parameters:
uri- the URL, already normalized by the guardetag- the entity tag of the previous read, or nulllastModified- the Last-Modified header of the previous read, or null- Returns:
- what the server answered
- Throws:
CalendarFeedException- with the reason nothing usable was read
-
close
@PreDestroy public void close()Closes the connections.
-