You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by Tapdur <ta...@gmail.com> on 2010/03/27 00:53:16 UTC

camel/restlet 1 endpoint for any path without list uris

Hi,

Is there a trick to specify one camel/restlet entrypoint for any http path
and use a eip to fork on specific path like this , without any list uri ? 

  		
from("restlet:http://"+IgcProperties.get("igc.greeting.host")+":"+IgcProperties.get("igc.greeting.port")+"?restletMethods=post,get")
	   			.choice()
   				
.when(header("HTTP_PATH").isEqualTo("/greeting")).to("greetingService")
  				.otherwise().throwException(new Exception()); 	


this code generate http error 404

Thx
Bruno


-- 
View this message in context: http://old.nabble.com/camel-restlet-1-endpoint-for-any-path-without-list-uris-tp28049159p28049159.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: camel/restlet 1 endpoint for any path without list uris

Posted by Willem Jiang <wi...@gmail.com>.
Oh, my bad, you need to add this option (matchOnUriPrefix=true) on your 
camel-jetty endpoint.
The URI should be "jetty://http://0.0.0.0:9080/?matchOnUriPrefix=true", 
you can find more information about camel-jetty component here[1]

[1]http://camel.apache.org/jetty.html

Willem

Tapdur wrote:
> Strange behavior
> 
> 1/ when i use the url from my browser : httpp://127.0.0.0:9080/ -> it
> display Greeting (the choice/when/simple return true but the path doens't
> match with the url
> 
> 
> 2/ when i use the url from my browser : httpp://127.0.0.0:9080/greeting ->
> it display 404 not found (the jetty server don't handle the url
> 
> why ?
> 
> Bruno
> 
> 
> 
> here is my spring dsl
>       <route>
>             <camel:from uri="jetty://http://0.0.0.0:9080/"/>
>             <!-- simulate a little processing time -->
>             
> 	         <camel:choice>
> 	            <camel:when>
> 	                <camel:simple>$CamelHttpPath = /greeting</camel:simple>
>            				 <camel:transform>
>                 <!-- manipulate the body so we can see we have processed the
> data -->
>                			 <camel:simple>Greeting ${in.body}</camel:simple>
>            				 </camel:transform>
> 	            </camel:when>
> 	            <camel:otherwise>
>           				 <camel:transform>
>                 <!-- manipulate the body so we can see we have processed the
> data -->
>                			 <camel:simple>Igc Service not supported
> ${in.body}</camel:simple>
>            				 </camel:transform>
> 
> 	            </camel:otherwise>
> 	        </camel:choice>
>            
>         </route>
> 
> 
> 
> 
> 
> 
> willem.jiang wrote:
>> Hi,
>>
>> I don't think the camel-restlet can meet your requirement.
>> But with the help of camel-jetty component, you can implement it easily.
>>
>> from("jetty:http://"+IgcProperties.get("igc.greeting.host")+":"+IgcProperties.get("igc.greeting.port"))
>> .choice()
>>   .when(header("HTTP_PATH").isEqualTo("/greeting")).to("greetingService")
>>   .otherwise().throwException(new Exception());
>>
>> Willem
>>
>> Tapdur wrote:
>>> Hi,
>>>
>>> Is there a trick to specify one camel/restlet entrypoint for any http
>>> path
>>> and use a eip to fork on specific path like this , without any list uri ? 
>>>
>>>   		
>>> from("restlet:http://"+IgcProperties.get("igc.greeting.host")+":"+IgcProperties.get("igc.greeting.port")+"?restletMethods=post,get")
>>> 	   			.choice()
>>>    				
>>> .when(header("HTTP_PATH").isEqualTo("/greeting")).to("greetingService")
>>>   				.otherwise().throwException(new Exception()); 	
>>>
>>>
>>> this code generate http error 404
>>>
>>> Thx
>>> Bruno
>>>
>>>
>>
>>
> 


Re: camel/restlet 1 endpoint for any path without list uris

Posted by Tapdur <ta...@gmail.com>.
Strange behavior

1/ when i use the url from my browser : httpp://127.0.0.0:9080/ -> it
display Greeting (the choice/when/simple return true but the path doens't
match with the url


2/ when i use the url from my browser : httpp://127.0.0.0:9080/greeting ->
it display 404 not found (the jetty server don't handle the url

why ?

Bruno



here is my spring dsl
      <route>
            <camel:from uri="jetty://http://0.0.0.0:9080/"/>
            <!-- simulate a little processing time -->
            
	         <camel:choice>
	            <camel:when>
	                <camel:simple>$CamelHttpPath = /greeting</camel:simple>
           				 <camel:transform>
                <!-- manipulate the body so we can see we have processed the
data -->
               			 <camel:simple>Greeting ${in.body}</camel:simple>
           				 </camel:transform>
	            </camel:when>
	            <camel:otherwise>
          				 <camel:transform>
                <!-- manipulate the body so we can see we have processed the
data -->
               			 <camel:simple>Igc Service not supported
${in.body}</camel:simple>
           				 </camel:transform>

	            </camel:otherwise>
	        </camel:choice>
           
        </route>






willem.jiang wrote:
> 
> Hi,
> 
> I don't think the camel-restlet can meet your requirement.
> But with the help of camel-jetty component, you can implement it easily.
> 
> from("jetty:http://"+IgcProperties.get("igc.greeting.host")+":"+IgcProperties.get("igc.greeting.port"))
> .choice()
>   .when(header("HTTP_PATH").isEqualTo("/greeting")).to("greetingService")
>   .otherwise().throwException(new Exception());
> 
> Willem
> 
> Tapdur wrote:
>> Hi,
>> 
>> Is there a trick to specify one camel/restlet entrypoint for any http
>> path
>> and use a eip to fork on specific path like this , without any list uri ? 
>> 
>>   		
>> from("restlet:http://"+IgcProperties.get("igc.greeting.host")+":"+IgcProperties.get("igc.greeting.port")+"?restletMethods=post,get")
>> 	   			.choice()
>>    				
>> .when(header("HTTP_PATH").isEqualTo("/greeting")).to("greetingService")
>>   				.otherwise().throwException(new Exception()); 	
>> 
>> 
>> this code generate http error 404
>> 
>> Thx
>> Bruno
>> 
>> 
> 
> 
> 

-- 
View this message in context: http://old.nabble.com/camel-restlet-1-endpoint-for-any-path-without-list-uris-tp28049159p28068882.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: camel/restlet 1 endpoint for any path without list uris

Posted by Willem Jiang <wi...@gmail.com>.
No, you don't need that, as camel-jetty will setup itself with the URI 
of the camel-jetty endpoint.

Willem

Tapdur wrote:
> Hi willem
> Thx for your answer, howerver, i launch my cammel route in a web-app /
> spring server, is there a web.xml configuration for camel-jetty ?
> 
> i have error 404 with no camel trace.
> 
> Regards
> Bruno
> 
> 
> 
> willem.jiang wrote:
>> Hi,
>>
>> I don't think the camel-restlet can meet your requirement.
>> But with the help of camel-jetty component, you can implement it easily.
>>
>> from("jetty:http://"+IgcProperties.get("igc.greeting.host")+":"+IgcProperties.get("igc.greeting.port"))
>> .choice()
>>   .when(header("HTTP_PATH").isEqualTo("/greeting")).to("greetingService")
>>   .otherwise().throwException(new Exception());
>>
>> Willem
>>
>> Tapdur wrote:
>>> Hi,
>>>
>>> Is there a trick to specify one camel/restlet entrypoint for any http
>>> path
>>> and use a eip to fork on specific path like this , without any list uri ? 
>>>
>>>   		
>>> from("restlet:http://"+IgcProperties.get("igc.greeting.host")+":"+IgcProperties.get("igc.greeting.port")+"?restletMethods=post,get")
>>> 	   			.choice()
>>>    				
>>> .when(header("HTTP_PATH").isEqualTo("/greeting")).to("greetingService")
>>>   				.otherwise().throwException(new Exception()); 	
>>>
>>>
>>> this code generate http error 404
>>>
>>> Thx
>>> Bruno
>>>
>>>
>>
>>
> 


Re: camel/restlet 1 endpoint for any path without list uris

Posted by Tapdur <ta...@gmail.com>.
Hi willem
Thx for your answer, howerver, i launch my cammel route in a web-app /
spring server, is there a web.xml configuration for camel-jetty ?

i have error 404 with no camel trace.

Regards
Bruno



willem.jiang wrote:
> 
> Hi,
> 
> I don't think the camel-restlet can meet your requirement.
> But with the help of camel-jetty component, you can implement it easily.
> 
> from("jetty:http://"+IgcProperties.get("igc.greeting.host")+":"+IgcProperties.get("igc.greeting.port"))
> .choice()
>   .when(header("HTTP_PATH").isEqualTo("/greeting")).to("greetingService")
>   .otherwise().throwException(new Exception());
> 
> Willem
> 
> Tapdur wrote:
>> Hi,
>> 
>> Is there a trick to specify one camel/restlet entrypoint for any http
>> path
>> and use a eip to fork on specific path like this , without any list uri ? 
>> 
>>   		
>> from("restlet:http://"+IgcProperties.get("igc.greeting.host")+":"+IgcProperties.get("igc.greeting.port")+"?restletMethods=post,get")
>> 	   			.choice()
>>    				
>> .when(header("HTTP_PATH").isEqualTo("/greeting")).to("greetingService")
>>   				.otherwise().throwException(new Exception()); 	
>> 
>> 
>> this code generate http error 404
>> 
>> Thx
>> Bruno
>> 
>> 
> 
> 
> 

-- 
View this message in context: http://old.nabble.com/camel-restlet-1-endpoint-for-any-path-without-list-uris-tp28049159p28067729.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: camel/restlet 1 endpoint for any path without list uris

Posted by Willem Jiang <wi...@gmail.com>.
Hi,

I don't think the camel-restlet can meet your requirement.
But with the help of camel-jetty component, you can implement it easily.

from("jetty:http://"+IgcProperties.get("igc.greeting.host")+":"+IgcProperties.get("igc.greeting.port"))
.choice()
  .when(header("HTTP_PATH").isEqualTo("/greeting")).to("greetingService")
  .otherwise().throwException(new Exception());

Willem

Tapdur wrote:
> Hi,
> 
> Is there a trick to specify one camel/restlet entrypoint for any http path
> and use a eip to fork on specific path like this , without any list uri ? 
> 
>   		
> from("restlet:http://"+IgcProperties.get("igc.greeting.host")+":"+IgcProperties.get("igc.greeting.port")+"?restletMethods=post,get")
> 	   			.choice()
>    				
> .when(header("HTTP_PATH").isEqualTo("/greeting")).to("greetingService")
>   				.otherwise().throwException(new Exception()); 	
> 
> 
> this code generate http error 404
> 
> Thx
> Bruno
> 
>