THIS IS A TEST INSTANCE. ALL YOUR CHANGES WILL BE LOST!!!!
Wiki Markup |
---|
h2. UrlRewrite Component |
...
*Available as of Camel |
...
2.11*
The {{camel-urlrewrite}} component allows to plugin url rewrite functionality to [HTTP], [HTTP4], [Jetty], or [AHC] components. This component integrates the [UrlRewriteFilter|http://code.google.com/p/urlrewritefilter/] project with Apache Camel. This allows you to use the capabilities from the url rewrite project with your Camel routes.
This component *requires* that your Camel routes starts from a servlet based endpoint such as [Jetty] or [Servlet].
h3. Options
The {{camel-urlrewrite}} component offers the following options
{div:class=confluenceTableSmall}
|| Name || Default Value || Description ||
| {{conf}} | {{null}} | To use a custom {{org.tuckey.web.filters.urlrewrite.Conf}} as the configuration for the url rewrite filter. |
| {{configFile}} | {{null}} | Refers to a file name to load as the configuration file. The file should be XML file. |
| {{modRewriteConfFile}} | {{null}} | Refers to a file name to load as the mod based configuration file. This file should be a plain text file. |
| {{modRewriteConfText}} | {{null}} | Is used to quickly configure a mod based configuration without using a file. |
| {{useQueryString}} | {{false}} | Whether to use query strings in the url rewrite rules. |
| {{useContext}} | {{false}} | Whether to include context-path or not in the matching. Will be default remove the context-path. |
| {{defaultMatchType}} | {{"regex"}} | Which match type to use. Can be either "wildcard" or "regex". |
| {{decodeUsing}} | {{null}} | To use a specific encoding such as "utf-8" or "iso-8859-1". |
{div}
h3. Usage
You setup the url rewrite as a bean such as shown below:
TODO: java
And in XML DSL you can do:
TODO: xml
In the Camel routes
TODO: route
h3. Writing custom url rewriters
You can implement your custom url rewriters by implementing either of the following interfaces:
- {{org.apache.camel.component.http.UrlRewrite}}
- {{org.apache.camel.component.http.HttpServletUrlRewrite}}
The former is a simple and generic interface, which is not dependent on the Servlet API.
The later is servlet based which requires the Camel route to start from a servlet based component such as [Jetty] or [Servlet]. The servlet based is more feature rich and that's the API we use to integrate with the [UrlRewriteFilter|http://code.google.com/p/urlrewritefilter/] project in this {{camel-urlrewrite}} component.
{include:Endpoint See Also}
- [Jetty]
- [Http4]
- [Http]
- [AHC] |