You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by js...@apache.org on 2009/02/19 15:53:23 UTC

svn commit: r745889 - in /camel/trunk/components/camel-web/src/main/webapp: WEB-INF/ WEB-INF/jspf/ WEB-INF/tags/ WEB-INF/tags/api/ com/ com/sun/ com/sun/jersey/ com/sun/jersey/server/ com/sun/jersey/server/impl/ com/sun/jersey/server/impl/wadl/ com/sun...

Author: jstrachan
Date: Thu Feb 19 14:53:21 2009
New Revision: 745889

URL: http://svn.apache.org/viewvc?rev=745889&view=rev
Log:
CAMEL-1355 added self-documenting API pages available via /api - though this will only work with the 1.0.3-SNAPSHOT of Jersey once this patch is submitted https://jersey.dev.java.net/issues/show_bug.cgi?id=223

Added:
    camel/trunk/components/camel-web/src/main/webapp/WEB-INF/tags/
    camel/trunk/components/camel-web/src/main/webapp/WEB-INF/tags/api/
    camel/trunk/components/camel-web/src/main/webapp/WEB-INF/tags/api/resource.tag
    camel/trunk/components/camel-web/src/main/webapp/com/
    camel/trunk/components/camel-web/src/main/webapp/com/sun/
    camel/trunk/components/camel-web/src/main/webapp/com/sun/jersey/
    camel/trunk/components/camel-web/src/main/webapp/com/sun/jersey/server/
    camel/trunk/components/camel-web/src/main/webapp/com/sun/jersey/server/impl/
    camel/trunk/components/camel-web/src/main/webapp/com/sun/jersey/server/impl/wadl/
    camel/trunk/components/camel-web/src/main/webapp/com/sun/jersey/server/impl/wadl/WadlResource/
    camel/trunk/components/camel-web/src/main/webapp/com/sun/jersey/server/impl/wadl/WadlResource/index.jsp   (with props)
    camel/trunk/components/camel-web/src/main/webapp/com/sun/jersey/server/impl/wadl/WadlResourceResource/
    camel/trunk/components/camel-web/src/main/webapp/com/sun/jersey/server/impl/wadl/WadlResourceResource/index.jsp   (with props)
Modified:
    camel/trunk/components/camel-web/src/main/webapp/WEB-INF/jspf/header.jspf
    camel/trunk/components/camel-web/src/main/webapp/WEB-INF/web.xml

Modified: camel/trunk/components/camel-web/src/main/webapp/WEB-INF/jspf/header.jspf
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-web/src/main/webapp/WEB-INF/jspf/header.jspf?rev=745889&r1=745888&r2=745889&view=diff
==============================================================================
--- camel/trunk/components/camel-web/src/main/webapp/WEB-INF/jspf/header.jspf (original)
+++ camel/trunk/components/camel-web/src/main/webapp/WEB-INF/jspf/header.jspf Thu Feb 19 14:53:21 2009
@@ -20,3 +20,4 @@
 <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
 <%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>
 <%@ taglib prefix="decorator" uri="http://www.opensymphony.com/sitemesh/decorator" %>
+<%@ taglib prefix="api" tagdir="/WEB-INF/tags/api" %>

Added: camel/trunk/components/camel-web/src/main/webapp/WEB-INF/tags/api/resource.tag
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-web/src/main/webapp/WEB-INF/tags/api/resource.tag?rev=745889&view=auto
==============================================================================
--- camel/trunk/components/camel-web/src/main/webapp/WEB-INF/tags/api/resource.tag (added)
+++ camel/trunk/components/camel-web/src/main/webapp/WEB-INF/tags/api/resource.tag Thu Feb 19 14:53:21 2009
@@ -0,0 +1,61 @@
+<%--
+    Licensed to the Apache Software Foundation (ASF) under one or more
+    contributor license agreements.  See the NOTICE file distributed with
+    this work for additional information regarding copyright ownership.
+    The ASF licenses this file to You under the Apache License, Version 2.0
+    (the "License"); you may not use this file except in compliance with
+    the License.  You may obtain a copy of the License at
+
+    http://www.apache.org/licenses/LICENSE-2.0
+
+    Unless required by applicable law or agreed to in writing, software
+    distributed under the License is distributed on an "AS IS" BASIS,
+    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+    See the License for the specific language governing permissions and
+    limitations under the License.
+--%>
+<%@ attribute name="resource" type="com.sun.jersey.server.impl.wadl.WadlResourceResource" required="true"  %>
+<%@ tag import="java.util.Enumeration" %>
+<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
+
+
+<h2>Resource: ${resource.fullPath}</h2>
+
+<h3>Methods</h3>
+<table>
+  <tr>
+    <th>Name</th>
+    <th>ID</th>
+    <th>Request</th>
+    <th>Response</th>
+  </tr>
+<c:forEach var="method" items="${resource.methods}">
+<tr>
+  <td>${method.name}</td>
+  <td>${method.id}</td>
+  <td>
+    <c:forEach var="rep" items="${method.request.representation}">
+      <li>${rep.mediaType}</li>
+    </c:forEach>
+  </td>
+  <td>
+    <c:forEach var="rep" items="${method.response.representationOrFault}">
+      <li>${rep.value.mediaType}</li>
+    </c:forEach>
+  </td>
+</tr>
+</c:forEach>
+</table>
+
+<h3>Sub Resources</h3>
+<table>
+<c:forEach var="sub" items="${resource.children}">
+<tr>
+  <td><a href='<c:url value="/api/resources${resource.fullPathWithoutTrailingSlash}/${sub.path}"/>'>${sub.path}</a></td>
+</tr>
+</c:forEach>
+</table>
+
+
+
+

Modified: camel/trunk/components/camel-web/src/main/webapp/WEB-INF/web.xml
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-web/src/main/webapp/WEB-INF/web.xml?rev=745889&r1=745888&r2=745889&view=diff
==============================================================================
--- camel/trunk/components/camel-web/src/main/webapp/WEB-INF/web.xml (original)
+++ camel/trunk/components/camel-web/src/main/webapp/WEB-INF/web.xml Thu Feb 19 14:53:21 2009
@@ -63,6 +63,10 @@
       <param-name>com.sun.jersey.config.property.WebPageContentRegex</param-name>
       <param-value>/(images|css|js)/.*</param-value>
     </init-param>
+    <init-param>
+      <param-name>com.sun.jersey.config.property.WadlResourceUri</param-name>
+      <param-value>/api</param-value>
+    </init-param>
   </filter>
 
   <filter-mapping>

Added: camel/trunk/components/camel-web/src/main/webapp/com/sun/jersey/server/impl/wadl/WadlResource/index.jsp
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-web/src/main/webapp/com/sun/jersey/server/impl/wadl/WadlResource/index.jsp?rev=745889&view=auto
==============================================================================
--- camel/trunk/components/camel-web/src/main/webapp/com/sun/jersey/server/impl/wadl/WadlResource/index.jsp (added)
+++ camel/trunk/components/camel-web/src/main/webapp/com/sun/jersey/server/impl/wadl/WadlResource/index.jsp Thu Feb 19 14:53:21 2009
@@ -0,0 +1,25 @@
+<html>
+<head>
+  <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+  <title>Camel REST API</title>
+</head>
+<body>
+
+<h1>Camel REST API</h1>
+
+<p>
+  Camel supports a RESTful API for browsing and interacting with endpoints and routes to create and modify your
+  <a href="http://camel.apache.org/enterprise-integration-patterns.html">Enterprise Integration Patterns</a>.
+</p>
+
+<p>
+  Most resources are available at the very least as HTML, XML and JSON formats with some other formats being available.
+  Your web browser will serve up the HTML representation by default unless you specify the HTTP <code>Accept</code>
+  header
+  with <code>text/xml</code> or <code>application/xml</code> for XML and <code>application/json</code> for JSON.
+</p>
+
+<api:resource resource="${it.rootResource}"/>
+
+</body>
+</html>

Propchange: camel/trunk/components/camel-web/src/main/webapp/com/sun/jersey/server/impl/wadl/WadlResource/index.jsp
------------------------------------------------------------------------------
    svn:eol-style = native

Added: camel/trunk/components/camel-web/src/main/webapp/com/sun/jersey/server/impl/wadl/WadlResourceResource/index.jsp
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-web/src/main/webapp/com/sun/jersey/server/impl/wadl/WadlResourceResource/index.jsp?rev=745889&view=auto
==============================================================================
--- camel/trunk/components/camel-web/src/main/webapp/com/sun/jersey/server/impl/wadl/WadlResourceResource/index.jsp (added)
+++ camel/trunk/components/camel-web/src/main/webapp/com/sun/jersey/server/impl/wadl/WadlResourceResource/index.jsp Thu Feb 19 14:53:21 2009
@@ -0,0 +1,12 @@
+<html>
+<head>
+  <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+  <title>Camel Resource ${it.fullPath}</title>
+</head>
+<body>
+
+<api:resource resource="${it}"/>
+
+
+</body>
+</html>

Propchange: camel/trunk/components/camel-web/src/main/webapp/com/sun/jersey/server/impl/wadl/WadlResourceResource/index.jsp
------------------------------------------------------------------------------
    svn:eol-style = native