[CONF] Apache Camel AWS-SQS

2011-05-16 Thread confluence







AWS-SQS
Page edited by Christian Mueller


 Changes (4)
 




...
|maxMessagesPerPoll| {{null}} | Consumer | The maximum number of messages which can be received in one poll to set in the {{com.amazonaws.services.sqs.model.ReceiveMessageRequest}}. | |visibilityTimeout | {{null}} | Shared | The duration (in seconds) that the received messages are hidden from subsequent retrieve requests after being retrieved by a ReceiveMessage request to set in the {{com.amazonaws.services.sqs.model.SetQueueAttributesRequest}}. This only make sense if its different from {{defaultVisibilityTimeout}}. It changes the queue visibility timeout attribute permanently. | 
|messageVisibilityTimeout | {{null}} | Consumer | *Camel 2.8:* The duration (in seconds) that the received messages are hidden from subsequent retrieve requests after being retrieved by a ReceiveMessage request to set in the {{com.amazonaws.services.sqs.model.ReceiveMessageRequest}}. It does *NOT* change the queue visibility timeout attribute permanently. | 
|maximumMessageSize | {{null}} | Shared | *Camel 2.8:* The maximumMessageSize (in bytes) an SQS message can contain for this queue, to set in the {{com.amazonaws.services.sqs.model.SetQueueAttributesRequest}}. | 
|messageRetentionPeriod | {{null}} | Shared | *Camel 2.8:* The messageRetentionPeriod (in seconds) a message will be retained by SQS for this queue, to set in the {{com.amazonaws.services.sqs.model.SetQueueAttributesRequest}}. | 
|policy | {{null}} | Shared | *Camel 2.8:* The policy for this queue to set in the {{com.amazonaws.services.sqs.model.SetQueueAttributesRequest}}. | 
 {info:title=Required SQS component options} 
...


Full Content

SQS Component
Available as of Camel 2.6

The sqs component supports sending and receiving messages to Amazon's SQS service.

PrerequisitesYou must have a valid Amazon Web Services developer account, and be signed up to use Amazon SQS. More information are available at Amazon SQS.

URI Format


aws-sqs://queue-name[?options]


The queue will be created if they don't already exists.
You can append query options to the URI in the following format, ?options=valueoption2=value...

URI Options



 Name 
 Default Value 
 Context 
 Description 


amazonSQSClient 
 null 
 Shared 
 Reference to a com.amazonaws.services.sqs.AmazonSQSClient in the Registry. 


accessKey 
 null 
 Shared 
 Amazon AWS Access Key 


secretKey 
 null 
 Shared 
 Amazon AWS Secret Key 


amazonSQSEndpoint 
 null 
 Shared 
 The region with which the AWS-SQS client wants to work with. 


attributeNames 
 null 
 Consumer 
 A list of attributes to set in the com.amazonaws.services.sqs.model.ReceiveMessageRequest. 


defaultVisibilityTimeout 
 null 
 Shared 
 The visibility timeout (in seconds) to set in the com.amazonaws.services.sqs.model.CreateQueueRequest. 


deleteAfterRead 
 true 
 Consumer 
 Delete message from SQS after it has been read 


maxMessagesPerPoll
 null 
 Consumer 
 The maximum number of messages which can be received in one poll to set in the com.amazonaws.services.sqs.model.ReceiveMessageRequest. 


visibilityTimeout 
 null 
 Shared 
 The duration (in seconds) that the received messages are hidden from subsequent retrieve requests after being retrieved by a ReceiveMessage request to set in the com.amazonaws.services.sqs.model.SetQueueAttributesRequest. This only make sense if its different from defaultVisibilityTimeout. It changes the queue visibility timeout attribute permanently. 


messageVisibilityTimeout 
 null 
 Consumer 
 Camel 2.8: The duration (in seconds) that the received messages are hidden from subsequent retrieve requests after being retrieved by a ReceiveMessage request to set in the com.amazonaws.services.sqs.model.ReceiveMessageRequest. It does NOT change the queue visibility timeout attribute permanently. 


maximumMessageSize 
 null 
 Shared 
 Camel 2.8: The maximumMessageSize (in bytes) an SQS message can contain for this queue, to set in the com.amazonaws.services.sqs.model.SetQueueAttributesRequest. 


messageRetentionPeriod 
 null 
 Shared 
 Camel 2.8: The messageRetentionPeriod (in seconds) a message will be retained by SQS for this queue, to set in the com.amazonaws.services.sqs.model.SetQueueAttributesRequest. 


policy 
 null 
 Shared 
 Camel 2.8: The policy for this queue to set in the com.amazonaws.services.sqs.model.SetQueueAttributesRequest. 





Required SQS component optionsYou have to provide the amazonSQSClient in the Registry or your accessKey and secretKey to access the Amazon's SQS.

Batch Consumer
This component implements the Batch Consumer. 

This allows you for instance to know how many messages exists in this batch and for instance let the 

[CONF] Apache Camel NMR

2011-05-16 Thread confluence







NMR
Page edited by Gert Vanthienen


 Changes (2)
 




...
{div:class=confluenceTableSmall} || Option || Default Value || Description || 
| {{runAsSubject}} | {{false}} | When this is set to *{{true}}* on a consumer endpoint, the endpoint will be invoked on behalf of the {{Subject}} that is set on the {{Exchange}} (i.e. the call to {{Subject.getSubject(AccessControlContext)}} will return the {{Subject}} instance) | 
| {{synchronous}} | {{false}} | When this is set to *{{true}}* on a consumer endpoint, an incoming, synchronous NMR Exchange will be handled on the senders thread instead of being handled on a new thread of the NMR endpoints thread pool | 
| {{timeout}} | {{0}} | When this is set to a value greater than 0, the producer endpoint will timeout if it doesnt receive a response from the NMR within the given timeout period (in milliseconds).  Configuring a timeout value will switch to using synchronous interactions with the NMR instead of the usual asynchronous messaging. | 
{div}  
...


Full Content

NMR Component

The nmr component is an adapter to the Normalized Message Router (NMR) in ServiceMix, which is intended for use by Camel applications deployed directly into the OSGi container. By contrast, the JBI component is intended for use by Camel applications deployed into the ServiceMix JBI container.

Installing

The NMR component is provided with Apache ServiceMix. It is not distributed with Camel. To install the NMR component in ServiceMix, enter the following command in the ServiceMix console window:



features install nmr



You also need to instantiate the NMR component. You can do this by editing your Spring configuration file, META-INF/spring/*.xml, and adding the following bean instance:



beans xmlns:osgi="http://www.springframework.org/schema/osgi" ... 
...
bean id="nmr" class="org.apache.servicemix.camel.nmr.ServiceMixComponent"
property name="nmr"
osgi:reference interface="org.apache.servicemix.nmr.api.NMR" /
/property
/bean
...
/beans



NMR consumer and producer endpoints

The following code:



from("nmr:MyServiceEndpoint")



Automatically exposes a new endpoint to the bus with endpoint name MyServiceEndpoint (see URIformat).

When an NMR endpoint appears at the end of a route, for example:



to("nmr:MyServiceEndpoint")



The messages sent by this producer endpoint are sent to the already deployed JBI endpoint.


URI format



nmr:endpointName



URI Options



 Option 
 Default Value 
 Description 


 runAsSubject 
 false 
 When this is set to true on a consumer endpoint, the endpoint will be invoked on behalf of the Subject that is set on the Exchange (i.e. the call to Subject.getSubject(AccessControlContext) will return the Subject instance) 


 synchronous 
 false 
 When this is set to true on a consumer endpoint, an incoming, synchronous NMR Exchange will be handled on the sender's thread instead of being handled on a new thread of the NMR endpoint's thread pool 


 timeout 
 0 
 When this is set to a value greater than 0, the producer endpoint will timeout if it doesn't receive a response from the NMR within the given timeout period (in milliseconds).  Configuring a timeout value will switch to using synchronous interactions with the NMR instead of the usual asynchronous messaging. 





Examples



from("nmr:MyServiceEndpoint")
from("nmr:MyServiceEndpoint?synchronous=true").to("nmr:AnotherEndpoint")



Using Stream bodies
If you are using a stream type as the message body, you should be aware that a stream is only capable of being read once. So if you enable DEBUG logging, the body is usually logged and thus read. To deal with this, Camel has a streamCaching option that can cache the stream, enabling you to read it multiple times.



from("nmr:MyEndpoint").streamCaching().to("xslt:transform.xsl", "bean:doSomething");



From Camel 1.5 onwards, the stream caching is default enabled, so it is not necessary to set the streamCaching() option.
In Camel 2.0 we store big input streams (by default, over 64K) in a temp file using CachedOutputStream. When you close the input stream, the temp file will be deleted.

See Also

	Configuring Camel
	Component
	Endpoint
	Getting Started





Change Notification Preferences

View Online
|
View Changes
|
Add Comment









svn commit: r1103696 - /camel/trunk/components/camel-restlet/src/test/java/org/apache/camel/component/restlet/RestletRecipientListTest.java

2011-05-16 Thread davsclaus
Author: davsclaus
Date: Mon May 16 11:15:54 2011
New Revision: 1103696

URL: http://svn.apache.org/viewvc?rev=1103696view=rev
Log:
Added test based on user forum issue

Added:

camel/trunk/components/camel-restlet/src/test/java/org/apache/camel/component/restlet/RestletRecipientListTest.java
  - copied, changed from r1103622, 
camel/trunk/components/camel-restlet/src/test/java/org/apache/camel/component/restlet/RestletProducerGetTest.java

Copied: 
camel/trunk/components/camel-restlet/src/test/java/org/apache/camel/component/restlet/RestletRecipientListTest.java
 (from r1103622, 
camel/trunk/components/camel-restlet/src/test/java/org/apache/camel/component/restlet/RestletProducerGetTest.java)
URL: 
http://svn.apache.org/viewvc/camel/trunk/components/camel-restlet/src/test/java/org/apache/camel/component/restlet/RestletRecipientListTest.java?p2=camel/trunk/components/camel-restlet/src/test/java/org/apache/camel/component/restlet/RestletRecipientListTest.javap1=camel/trunk/components/camel-restlet/src/test/java/org/apache/camel/component/restlet/RestletProducerGetTest.javar1=1103622r2=1103696rev=1103696view=diff
==
--- 
camel/trunk/components/camel-restlet/src/test/java/org/apache/camel/component/restlet/RestletProducerGetTest.java
 (original)
+++ 
camel/trunk/components/camel-restlet/src/test/java/org/apache/camel/component/restlet/RestletRecipientListTest.java
 Mon May 16 11:15:54 2011
@@ -16,8 +16,6 @@
  */
 package org.apache.camel.component.restlet;
 
-import org.apache.camel.Exchange;
-import org.apache.camel.Processor;
 import org.apache.camel.builder.RouteBuilder;
 import org.apache.camel.test.junit4.CamelTestSupport;
 import org.junit.Test;
@@ -25,12 +23,17 @@ import org.junit.Test;
 /**
  * @version 
  */
-public class RestletProducerGetTest extends CamelTestSupport {
+public class RestletRecipientListTest extends CamelTestSupport {
 
 @Test
-public void testRestletProducerGet() throws Exception {
-String out = template.requestBodyAndHeader(direct:start, null, id, 
123, String.class);
-assertEquals(123;Donald Duck, out);
+public void testRestlet() throws Exception {
+getMockEndpoint(mock:oracle).expectedBodiesReceived(110);
+getMockEndpoint(mock:apple).expectedBodiesReceived(150);
+
+
template.sendBody(restlet:http://0.0.0.0:9080/stock/ORCL?restletMethod=post;, 
110);
+
template.sendBody(restlet:http://0.0.0.0:9080/stock/APPL?restletMethod=post;, 
150);
+
+assertMockEndpointsSatisfied();
 }
 
 @Override
@@ -38,15 +41,11 @@ public class RestletProducerGetTest exte
 return new RouteBuilder() {
 @Override
 public void configure() throws Exception {
-
from(direct:start).to(restlet:http://localhost:9080/users/123/basic;).to(log:reply);
+
from(restlet:http://0.0.0.0:9080/stock/{symbol}?restletMethods=post;)
+.recipientList().simple(seda:${header.symbol});
 
-from(restlet:http://localhost:9080/users/{id}/basic;)
-.process(new Processor() {
-public void process(Exchange exchange) throws 
Exception {
-String id = exchange.getIn().getHeader(id, 
String.class);
-exchange.getOut().setBody(id + ;Donald Duck);
-}
-});
+from(seda:ORCL).to(mock:oracle);
+from(seda:APPL).to(mock:apple);
 }
 };
 }




svn commit: r1103757 - in /camel/trunk/components/camel-jms/src: main/java/org/apache/camel/component/jms/ test/java/org/apache/camel/component/jms/

2011-05-16 Thread davsclaus
Author: davsclaus
Date: Mon May 16 14:48:34 2011
New Revision: 1103757

URL: http://svn.apache.org/viewvc?rev=1103757view=rev
Log:
Fixed JMX issue on camel-jms.

Modified:

camel/trunk/components/camel-jms/src/main/java/org/apache/camel/component/jms/DefaultQueueBrowseStrategy.java

camel/trunk/components/camel-jms/src/main/java/org/apache/camel/component/jms/JmsEndpoint.java

camel/trunk/components/camel-jms/src/main/java/org/apache/camel/component/jms/JmsQueueEndpoint.java

camel/trunk/components/camel-jms/src/test/java/org/apache/camel/component/jms/BrowsableQueueTest.java

Modified: 
camel/trunk/components/camel-jms/src/main/java/org/apache/camel/component/jms/DefaultQueueBrowseStrategy.java
URL: 
http://svn.apache.org/viewvc/camel/trunk/components/camel-jms/src/main/java/org/apache/camel/component/jms/DefaultQueueBrowseStrategy.java?rev=1103757r1=1103756r2=1103757view=diff
==
--- 
camel/trunk/components/camel-jms/src/main/java/org/apache/camel/component/jms/DefaultQueueBrowseStrategy.java
 (original)
+++ 
camel/trunk/components/camel-jms/src/main/java/org/apache/camel/component/jms/DefaultQueueBrowseStrategy.java
 Mon May 16 14:48:34 2011
@@ -30,18 +30,17 @@ import org.springframework.jms.core.Brow
 import org.springframework.jms.core.JmsOperations;
 
 /**
- * A default implementation of queue browsing using the Spring 2.5.x {@link 
BrowserCallback}
+ * A default implementation of queue browsing using the Spring {@link 
BrowserCallback}
+ *
  * @version 
  */
 public class DefaultQueueBrowseStrategy implements QueueBrowseStrategy {
 
 public ListExchange browse(JmsOperations template, String queue, final 
JmsQueueEndpoint endpoint) {
-return  (ListExchange) template.browse(queue, new BrowserCallback() {
-
-public Object doInJms(Session session, QueueBrowser browser) 
throws JMSException {
-// TODO not the best implementation in the world as we have to 
browse
+return  template.browse(queue, new BrowserCallbackListExchange() {
+public ListExchange doInJms(Session session, QueueBrowser 
browser) throws JMSException {
+// not the best implementation in the world as we have to 
browse
 // the entire queue, which could be massive
-
 ListExchange answer = new ArrayListExchange();
 Enumeration iter = browser.getEnumeration();
 while (iter.hasMoreElements()) {

Modified: 
camel/trunk/components/camel-jms/src/main/java/org/apache/camel/component/jms/JmsEndpoint.java
URL: 
http://svn.apache.org/viewvc/camel/trunk/components/camel-jms/src/main/java/org/apache/camel/component/jms/JmsEndpoint.java?rev=1103757r1=1103756r2=1103757view=diff
==
--- 
camel/trunk/components/camel-jms/src/main/java/org/apache/camel/component/jms/JmsEndpoint.java
 (original)
+++ 
camel/trunk/components/camel-jms/src/main/java/org/apache/camel/component/jms/JmsEndpoint.java
 Mon May 16 14:48:34 2011
@@ -38,11 +38,13 @@ import org.apache.camel.PollingConsumer;
 import org.apache.camel.Processor;
 import org.apache.camel.Producer;
 import org.apache.camel.Service;
+import org.apache.camel.ServiceStatus;
 import org.apache.camel.component.jms.reply.PersistentQueueReplyManager;
 import org.apache.camel.component.jms.reply.ReplyManager;
 import org.apache.camel.component.jms.reply.TemporaryQueueReplyManager;
 import org.apache.camel.impl.DefaultEndpoint;
 import org.apache.camel.impl.DefaultExchange;
+import org.apache.camel.impl.ServiceSupport;
 import org.apache.camel.impl.SynchronousDelegateProducer;
 import org.apache.camel.spi.HeaderFilterStrategy;
 import org.apache.camel.spi.HeaderFilterStrategyAware;
@@ -947,6 +949,16 @@ public class JmsEndpoint extends Default
 return super.getEndpointUri();
 }
 
+@ManagedAttribute(description = Service State)
+public String getState() {
+ServiceStatus status = this.getStatus();
+// if no status exists then its stopped
+if (status == null) {
+status = ServiceStatus.Stopped;
+}
+return status.name();
+}
+
 // Implementation methods
 //-
 

Modified: 
camel/trunk/components/camel-jms/src/main/java/org/apache/camel/component/jms/JmsQueueEndpoint.java
URL: 
http://svn.apache.org/viewvc/camel/trunk/components/camel-jms/src/main/java/org/apache/camel/component/jms/JmsQueueEndpoint.java?rev=1103757r1=1103756r2=1103757view=diff
==
--- 
camel/trunk/components/camel-jms/src/main/java/org/apache/camel/component/jms/JmsQueueEndpoint.java
 (original)
+++ 
camel/trunk/components/camel-jms/src/main/java/org/apache/camel/component/jms/JmsQueueEndpoint.java
 Mon May 16 14:48:34 2011
@@ 

svn commit: r1103887 - in /camel/trunk/components/camel-dns/src: main/java/org/apache/camel/component/dns/ test/java/org/apache/camel/component/dns/

2011-05-16 Thread hadrian
Author: hadrian
Date: Mon May 16 20:52:19 2011
New Revision: 1103887

URL: http://svn.apache.org/viewvc?rev=1103887view=rev
Log:
CAMEL-3977. Timeouts in camel-dns

Modified:

camel/trunk/components/camel-dns/src/main/java/org/apache/camel/component/dns/DnsIpEndpoint.java

camel/trunk/components/camel-dns/src/main/java/org/apache/camel/component/dns/DnsLookupEndpoint.java

camel/trunk/components/camel-dns/src/test/java/org/apache/camel/component/dns/DnsLookupEndpointSpringTest.java

camel/trunk/components/camel-dns/src/test/java/org/apache/camel/component/dns/DnsLookupEndpointTest.java

Modified: 
camel/trunk/components/camel-dns/src/main/java/org/apache/camel/component/dns/DnsIpEndpoint.java
URL: 
http://svn.apache.org/viewvc/camel/trunk/components/camel-dns/src/main/java/org/apache/camel/component/dns/DnsIpEndpoint.java?rev=1103887r1=1103886r2=1103887view=diff
==
--- 
camel/trunk/components/camel-dns/src/main/java/org/apache/camel/component/dns/DnsIpEndpoint.java
 (original)
+++ 
camel/trunk/components/camel-dns/src/main/java/org/apache/camel/component/dns/DnsIpEndpoint.java
 Mon May 16 20:52:19 2011
@@ -26,7 +26,6 @@ import org.apache.camel.Producer;
 import org.apache.camel.impl.DefaultEndpoint;
 import org.apache.camel.impl.DefaultProducer;
 import org.apache.camel.util.ObjectHelper;
-import org.xbill.DNS.Address;
 
 /**
  * An endpoint to conduct IP address lookup from the host name.
@@ -44,7 +43,7 @@ public class DnsIpEndpoint extends Defau
 String domain = 
exchange.getIn().getHeader(DnsConstants.DNS_DOMAIN, String.class);
 ObjectHelper.notEmpty(domain, Header  + 
DnsConstants.DNS_DOMAIN);
 
-InetAddress address = Address.getByName(domain);
+InetAddress address = InetAddress.getByName(domain);
 exchange.getIn().setBody(address);
 }
 };

Modified: 
camel/trunk/components/camel-dns/src/main/java/org/apache/camel/component/dns/DnsLookupEndpoint.java
URL: 
http://svn.apache.org/viewvc/camel/trunk/components/camel-dns/src/main/java/org/apache/camel/component/dns/DnsLookupEndpoint.java?rev=1103887r1=1103886r2=1103887view=diff
==
--- 
camel/trunk/components/camel-dns/src/main/java/org/apache/camel/component/dns/DnsLookupEndpoint.java
 (original)
+++ 
camel/trunk/components/camel-dns/src/main/java/org/apache/camel/component/dns/DnsLookupEndpoint.java
 Mon May 16 20:52:19 2011
@@ -16,6 +16,7 @@
  */
 package org.apache.camel.component.dns;
 
+import org.apache.camel.CamelException;
 import org.apache.camel.Component;
 import org.apache.camel.Consumer;
 import org.apache.camel.Exchange;
@@ -26,6 +27,7 @@ import org.apache.camel.impl.DefaultProd
 import org.apache.camel.util.ObjectHelper;
 import org.xbill.DNS.DClass;
 import org.xbill.DNS.Lookup;
+import org.xbill.DNS.SimpleResolver;
 import org.xbill.DNS.Type;
 
 /**
@@ -58,22 +60,15 @@ public class DnsLookupEndpoint extends D
 dnsClass = DClass.value(String.valueOf(dclass));
 }
 
-Lookup lookup;
-if (dnsType != null  dnsClass != null) {
-lookup = new Lookup(dnsName, dnsType, dnsClass);
-} else {
-if (dnsType != null) {
-lookup = new Lookup(dnsName, dnsType);
-} else {
-lookup = new Lookup(dnsName);
-}
-}
+Lookup lookup = (dnsClass == null) ? 
+(dnsType == null ? new Lookup(dnsName) : new 
Lookup(dnsName, dnsType)) : 
+new Lookup(dnsName, dnsType, dnsClass);
 
 lookup.run();
 if (lookup.getAnswers() != null) {
 exchange.getIn().setBody(lookup.getAnswers());
 } else {
-exchange.getIn().setBody(lookup.getErrorString());
+throw new CamelException(lookup.getErrorString());
 }
 }
 };

Modified: 
camel/trunk/components/camel-dns/src/test/java/org/apache/camel/component/dns/DnsLookupEndpointSpringTest.java
URL: 
http://svn.apache.org/viewvc/camel/trunk/components/camel-dns/src/test/java/org/apache/camel/component/dns/DnsLookupEndpointSpringTest.java?rev=1103887r1=1103886r2=1103887view=diff
==
--- 
camel/trunk/components/camel-dns/src/test/java/org/apache/camel/component/dns/DnsLookupEndpointSpringTest.java
 (original)
+++ 
camel/trunk/components/camel-dns/src/test/java/org/apache/camel/component/dns/DnsLookupEndpointSpringTest.java
 Mon May 16 20:52:19 2011
@@ -26,6 +26,7 @@ import org.apache.camel.Produce;
 import org.apache.camel.ProducerTemplate;
 import org.apache.camel.component.mock.MockEndpoint;
 

svn commit: r1103890 - /camel/trunk/parent/pom.xml

2011-05-16 Thread hadrian
Author: hadrian
Date: Mon May 16 21:04:11 2011
New Revision: 1103890

URL: http://svn.apache.org/viewvc?rev=1103890view=rev
Log:
CAMEL-3978. Updrade dnsjava to 2.1.1

Modified:
camel/trunk/parent/pom.xml

Modified: camel/trunk/parent/pom.xml
URL: 
http://svn.apache.org/viewvc/camel/trunk/parent/pom.xml?rev=1103890r1=1103889r2=1103890view=diff
==
--- camel/trunk/parent/pom.xml (original)
+++ camel/trunk/parent/pom.xml Mon May 16 21:04:11 2011
@@ -55,7 +55,7 @@
 cxf-version2.4.0/cxf-version
 cxf-xjc-utils-version2.3.2/cxf-xjc-utils-version
 derby-version10.4.2.0/derby-version
-dnsjava-version2.1.0/dnsjava-version
+dnsjava-version2.1.1/dnsjava-version
 dozer-version5.3.1/dozer-version
 easymock-version2.5.2/easymock-version
 ehcache-bundle-version2.3.0_3-SNAPSHOT/ehcache-bundle-version




svn commit: r1103974 - in /camel/trunk/camel-core/src: main/java/org/apache/camel/util/jsse/ test/java/org/apache/camel/util/jsse/

2011-05-16 Thread ningjiang
Author: ningjiang
Date: Tue May 17 01:19:11 2011
New Revision: 1103974

URL: http://svn.apache.org/viewvc?rev=1103974view=rev
Log:
CAMEL-3750 Applied patch with thanks to David

Modified:

camel/trunk/camel-core/src/main/java/org/apache/camel/util/jsse/BaseSSLContextParameters.java

camel/trunk/camel-core/src/main/java/org/apache/camel/util/jsse/SSLContextClientParameters.java

camel/trunk/camel-core/src/main/java/org/apache/camel/util/jsse/SSLContextServerParameters.java

camel/trunk/camel-core/src/test/java/org/apache/camel/util/jsse/SSLContextParametersTest.java

Modified: 
camel/trunk/camel-core/src/main/java/org/apache/camel/util/jsse/BaseSSLContextParameters.java
URL: 
http://svn.apache.org/viewvc/camel/trunk/camel-core/src/main/java/org/apache/camel/util/jsse/BaseSSLContextParameters.java?rev=1103974r1=1103973r2=1103974view=diff
==
--- 
camel/trunk/camel-core/src/main/java/org/apache/camel/util/jsse/BaseSSLContextParameters.java
 (original)
+++ 
camel/trunk/camel-core/src/main/java/org/apache/camel/util/jsse/BaseSSLContextParameters.java
 Tue May 17 01:19:11 2011
@@ -87,10 +87,10 @@ public abstract class BaseSSLContextPara
 private FilterParameters secureSocketProtocolsFilter;
 
 /**
- * The optional {@link SSLSessionContext} timeout time for {@link 
javax.net.ssl.SSLSession}s.
- * TODO provide a time unit here and on the getter/setter.
+ * The optional {@link SSLSessionContext} timeout time for {@link 
javax.net.ssl.SSLSession}s in seconds.
  */
 private Integer sessionTimeout;
+
 
 /**
  * Returns the optional explicitly configured cipher suites for this 
configuration.
@@ -199,14 +199,16 @@ public abstract class BaseSSLContextPara
 }
 
 /**
- * Returns the optional {@link SSLSessionContext} timeout time for {@link 
javax.net.ssl.SSLSession}s.
+ * Returns the optional {@link SSLSessionContext} timeout time for {@link 
javax.net.ssl.SSLSession}s 
+ * in seconds.
  */
 public Integer getSessionTimeout() {
 return sessionTimeout;
 }
 
 /**
- * Sets the optional {@link SSLSessionContext} timeout time for {@link 
javax.net.ssl.SSLSession}s.
+ * Sets the optional {@link SSLSessionContext} timeout time for {@link 
javax.net.ssl.SSLSession}s
+ * in seconds.
  *
  * @param sessionTimeout the timeout value or {@code null} to use the 
default
  */
@@ -215,6 +217,20 @@ public abstract class BaseSSLContextPara
 }
 
 /**
+ * Returns a flag indicating if default values should be applied in the 
event that no other property
+ * of the instance configures a particular aspect of the entity produced 
by the instance.
+ * This flag is used to allow instances of this class to produce a 
configurer that simply
+ * passes through the current configuration of a configured entity when 
the instance of this
+ * class would otherwise only apply some default configuration.
+ *
+ * @see SSLContextClientParameters
+ * @see SSLContextServerParameters
+ */
+protected boolean getAllowPassthrough() {
+return false;
+}
+
+/**
  * Configures the actual {@link SSLContext} itself with direct setter 
calls.  This method differs from
  * configuration options that are handled by a configurer instance in that 
the options are part of the
  * context itself and are not part of some factory or instance object 
returned by the context.
@@ -290,6 +306,10 @@ public abstract class BaseSSLContextPara
 enabledSecureSocketProtocolsPatterns = null;
 }
 
+//
+
+final boolean allowPassthrough = getAllowPassthrough();
+
 //
 
 ConfigurerSSLEngine sslEngineConfigurer = new 
ConfigurerSSLEngine() {
@@ -299,13 +319,17 @@ public abstract class BaseSSLContextPara
 
 CollectionString filteredCipherSuites = 
BaseSSLContextParameters.this
 .filter(enabledCipherSuites, 
Arrays.asList(engine.getSSLParameters().getCipherSuites()),
-enabledCipherSuitePatterns, 
defaultEnabledCipherSuitePatterns);
+Arrays.asList(engine.getEnabledCipherSuites()),
+enabledCipherSuitePatterns, 
defaultEnabledCipherSuitePatterns,
+!allowPassthrough);
  
 engine.setEnabledCipherSuites(filteredCipherSuites.toArray(new 
String[filteredCipherSuites.size()]));
 
 CollectionString filteredSecureSocketProtocols = 
BaseSSLContextParameters.this
 .filter(enabledSecureSocketProtocols, 
Arrays.asList(engine.getSSLParameters().getProtocols()),
-enabledSecureSocketProtocolsPatterns, 
defaultEnabledSecureSocketProtocolsPatterns);
+

[CONF] Apache Camel HTTP4

2011-05-16 Thread confluence







HTTP4
Page edited by willem jiang


Comment:
CAMEL-3780


 Changes (2)
 




...
 h4. Setting Basic Authentication and Proxy 
*Before Camel 2.8.0* 
{div:class=confluenceTableSmall} || Name || Default Value || Description || 
...
| {{proxyNtHost}} | {{null}} | The proxy Nt host name | {div} 
*Since Camel 2.8.0* {div:class=confluenceTableSmall} || Name || Default Value || Description || | {{authUsername}} | {{null}} | Username for authentication. | | {{authPassword}} | {{null}} | Password for authentication. | | {{authDomain}} | {{null}} | The domain name for authentication. | | {{authHost}} | {{null}} | The host name authentication. | | {{proxyAuthHost}} | {{null}} | The proxy host name | | {{proxyAuthPort}} | {{null}} | The proxy port number | | {{proxyAuthUsername}} | {{null}} | Username for proxy authentication | | {{proxyAuthPassword}} | {{null}} | Password for proxy authentication | | {{proxyAuthDomain}} | {{null}} | The proxy domain name | | {{proxyAuthNtHost}} | {{null}} | The proxy Nt host name | {div} 
 h3. HttpComponent Options 
...


Full Content

HTTP4 Component

Available as of Camel 2.3

The http4: component provides HTTP based endpoints for consuming external HTTP resources (as a client to call external servers using HTTP).

Maven users will need to add the following dependency to their pom.xml for this component:


dependency
groupIdorg.apache.camel/groupId
artifactIdcamel-http4/artifactId
versionx.x.x/version
!-- use the same version as your Camel core version --
/dependency



camel-http4 vs camel-httpCamel-http4 uses HttpClient 4.x while camel-http uses HttpClient 3.x.

URI format



http4:hostname[:port][/resourceUri][?options]


Will by default use port 80 for HTTP and 443 for HTTPS.

You can append query options to the URI in the following format, ?option=valueoption=value...

camel-http4 vs camel-jettyYou can only produce to endpoints generated by the HTTP4 component. Therefore it should never be used as input into your camel Routes. To bind/expose an HTTP endpoint via a HTTP server as input to a camel route, you can use the Jetty Component

HttpEndpoint Options




 Name 
 Default Value 
 Description 


 x509HostnameVerifier 
  org.apache.http.conn.ssl.BrowserCompatHostnameVerifier 
 Camel 2.7: You can refer to a different org.apache.http.conn.ssl.X509HostnameVerifier instance in the Registry such as org.apache.http.conn.ssl.StrictHostnameVerifier or org.apache.http.conn.ssl.AllowAllHostnameVerifier. 


 throwExceptionOnFailure 
 true 
 Option to disable throwing the HttpOperationFailedException in case of failed responses from the remote server. This allows you to get all responses regardless of the HTTP status code. 


 bridgeEndpoint 
 false 
 If the option is true , HttpProducer will ignore the Exchange.HTTP_URI header, and use the endpoint's URI for request. You may also set the throwExcpetionOnFailure to be false to let the HttpProducer send all the fault response back. If the option is true, HttpProducer and CamelServlet will skip the gzip processing if the content-encoding is "gzip".


 disableStreamCache 
 false 
 DefaultHttpBinding will copy the request input stream into a stream cache and put it into message body if this option is false to support read it twice, otherwise DefaultHttpBinding will set the request input stream direct into the message body. 


 httpBindingRef 
 null 
 Reference to a org.apache.camel.component.http.HttpBinding in the Registry. Prefer to use the httpBinding option. 


 httpBinding 
 null 
 Reference to a org.apache.camel.component.http.HttpBinding in the Registry. 


 httpClientConfigurerRef 
 null 
 Reference to a org.apache.camel.component.http.HttpClientConfigurer in the Registry. Prefer to use the httpClientConfigurer option. 


 httpClientConfigurer 
 null 
 Reference to a org.apache.camel.component.http.HttpClientConfigurer in the Registry. 


 httpClient.XXX 
 null 
 Setting options on the BasicHttpParams. For instance httpClient.soTimeout=5000 will set the SO_TIMEOUT to 5 seconds. Look on the setter methods of the following parameter beans for a complete reference: AuthParamBean, ClientParamBean, ConnConnectionParamBean, ConnRouteParamBean, CookieSpecParamBean, HttpConnectionParamBean and HttpProtocolParamBean 


 clientConnectionManager 
 null 
 To use a custom org.apache.http.conn.ClientConnectionManager. 


 transferException 
 false 
 If enabled and an Exchange failed processing on the consumer side, and if the caused Exception was send back serialized in the response as a application/x-java-serialized-object content type (for example using Jetty or SERVLET Camel components). On the 

[CONF] Apache Camel HTTP4

2011-05-16 Thread confluence







HTTP4
Page edited by willem jiang


 Changes (2)
 




...
{code} from(direct:start) 
.to(http4://oldhost?proxyAuthHost=www.myproxy.comproxyAuthPort=80); 
{code}  
There is also support for proxy authentication via the {{proxyAuthUsername}} and {{proxyAuthPassword}} options. 
 h4. Using proxy settings outside of URI 
...


Full Content

HTTP4 Component

Available as of Camel 2.3

The http4: component provides HTTP based endpoints for consuming external HTTP resources (as a client to call external servers using HTTP).

Maven users will need to add the following dependency to their pom.xml for this component:


dependency
groupIdorg.apache.camel/groupId
artifactIdcamel-http4/artifactId
versionx.x.x/version
!-- use the same version as your Camel core version --
/dependency



camel-http4 vs camel-httpCamel-http4 uses HttpClient 4.x while camel-http uses HttpClient 3.x.

URI format



http4:hostname[:port][/resourceUri][?options]


Will by default use port 80 for HTTP and 443 for HTTPS.

You can append query options to the URI in the following format, ?option=valueoption=value...

camel-http4 vs camel-jettyYou can only produce to endpoints generated by the HTTP4 component. Therefore it should never be used as input into your camel Routes. To bind/expose an HTTP endpoint via a HTTP server as input to a camel route, you can use the Jetty Component

HttpEndpoint Options




 Name 
 Default Value 
 Description 


 x509HostnameVerifier 
  org.apache.http.conn.ssl.BrowserCompatHostnameVerifier 
 Camel 2.7: You can refer to a different org.apache.http.conn.ssl.X509HostnameVerifier instance in the Registry such as org.apache.http.conn.ssl.StrictHostnameVerifier or org.apache.http.conn.ssl.AllowAllHostnameVerifier. 


 throwExceptionOnFailure 
 true 
 Option to disable throwing the HttpOperationFailedException in case of failed responses from the remote server. This allows you to get all responses regardless of the HTTP status code. 


 bridgeEndpoint 
 false 
 If the option is true , HttpProducer will ignore the Exchange.HTTP_URI header, and use the endpoint's URI for request. You may also set the throwExcpetionOnFailure to be false to let the HttpProducer send all the fault response back. If the option is true, HttpProducer and CamelServlet will skip the gzip processing if the content-encoding is "gzip".


 disableStreamCache 
 false 
 DefaultHttpBinding will copy the request input stream into a stream cache and put it into message body if this option is false to support read it twice, otherwise DefaultHttpBinding will set the request input stream direct into the message body. 


 httpBindingRef 
 null 
 Reference to a org.apache.camel.component.http.HttpBinding in the Registry. Prefer to use the httpBinding option. 


 httpBinding 
 null 
 Reference to a org.apache.camel.component.http.HttpBinding in the Registry. 


 httpClientConfigurerRef 
 null 
 Reference to a org.apache.camel.component.http.HttpClientConfigurer in the Registry. Prefer to use the httpClientConfigurer option. 


 httpClientConfigurer 
 null 
 Reference to a org.apache.camel.component.http.HttpClientConfigurer in the Registry. 


 httpClient.XXX 
 null 
 Setting options on the BasicHttpParams. For instance httpClient.soTimeout=5000 will set the SO_TIMEOUT to 5 seconds. Look on the setter methods of the following parameter beans for a complete reference: AuthParamBean, ClientParamBean, ConnConnectionParamBean, ConnRouteParamBean, CookieSpecParamBean, HttpConnectionParamBean and HttpProtocolParamBean 


 clientConnectionManager 
 null 
 To use a custom org.apache.http.conn.ClientConnectionManager. 


 transferException 
 false 
 If enabled and an Exchange failed processing on the consumer side, and if the caused Exception was send back serialized in the response as a application/x-java-serialized-object content type (for example using Jetty or SERVLET Camel components). On the producer side the exception will be deserialized and thrown as is, instead of the HttpOperationFailedException. The caused exception is required to be serialized. 


 maxTotalConnections 
 200 
 The maximum number of connections. 


 connectionsPerRoute 
 20 
 The maximum number of connections per route. 





The following authentication options can also be set on the HttpEndpoint:

Setting Basic Authentication and Proxy
Before Camel 2.8.0



 Name 
 Default Value 
 Description 


 username 
 null 
 Username for authentication. 


 password 
 null 
 Password for authentication. 


 domain 
 null 
 The domain name for authentication. 


 host 
 null 
 The host name authentication. 


 proxyHost 
 null 
 The proxy host name 


 proxyPort 
 null 
 The proxy port number 


 

svn commit: r1103984 - in /camel/trunk/components/camel-http4/src: main/java/org/apache/camel/component/http4/ test/java/org/apache/camel/component/http4/

2011-05-16 Thread ningjiang
Author: ningjiang
Date: Tue May 17 02:12:08 2011
New Revision: 1103984

URL: http://svn.apache.org/viewvc?rev=1103984view=rev
Log:
CAMEL-3780 camel-http4 should use same option names as camel-http

Modified:

camel/trunk/components/camel-http4/src/main/java/org/apache/camel/component/http4/HttpComponent.java

camel/trunk/components/camel-http4/src/test/java/org/apache/camel/component/http4/HttpAuthenticationTest.java

camel/trunk/components/camel-http4/src/test/java/org/apache/camel/component/http4/HttpProxyServerTest.java

camel/trunk/components/camel-http4/src/test/java/org/apache/camel/component/http4/HttpsAuthenticationTest.java

Modified: 
camel/trunk/components/camel-http4/src/main/java/org/apache/camel/component/http4/HttpComponent.java
URL: 
http://svn.apache.org/viewvc/camel/trunk/components/camel-http4/src/main/java/org/apache/camel/component/http4/HttpComponent.java?rev=1103984r1=1103983r2=1103984view=diff
==
--- 
camel/trunk/components/camel-http4/src/main/java/org/apache/camel/component/http4/HttpComponent.java
 (original)
+++ 
camel/trunk/components/camel-http4/src/main/java/org/apache/camel/component/http4/HttpComponent.java
 Tue May 17 02:12:08 2011
@@ -110,37 +110,34 @@ public class HttpComponent extends Heade
 }
 
 private HttpClientConfigurer configureBasicAuthentication(MapString, 
Object parameters, HttpClientConfigurer configurer) {
-String username = getAndRemoveParameter(parameters, username, 
String.class);
-String password = getAndRemoveParameter(parameters, password, 
String.class);
+String authUsername = getAndRemoveParameter(parameters, 
authUsername, String.class);
+String authPassword = getAndRemoveParameter(parameters, 
authPassword, String.class);
 
-if (username != null  password != null) {
-String domain = getAndRemoveParameter(parameters, domain, 
String.class);
-String host = getAndRemoveParameter(parameters, host, 
String.class);
+if (authUsername != null  authPassword != null) {
+String authDomain = getAndRemoveParameter(parameters, 
authDomain, String.class);
+String authHost = getAndRemoveParameter(parameters, authHost, 
String.class);
 
-return CompositeHttpConfigurer.combineConfigurers(
-configurer,
-new BasicAuthenticationHttpClientConfigurer(username, 
password, domain, host));
+return CompositeHttpConfigurer.combineConfigurers(configurer, new 
BasicAuthenticationHttpClientConfigurer(authUsername, authPassword, authDomain, 
authHost));
 }
 
 return configurer;
 }
 
 private HttpClientConfigurer configureHttpProxy(MapString, Object 
parameters, HttpClientConfigurer configurer) {
-String proxyHost = getAndRemoveParameter(parameters, proxyHost, 
String.class);
-Integer proxyPort = getAndRemoveParameter(parameters, proxyPort, 
Integer.class);
+String proxyAuthHost = getAndRemoveParameter(parameters, 
proxyAuthHost, String.class);
+Integer proxyAuthPort = getAndRemoveParameter(parameters, 
proxyAuthPort, Integer.class);
 
-if (proxyHost != null  proxyPort != null) {
-String proxyUsername = getAndRemoveParameter(parameters, 
proxyUsername, String.class);
-String proxyPassword = getAndRemoveParameter(parameters, 
proxyPassword, String.class);
-String proxyDomain = getAndRemoveParameter(parameters, 
proxyDomain, String.class);
-String proxyNtHost = getAndRemoveParameter(parameters, 
proxyNtHost, String.class);
+if (proxyAuthHost != null  proxyAuthPort != null) {
+String proxyAuthUsername = getAndRemoveParameter(parameters, 
proxyAuthUsername, String.class);
+String proxyAuthPassword = getAndRemoveParameter(parameters, 
proxyAuthPassword, String.class);
+String proxyAuthDomain = getAndRemoveParameter(parameters, 
proxyAuthDomain, String.class);
+String proxyAuthNtHost = getAndRemoveParameter(parameters, 
proxyAuthNtHost, String.class);
 
-if (proxyUsername != null  proxyPassword != null) {
+if (proxyAuthUsername != null  proxyAuthPassword != null) {
 return CompositeHttpConfigurer.combineConfigurers(
-configurer, new ProxyHttpClientConfigurer(proxyHost, 
proxyPort, proxyUsername, proxyPassword, proxyDomain, proxyNtHost));
+configurer, new ProxyHttpClientConfigurer(proxyAuthHost, 
proxyAuthPort, proxyAuthUsername, proxyAuthPassword, proxyAuthDomain, 
proxyAuthNtHost));
 } else {
-return CompositeHttpConfigurer.combineConfigurers(
-configurer, new ProxyHttpClientConfigurer(proxyHost, 
proxyPort));
+return CompositeHttpConfigurer.combineConfigurers(configurer, 
new