Classes in this File | Line Coverage | Branch Coverage | Complexity | ||||
HttpPollingConnector |
|
| 1.0;1 |
1 | /* | |
2 | * $Id: HttpPollingConnector.java 19191 2010-08-25 21:05:23Z tcarlson $ | |
3 | * -------------------------------------------------------------------------------------- | |
4 | * Copyright (c) MuleSoft, Inc. All rights reserved. http://www.mulesoft.com | |
5 | * | |
6 | * The software in this package is published under the terms of the CPAL v1.0 | |
7 | * license, a copy of which has been included with this distribution in the | |
8 | * LICENSE.txt file. | |
9 | */ | |
10 | package org.mule.transport.http; | |
11 | ||
12 | import org.mule.api.MuleContext; | |
13 | import org.mule.api.config.MuleProperties; | |
14 | ||
15 | import java.util.Properties; | |
16 | ||
17 | /** | |
18 | * The HttpPollingConnectors allows for inbound Http endpoints to be configured with an address which it shall use | |
19 | * to poll for a result. If a result is received it becomes the inbound event for the component. This connector is | |
20 | * useful for interacting with services that provide pull-only support for obtaining data. This is typical for many | |
21 | * web-based services. | |
22 | */ | |
23 | public class HttpPollingConnector extends HttpConnector | |
24 | { | |
25 | /** | |
26 | * How long to wait in milliseconds between make a new request | |
27 | */ | |
28 | 0 | private long pollingFrequency = 1000L; |
29 | ||
30 | /** | |
31 | * If a zero-length content is returned should the message be discarded | |
32 | */ | |
33 | 0 | private boolean discardEmptyContent = true; |
34 | ||
35 | /** | |
36 | * Should the ETag header get honoured if it is present. | |
37 | */ | |
38 | 0 | private boolean checkEtag = true; |
39 | ||
40 | public HttpPollingConnector(MuleContext context) | |
41 | { | |
42 | 0 | super(context); |
43 | 0 | serviceOverrides = new Properties(); |
44 | 0 | serviceOverrides.setProperty(MuleProperties.CONNECTOR_MESSAGE_RECEIVER_CLASS, PollingHttpMessageReceiver.class.getName()); |
45 | 0 | } |
46 | ||
47 | public boolean isDiscardEmptyContent() | |
48 | { | |
49 | 0 | return discardEmptyContent; |
50 | } | |
51 | ||
52 | public void setDiscardEmptyContent(boolean discardEmptyContent) | |
53 | { | |
54 | 0 | this.discardEmptyContent = discardEmptyContent; |
55 | 0 | } |
56 | ||
57 | public long getPollingFrequency() | |
58 | { | |
59 | 0 | return pollingFrequency; |
60 | } | |
61 | ||
62 | public void setPollingFrequency(long pollingFrequency) | |
63 | { | |
64 | 0 | this.pollingFrequency = pollingFrequency; |
65 | 0 | } |
66 | ||
67 | public boolean isCheckEtag() | |
68 | { | |
69 | 0 | return checkEtag; |
70 | } | |
71 | ||
72 | public void setCheckEtag(boolean checkEtag) | |
73 | { | |
74 | 0 | this.checkEtag = checkEtag; |
75 | 0 | } |
76 | } |