You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by bu...@apache.org on 2014/12/24 14:18:42 UTC
svn commit: r933865 - in /websites/production/camel/content:
cache/main.pageCache swagger.html
Author: buildbot
Date: Wed Dec 24 13:18:42 2014
New Revision: 933865
Log:
Production update by buildbot for camel
Modified:
websites/production/camel/content/cache/main.pageCache
websites/production/camel/content/swagger.html
Modified: websites/production/camel/content/cache/main.pageCache
==============================================================================
Binary files - no diff available.
Modified: websites/production/camel/content/swagger.html
==============================================================================
--- websites/production/camel/content/swagger.html (original)
+++ websites/production/camel/content/swagger.html Wed Dec 24 13:18:42 2014
@@ -116,6 +116,7 @@
<servlet-name>ApiDeclarationServlet</servlet-name>
<servlet-class>org.apache.camel.component.swagger.DefaultCamelSwaggerServlet</servlet-class>
+ <!-- Camel 2.14.x -->
<init-param>
<param-name>base.path</param-name>
<param-value>http://localhost:8080/rest</param-value>
@@ -124,6 +125,22 @@
<param-name>api.path</param-name>
<param-value>http://localhost:8080/api-docs</param-value>
</init-param>
+Â
+ <!-- Camel 2.15 onwards -->
+ <init-param>
+ <!-- we specify the base.path using relative notation, that means the actual path will be calculated at runtime as
+ http://server:port/contextpath/rest -->
+ <param-name>base.path</param-name>
+ <param-value>rest</param-value>
+ </init-param>
+ <init-param>
+ <!-- we specify the api.path using relative notation, that means the actual path will be calculated at runtime as
+ http://server:port/contextpath/api-docs -->
+ <param-name>api.path</param-name>
+ <param-value>api-docs</param-value>
+ </init-param>
+
+
<init-param>
<param-name>api.version</param-name>
<param-value>1.2.3</param-value>
@@ -144,7 +161,11 @@
<servlet-name>ApiDeclarationServlet</servlet-name>
<url-pattern>/api-docs/*</url-pattern>
</servlet-mapping>]]></script>
-</div></div><h3 id="Swagger-Options">Options</h3><p>The <code>org.apache.camel.component.swagger.RestSwaggerApiDeclarationServlet </code>and <code>org.apache.camel.component.swagger.DefaultCamelSwaggerServlet</code> supports the following options which can be configured as context-param in the web.xml file.</p><div class="confluenceTableSmall"><div class="table-wrap"><table class="confluenceTable"><tbody><tr><th colspan="1" rowspan="1" class="confluenceTh"><p>Option</p></th><th colspan="1" rowspan="1" class="confluenceTh"><p>Type</p></th><th colspan="1" rowspan="1" class="confluenceTh"><p>Description</p></th></tr><tr><td colspan="1" rowspan="1" class="confluenceTd">cors</td><td colspan="1" rowspan="1" class="confluenceTd">Boolean</td><td colspan="1" rowspan="1" class="confluenceTd">Whether to enable CORS. Notice this only enables CORS for the api browser, and not the actual access to the REST services. Is default false.<br clear="none">Instead of using this option is recom
mended to use the CorsFilte, see further below.</td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd">swagger.version</td><td colspan="1" rowspan="1" class="confluenceTd">String</td><td colspan="1" rowspan="1" class="confluenceTd">Swagger spec version. Is default 1.2.</td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd">base.path<p> </p></td><td colspan="1" rowspan="1" class="confluenceTd">String</td><td colspan="1" rowspan="1" class="confluenceTd"><strong>Required</strong>: To setup the base path where the REST services is available</td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd">api.version</td><td colspan="1" rowspan="1" class="confluenceTd">String</td><td colspan="1" rowspan="1" class="confluenceTd">The version of the api. Is default 0.0.0.</td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd">api.path</td><td colspan="1" rowspan="1" class="confluenceTd">String</td><td colspan="1" rowspan="1" class="confluenceTd"><span>To setup the pat
h where the API is available (eg /api-docs)</span></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd">api.title</td><td colspan="1" rowspan="1" class="confluenceTd">String</td><td colspan="1" rowspan="1" class="confluenceTd"><strong>Required.</strong><span> The title of the application.</span></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd">api.description</td><td colspan="1" rowspan="1" class="confluenceTd">String</td><td colspan="1" rowspan="1" class="confluenceTd"><strong>Required.</strong><span> A short description of the application.</span></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd">api.<span>termsOfServiceUrl</span></td><td colspan="1" rowspan="1" class="confluenceTd">String</td><td colspan="1" rowspan="1" class="confluenceTd"><span>A URL to the Terms of Service of the API.</span></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd">api.contact</td><td colspan="1" rowspan="1" class="confluenceTd">String</td><td col
span="1" rowspan="1" class="confluenceTd"><span>An email to be used for API-related correspondence.</span></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd">api.license</td><td colspan="1" rowspan="1" class="confluenceTd">String</td><td colspan="1" rowspan="1" class="confluenceTd"><span>The license name used for the API.</span></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd">api.licenseUrl</td><td colspan="1" rowspan="1" class="confluenceTd">String</td><td colspan="1" rowspan="1" class="confluenceTd"><span>A URL to the license used for the API.</span></td></tr></tbody></table></div></div><h3 id="Swagger-CorsFilter">CorsFilter</h3><p>If you use the swagger ui to view the REST api then you likely need to enable support for CORS. This is needed if the swagger ui is hosted and running on another hostname/port than the actual REST apis. When doing this the swagger ui needs to be allowed to access the REST resources across the origin (CORS). The CorsFilter adds t
he necessary HTTP headers to enable CORS.</p><p>To use CORS adds the following filter <code>org.apache.camel.component.swagger.RestSwaggerCorsFilter</code> to your web.xml.</p><div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl">
+</div></div><h3 id="Swagger-Options">Options</h3><p>The <code>org.apache.camel.component.swagger.RestSwaggerApiDeclarationServlet </code>and <code>org.apache.camel.component.swagger.DefaultCamelSwaggerServlet</code> supports the following options which can be configured as context-param in the web.xml file.</p><div class="confluenceTableSmall"><div class="table-wrap"><table class="confluenceTable"><tbody><tr><th colspan="1" rowspan="1" class="confluenceTh"><p>Option</p></th><th colspan="1" rowspan="1" class="confluenceTh"><p>Type</p></th><th colspan="1" rowspan="1" class="confluenceTh"><p>Description</p></th></tr><tr><td colspan="1" rowspan="1" class="confluenceTd">cors</td><td colspan="1" rowspan="1" class="confluenceTd">Boolean</td><td colspan="1" rowspan="1" class="confluenceTd">Whether to enable CORS. Notice this only enables CORS for the api browser, and not the actual access to the REST services. Is default false.<br clear="none">Instead of using this option is recom
mended to use the CorsFilte, see further below.</td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd">swagger.version</td><td colspan="1" rowspan="1" class="confluenceTd">String</td><td colspan="1" rowspan="1" class="confluenceTd">Swagger spec version. Is default 1.2.</td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd">base.path<p> </p></td><td colspan="1" rowspan="1" class="confluenceTd">String</td><td colspan="1" rowspan="1" class="confluenceTd"><p><strong>Required</strong>: To setup the base path where the REST services is available. Using Camel 2.14.x this path must be the absolute path to the services. From Camel 2.15 onwards you can use a relative path instead (eg do not start with http/https) and camel-swagger will calculate the absolute base path at runtime, which will be</p><div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl">
+<script class="theme: Default; brush: java; gutter: false" type="syntaxhighlighter"><![CDATA[protocol://host:port/context-path/base.path]]></script>
+</div></div><p>So using relative paths is much easier. See above for an example.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd">api.version</td><td colspan="1" rowspan="1" class="confluenceTd">String</td><td colspan="1" rowspan="1" class="confluenceTd">The version of the api. Is default 0.0.0.</td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd">api.path</td><td colspan="1" rowspan="1" class="confluenceTd">String</td><td colspan="1" rowspan="1" class="confluenceTd"><p><span>To setup the path where the API is available (eg /api-docs). <span>Using Camel 2.14.x this path must be the absolute path to the services. From Camel 2.15 onwards you can use a relative path instead (eg do not start with http/https) and camel-swagger will calculate the absolute base path at runtime, which will be </span></span></p><div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl">
+<script class="theme: Default; brush: java; gutter: false" type="syntaxhighlighter"><![CDATA[protocol://host:port/context-path/api.path]]></script>
+</div></div><p><span><span>So using relative paths is much easier. See above for an example.</span></span></p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd">api.title</td><td colspan="1" rowspan="1" class="confluenceTd">String</td><td colspan="1" rowspan="1" class="confluenceTd"><strong>Required.</strong><span> The title of the application.</span></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd">api.description</td><td colspan="1" rowspan="1" class="confluenceTd">String</td><td colspan="1" rowspan="1" class="confluenceTd"><strong>Required.</strong><span> A short description of the application.</span></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd">api.<span>termsOfServiceUrl</span></td><td colspan="1" rowspan="1" class="confluenceTd">String</td><td colspan="1" rowspan="1" class="confluenceTd"><span>A URL to the Terms of Service of the API.</span></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd">api.contact</td><td col
span="1" rowspan="1" class="confluenceTd">String</td><td colspan="1" rowspan="1" class="confluenceTd"><span>An email to be used for API-related correspondence.</span></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd">api.license</td><td colspan="1" rowspan="1" class="confluenceTd">String</td><td colspan="1" rowspan="1" class="confluenceTd"><span>The license name used for the API.</span></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd">api.licenseUrl</td><td colspan="1" rowspan="1" class="confluenceTd">String</td><td colspan="1" rowspan="1" class="confluenceTd"><span>A URL to the license used for the API.</span></td></tr></tbody></table></div></div><h3 id="Swagger-CorsFilter">CorsFilter</h3><p>If you use the swagger ui to view the REST api then you likely need to enable support for CORS. This is needed if the swagger ui is hosted and running on another hostname/port than the actual REST apis. When doing this the swagger ui needs to be allowed to access the RE
ST resources across the origin (CORS). The CorsFilter adds the necessary HTTP headers to enable CORS.</p><p>To use CORS adds the following filter <code>org.apache.camel.component.swagger.RestSwaggerCorsFilter</code> to your web.xml.</p><div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl">
<script class="theme: Default; brush: java; gutter: false" type="syntaxhighlighter"><![CDATA[ <!-- enable CORS filter so people can use swagger ui to browse and test the apis -->
<filter>
<filter-name>RestSwaggerCorsFilter</filter-name>
@@ -157,7 +178,7 @@
<url-pattern>/api-docs/*</url-pattern>
<url-pattern>/rest/*</url-pattern>
</filter-mapping>]]></script>
-</div></div><p>The CorsFilter sets the following headers for all requests</p><ul><li>Access-Control-Allow-Origin = *</li><li>Access-Control-Allow-Methods = GET, HEAD, POST, PUT, DELETE, TRACE, OPTIONS, CONNECT, PATCH</li><li>Access-Control-Max-Age = 3600</li><li>Access-Control-Allow-Headers = Origin, Accept, X-Requested-With, Content-Type, Access-Control-Request-Method, Access-Control-Request-Headers</li></ul><p><span style="color: rgb(52,48,45);">Notice this is a very simple CORS filter. You may need to use a more sophisticated filter to set the header values differently for a given client. Or block certain clients etc.</span></p><h3 id="Swagger-Examples">Examples</h3><p>In the Apache Camel distribution we ship the <code>camel-example-servlet-rest-tomcat</code> which demonstrates using this Swagger component.</p></div>
+</div></div><p>The CorsFilter sets the following headers for all requests</p><ul><li>Access-Control-Allow-Origin = *</li><li>Access-Control-Allow-Methods = GET, HEAD, POST, PUT, DELETE, TRACE, OPTIONS, CONNECT, PATCH</li><li>Access-Control-Max-Age = 3600</li><li>Access-Control-Allow-Headers = Origin, Accept, X-Requested-With, Content-Type, Access-Control-Request-Method, Access-Control-Request-Headers</li></ul><p><span style="color: rgb(52,48,45);">Notice this is a very simple CORS filter. You may need to use a more sophisticated filter to set the header values differently for a given client. Or block certain clients etc.</span></p><h3 id="Swagger-Examples">Examples</h3><p>In the Apache Camel distribution we ship the <code>camel-example-servlet-rest-tomcat</code> which demonstrates using this Swagger component.</p><div><span style="white-space: pre-wrap;"><br clear="none"></span></div></div>
</td>
<td valign="top">
<div class="navigation">