Index: trunk/src/org/openstreetmap/josm/actions/downloadtasks/DownloadGpsTask.java
===================================================================
--- trunk/src/org/openstreetmap/josm/actions/downloadtasks/DownloadGpsTask.java	(revision 5174)
+++ trunk/src/org/openstreetmap/josm/actions/downloadtasks/DownloadGpsTask.java	(revision 5175)
@@ -6,4 +6,6 @@
 import java.io.IOException;
 import java.util.concurrent.Future;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
 
 import org.openstreetmap.josm.Main;
@@ -31,4 +33,9 @@
     private static final String PATTERN_TRACKPOINTS_BBOX = "http://.*/api/0.6/trackpoints\\?bbox=.*,.*,.*,.*";
 
+    private static final String PATTERN_EXTERNAL_GPX_SCRIPT = "http://.*exportgpx.*";
+    private static final String PATTERN_EXTERNAL_GPX_FILE = "http://.*/(.*\\.gpx)";
+
+    protected String newLayerName = null;
+
     public Future<?> download(boolean newLayer, Bounds downloadArea, ProgressMonitor progressMonitor) {
         downloadTask = new DownloadTask(newLayer,
@@ -40,7 +47,10 @@
 
     public Future<?> loadUrl(boolean newLayer, String url, ProgressMonitor progressMonitor) {
-        if (url != null && url.matches(PATTERN_TRACE_ID)) {
+        if (url != null && (url.matches(PATTERN_TRACE_ID) || url.matches(PATTERN_EXTERNAL_GPX_SCRIPT) || url.matches(PATTERN_EXTERNAL_GPX_FILE))) {
             downloadTask = new DownloadTask(newLayer,
                     new OsmServerLocationReader(url), progressMonitor);
+            // Extract .gpx filename from URL to set the new layer name
+            Matcher matcher = Pattern.compile(PATTERN_EXTERNAL_GPX_FILE).matcher(url);
+            newLayerName = matcher.matches() ? matcher.group(1) : null;
             // We need submit instead of execute so we can wait for it to finish and get the error
             // message if necessary. If no one calls getErrorMessage() it just behaves like execute.
@@ -62,5 +72,6 @@
     @Override
     public boolean acceptsUrl(String url) {
-        return url != null && (url.matches(PATTERN_TRACE_ID) || url.matches(PATTERN_TRACKPOINTS_BBOX));
+        return url != null && (url.matches(PATTERN_TRACE_ID) || url.matches(PATTERN_TRACKPOINTS_BBOX)
+                || url.matches(PATTERN_EXTERNAL_GPX_SCRIPT) || url.matches(PATTERN_EXTERNAL_GPX_FILE));
     }
 
@@ -103,5 +114,5 @@
             if (rawData == null)
                 return;
-            String name = tr("Downloaded GPX Data");
+            String name = newLayerName != null ? newLayerName : tr("Downloaded GPX Data");
             GpxLayer layer = new GpxLayer(rawData, name);
             Layer x = findMergeLayer();
