Author: jstrachan
Date: Thu Sep 11 07:27:11 2008
New Revision: 694276
URL: http://svn.apache.org/viewvc?rev=694276&view=rev
Log:
added basic HTML and XML/JSON rendering
Added:
activemq/camel/trunk/components/camel-rest/src/main/webapp/org/apache/camel/rest/model/
activemq/camel/trunk/components/camel-rest/src/main/webapp/org/apache/camel/rest/model/Endpoints/
activemq/camel/trunk/components/camel-rest/src/main/webapp/org/apache/camel/rest/model/Endpoints/index.jsp
(with props)
Modified:
activemq/camel/trunk/components/camel-rest/src/main/java/org/apache/camel/rest/model/EndpointLink.java
activemq/camel/trunk/components/camel-rest/src/main/java/org/apache/camel/rest/resources/CamelContextResource.java
activemq/camel/trunk/components/camel-rest/src/main/webapp/org/apache/camel/rest/resources/CamelContextResource/index.jsp
Modified:
activemq/camel/trunk/components/camel-rest/src/main/java/org/apache/camel/rest/model/EndpointLink.java
URL:
http://svn.apache.org/viewvc/activemq/camel/trunk/components/camel-rest/src/main/java/org/apache/camel/rest/model/EndpointLink.java?rev=694276&r1=694275&r2=694276&view=diff
==============================================================================
---
activemq/camel/trunk/components/camel-rest/src/main/java/org/apache/camel/rest/model/EndpointLink.java
(original)
+++
activemq/camel/trunk/components/camel-rest/src/main/java/org/apache/camel/rest/model/EndpointLink.java
Thu Sep 11 07:27:11 2008
@@ -71,6 +71,6 @@
protected String createHref(String uri) {
// TODO how to encode as a href?
- return "/endpoint/" + uri;
+ return "/endpoints/" + uri;
}
}
Modified:
activemq/camel/trunk/components/camel-rest/src/main/java/org/apache/camel/rest/resources/CamelContextResource.java
URL:
http://svn.apache.org/viewvc/activemq/camel/trunk/components/camel-rest/src/main/java/org/apache/camel/rest/resources/CamelContextResource.java?rev=694276&r1=694275&r2=694276&view=diff
==============================================================================
---
activemq/camel/trunk/components/camel-rest/src/main/java/org/apache/camel/rest/resources/CamelContextResource.java
(original)
+++
activemq/camel/trunk/components/camel-rest/src/main/java/org/apache/camel/rest/resources/CamelContextResource.java
Thu Sep 11 07:27:11 2008
@@ -25,10 +25,10 @@
import org.apache.camel.model.RoutesType;
import org.apache.camel.rest.model.Endpoints;
+import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.PathParam;
import javax.ws.rs.Produces;
-import javax.ws.rs.GET;
import java.util.List;
/**
@@ -38,6 +38,7 @@
*/
@Path("/")
@Singleton
[EMAIL PROTECTED]({"text/html", "application/json", "application/xml"})
public class CamelContextResource {
private final CamelContext camelContext;
@@ -54,27 +55,20 @@
return camelContext.getName();
}
- /*
- @GET
- @Produces("text/plain")
- public String getValue() {
- return "Has CamelContext: " + camelContext;
- }
-
- */
/**
* Returns a list of endpoints available in this context
*
* @return
*/
- @GET
@Path("endpoints")
- @Produces({"application/json", "application/xml"})
public Endpoints getEndpoints() {
return new Endpoints(camelContext);
}
- @Path("endpoint/{id}")
+ /**
+ * Looks up an individual endpoint
+ */
+ @Path("endpoints/{id}")
public EndpointResource getEndpoint(@PathParam("id") String id) {
// TODO lets assume the ID is the endpoint
Endpoint endpoint = getCamelContext().getEndpoint(id);
@@ -92,7 +86,6 @@
*/
@GET
@Path("routes")
- @Produces({"application/json", "application/xml"})
public RoutesType getRouteDefinitions() {
RoutesType answer = new RoutesType();
if (camelContext != null) {
Added:
activemq/camel/trunk/components/camel-rest/src/main/webapp/org/apache/camel/rest/model/Endpoints/index.jsp
URL:
http://svn.apache.org/viewvc/activemq/camel/trunk/components/camel-rest/src/main/webapp/org/apache/camel/rest/model/Endpoints/index.jsp?rev=694276&view=auto
==============================================================================
---
activemq/camel/trunk/components/camel-rest/src/main/webapp/org/apache/camel/rest/model/Endpoints/index.jsp
(added)
+++
activemq/camel/trunk/components/camel-rest/src/main/webapp/org/apache/camel/rest/model/Endpoints/index.jsp
Thu Sep 11 07:27:11 2008
@@ -0,0 +1,23 @@
+<[EMAIL PROTECTED] contentType="text/html" %>
+<[EMAIL PROTECTED] pageEncoding="UTF-8" %>
+<[EMAIL PROTECTED] uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
+
+<html>
+<head>
+ <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+ <title>Endpoints</title>
+</head>
+<body>
+
+<h2>Endpoints</h2>
+
+<ul>
+ <c:forEach var="i" items="${it.endpoints}">
+ <li><a href="${i.href}">${i.uri}</a>
+ </c:forEach>
+</ul>
+
+
+</body>
+</html>
Propchange:
activemq/camel/trunk/components/camel-rest/src/main/webapp/org/apache/camel/rest/model/Endpoints/index.jsp
------------------------------------------------------------------------------
svn:eol-style = native
Modified:
activemq/camel/trunk/components/camel-rest/src/main/webapp/org/apache/camel/rest/resources/CamelContextResource/index.jsp
URL:
http://svn.apache.org/viewvc/activemq/camel/trunk/components/camel-rest/src/main/webapp/org/apache/camel/rest/resources/CamelContextResource/index.jsp?rev=694276&r1=694275&r2=694276&view=diff
==============================================================================
---
activemq/camel/trunk/components/camel-rest/src/main/webapp/org/apache/camel/rest/resources/CamelContextResource/index.jsp
(original)
+++
activemq/camel/trunk/components/camel-rest/src/main/webapp/org/apache/camel/rest/resources/CamelContextResource/index.jsp
Thu Sep 11 07:27:11 2008
@@ -12,14 +12,12 @@
<h1>Context: ${it.name}</h1>
-<h2>Endpoints</h2>
<ul>
- <c:forEach var="i" items="${it.endpoints.endpoints}">
- <li><a href="${i.href}">${i.uri}</a>
- </c:forEach>
+ <li><a href="endpoints">Endpoints</a></li>
+ <li><a href="routes">Routes</a></li>
+ <li><a href="application.wadl">WADL</a></li>
</ul>
-
</body>
</html>