gump-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bode...@apache.org
Subject svn commit: r571417 - in /gump/mvnrepo/trunk/src/java/org/apache/gump/mvnrepo: Main.java resources/ArtifactsForm.java restlets/ArtifactsForm.java
Date Fri, 31 Aug 2007 10:23:41 GMT
Author: bodewig
Date: Fri Aug 31 03:23:40 2007
New Revision: 571417

URL: http://svn.apache.org/viewvc?rev=571417&view=rev
Log:
thinking a bit about it, the form is a resource

Added:
    gump/mvnrepo/trunk/src/java/org/apache/gump/mvnrepo/resources/ArtifactsForm.java
      - copied, changed from r571410, gump/mvnrepo/trunk/src/java/org/apache/gump/mvnrepo/restlets/ArtifactsForm.java
Removed:
    gump/mvnrepo/trunk/src/java/org/apache/gump/mvnrepo/restlets/ArtifactsForm.java
Modified:
    gump/mvnrepo/trunk/src/java/org/apache/gump/mvnrepo/Main.java

Modified: gump/mvnrepo/trunk/src/java/org/apache/gump/mvnrepo/Main.java
URL: http://svn.apache.org/viewvc/gump/mvnrepo/trunk/src/java/org/apache/gump/mvnrepo/Main.java?rev=571417&r1=571416&r2=571417&view=diff
==============================================================================
--- gump/mvnrepo/trunk/src/java/org/apache/gump/mvnrepo/Main.java (original)
+++ gump/mvnrepo/trunk/src/java/org/apache/gump/mvnrepo/Main.java Fri Aug 31 03:23:40 2007
@@ -18,11 +18,11 @@
 
 package org.apache.gump.mvnrepo;
 
+import org.apache.gump.mvnrepo.resources.ArtifactsForm;
 import org.apache.gump.mvnrepo.resources.Checksum;
 import org.apache.gump.mvnrepo.resources.Jar;
 import org.apache.gump.mvnrepo.resources.LogFile;
 import org.apache.gump.mvnrepo.restlets.ArtifactAdder;
-import org.apache.gump.mvnrepo.restlets.ArtifactsForm;
 import org.apache.gump.mvnrepo.restlets.Proxy;
 
 import org.restlet.Application;
@@ -72,9 +72,8 @@
 
                     // other resources
                     router.attach("/proxyLog.html", LogFile.class);
-
                     // simple HTML form to add new artifacts
-                    router.attach("/addartifact.html", new ArtifactsForm());
+                    router.attach("/addartifact.html", ArtifactsForm.class);
 
                     // Restlet that registers artifacts
                     Route r = router.attach("/addartifact",

Copied: gump/mvnrepo/trunk/src/java/org/apache/gump/mvnrepo/resources/ArtifactsForm.java (from
r571410, gump/mvnrepo/trunk/src/java/org/apache/gump/mvnrepo/restlets/ArtifactsForm.java)
URL: http://svn.apache.org/viewvc/gump/mvnrepo/trunk/src/java/org/apache/gump/mvnrepo/resources/ArtifactsForm.java?p2=gump/mvnrepo/trunk/src/java/org/apache/gump/mvnrepo/resources/ArtifactsForm.java&p1=gump/mvnrepo/trunk/src/java/org/apache/gump/mvnrepo/restlets/ArtifactsForm.java&r1=571410&r2=571417&rev=571417&view=diff
==============================================================================
--- gump/mvnrepo/trunk/src/java/org/apache/gump/mvnrepo/restlets/ArtifactsForm.java (original)
+++ gump/mvnrepo/trunk/src/java/org/apache/gump/mvnrepo/resources/ArtifactsForm.java Fri Aug
31 03:23:40 2007
@@ -16,19 +16,23 @@
  *
  */
 
-package org.apache.gump.mvnrepo.restlets;
+package org.apache.gump.mvnrepo.resources;
 
 import org.apache.gump.mvnrepo.Constants;
 
-import org.restlet.Restlet;
+import org.restlet.Context;
 import org.restlet.data.MediaType;
 import org.restlet.data.Request;
 import org.restlet.data.Response;
+import org.restlet.resource.Resource;
+import org.restlet.resource.Representation;
+import org.restlet.resource.StringRepresentation;
+import org.restlet.resource.Variant;
 
 /**
  * Too lazy to plug in a File system restlet or a view technology.
  */
-public class ArtifactsForm extends Restlet {
+public class ArtifactsForm extends Resource {
     private final String FORM = 
         "<html>"
         + "<body><form method=\"POST\" action=\"/addartifact\">"
@@ -39,8 +43,13 @@
         + "</form></body>"
         + "</html>";
 
+    public ArtifactsForm(Context ctx, Request request, Response response) {
+        super(ctx, request, response);
+        getVariants().add(new Variant(MediaType.TEXT_HTML));
+    }
+
     @Override
-    public void handle(Request request, Response response) {
-        response.setEntity(FORM, MediaType.TEXT_HTML);
+    public Representation getRepresentation(Variant v) {
+        return new StringRepresentation(FORM, MediaType.TEXT_HTML);
     }
 }



Mime
View raw message