Index: trunk/src/org/openstreetmap/josm/data/osm/Changeset.java
===================================================================
--- trunk/src/org/openstreetmap/josm/data/osm/Changeset.java	(revision 625)
+++ trunk/src/org/openstreetmap/josm/data/osm/Changeset.java	(revision 625)
@@ -0,0 +1,121 @@
+// License: GPL. Copyright 2007 by Martijn van Oosterhout and others
+package org.openstreetmap.josm.data.osm;
+
+import org.openstreetmap.josm.Main;
+import org.openstreetmap.josm.io.XmlWriter;
+import org.openstreetmap.josm.io.XmlWriter.OsmWriterInterface;
+import java.io.PrintWriter;
+import java.util.Map;
+import java.util.Map.Entry;
+import java.util.HashMap;
+import java.util.Collections;
+import java.util.Collection;
+
+
+
+/**
+ * Represents a single changeset in JOSM. For now its only used during
+ * upload but in the future we may do more.
+ *
+ */
+public final class Changeset /*extends OsmPrimitive*/ implements OsmWriterInterface {
+	/**
+	 * The key/value list for this primitive.
+	 */
+	public Map<String, String> keys;
+
+	public long id = 0;
+	
+	/** 
+	 * User that created thos changeset, as specified by the server.
+	 * Never changed by JOSM.
+	 */
+	public User user = null;
+	
+	/**
+	 * Time of last modification to this object. This is not set by JOSM but
+	 * read from the server and delivered back to the server unmodified. 
+	 */
+	public String end_timestamp = null;
+	
+	/**
+	 * Time of first modification to this object. This is not set by JOSM but
+	 * read from the server and delivered back to the server unmodified.
+	 */
+	public String start_timestamp = null;
+
+        private void addTags(PrintWriter out) {
+                if (this.keys != null) {
+                        for (Entry<String, String> e : this.keys.entrySet())
+                                out.println("    <tag k='"+ XmlWriter.encode(e.getKey()) +
+                                                "' v='"+XmlWriter.encode(e.getValue())+ "' />");
+                }
+        }
+
+	public final void header(PrintWriter out) {
+        	out.print("<osm version='");
+                out.print(Main.pref.get("osm-server.version", "0.6"));
+                out.println("' generator='JOSM'>");
+	}
+	public final void write(PrintWriter out) {
+		out.print("  <changeset");
+		if (id != 0)
+			out.print(" id="+id);
+		if (this.user != null) {
+			out.print(" user='"+XmlWriter.encode(this.user.name)+"'");
+		}
+		out.println(">\n");
+		addTags( out );
+		out.println("  </changeset>");
+	}
+	public final void footer(PrintWriter out) {
+		out.println("</osm>");
+	}
+	
+	/******************************************************
+	 * This tag stuff is copied from OsmPrimitive. Perhaps a changeset
+	 * really is a primitive, but it's not right now. Perhaps it should
+	 * be...
+	 ******************************************************/
+	 
+	/**
+	 * Set the given value to the given key
+	 * @param key The key, for which the value is to be set.
+	 * @param value The value for the key.
+	 */
+	public final void put(String key, String value) {
+		if (value == null)
+			remove(key);
+		else {
+			if (keys == null)
+				keys = new HashMap<String, String>();
+			keys.put(key, value);
+		}
+	}
+	/**
+	 * Remove the given key from the list.
+	 */
+	public final void remove(String key) {
+		if (keys != null) {
+			keys.remove(key);
+			if (keys.isEmpty())
+				keys = null;
+		}
+	}
+
+	public final String get(String key) {
+		return keys == null ? null : keys.get(key);
+	}
+
+	public final Collection<Entry<String, String>> entrySet() {
+		if (keys == null)
+			return Collections.emptyList();
+		return keys.entrySet();
+	}
+
+	public final Collection<String> keySet() {
+		if (keys == null)
+			return Collections.emptyList();
+		return keys.keySet();
+	}
+}
Index: trunk/src/org/openstreetmap/josm/io/MyHttpHandler.java
===================================================================
--- trunk/src/org/openstreetmap/josm/io/MyHttpHandler.java	(revision 625)
+++ trunk/src/org/openstreetmap/josm/io/MyHttpHandler.java	(revision 625)
@@ -0,0 +1,33 @@
+/* Dummy handler just to load the override URLConnection class */
+package org.openstreetmap.josm.io;
+
+import java.io.IOException;
+import java.net.URL;
+import java.net.Proxy;
+
+// This is also a java.net.URLStreamHandler
+// Basically a copy of sun.net.www.protocol.http.Handler
+public class MyHttpHandler extends sun.net.www.protocol.http.Handler  {
+            protected String proxy;
+            protected int proxyPort;
+
+            public MyHttpHandler() {
+                super();
+                proxy = null;
+                proxyPort = -1;
+            }
+
+            protected java.net.URLConnection openConnection(URL u)
+                    throws IOException {
+                return openConnection(u, (Proxy) null);
+            }
+            public MyHttpHandler(String proxy, int port) {
+                proxy = proxy;
+                proxyPort = port;
+            }
+  
+            protected java.net.URLConnection openConnection(URL u, Proxy p)
+                    throws IOException {
+                return new MyHttpURLConnection(u, p, this);
+            }
+}
Index: trunk/src/org/openstreetmap/josm/io/MyHttpURLConnection.java
===================================================================
--- trunk/src/org/openstreetmap/josm/io/MyHttpURLConnection.java	(revision 625)
+++ trunk/src/org/openstreetmap/josm/io/MyHttpURLConnection.java	(revision 625)
@@ -0,0 +1,23 @@
+/* Stupid package to override the restriction on payloads with DELETEs */
+package org.openstreetmap.josm.io;
+
+import java.net.ProtocolException;
+import java.io.*;
+import java.net.URL;
+import java.net.Proxy;
+
+public class MyHttpURLConnection extends sun.net.www.protocol.http.HttpURLConnection {
+            protected MyHttpURLConnection(URL u, Proxy p, sun.net.www.protocol.http.Handler handler)
+            {
+              super(u,p,handler);
+            }
+
+public synchronized OutputStream getOutputStream()
+                    throws IOException {
+                String oldmethod = method;
+                method = "POST";
+                OutputStream temp = super.getOutputStream();
+                method = oldmethod;
+                return temp;
+}
+}
