Index: /trunk/src/org/openstreetmap/josm/actions/OpenLocationAction.java
===================================================================
--- /trunk/src/org/openstreetmap/josm/actions/OpenLocationAction.java	(revision 5690)
+++ /trunk/src/org/openstreetmap/josm/actions/OpenLocationAction.java	(revision 5691)
@@ -10,4 +10,5 @@
 import java.awt.event.KeyEvent;
 import java.util.ArrayList;
+import java.util.Collection;
 import java.util.Collections;
 import java.util.LinkedList;
@@ -120,19 +121,20 @@
         openUrl(layer.isSelected(), uploadAddresses.getText());
     }
-
+    
     /**
-     * Open the given URL.
+     * Replies the list of download tasks accepting the given url.
+     * @param url The URL to open
+     * @return The list of download tasks accepting the given url.
+     * @since 5691
      */
-    public void openUrl(boolean new_layer, final String url) {
-        PleaseWaitProgressMonitor monitor = new PleaseWaitProgressMonitor(tr("Download Data"));
-        DownloadTask task = null;
-        Future<?> future = null;
-        for (int i = 0; future == null && i < downloadTasks.size(); i++) {
+    public Collection<DownloadTask> findDownloadTasks(final String url) {
+        List<DownloadTask> result = new ArrayList<DownloadTask>();
+        for (int i = 0; i < downloadTasks.size(); i++) {
             Class<? extends DownloadTask> taskClass = downloadTasks.get(i);
             if (taskClass != null) {
                 try {
-                    task = taskClass.getConstructor().newInstance();
+                    DownloadTask task = taskClass.getConstructor().newInstance();
                     if (task.acceptsUrl(url)) {
-                        future = task.loadUrl(new_layer, url, monitor);
+                        result.add(task);
                     }
                 } catch (Exception e) {
@@ -140,4 +142,21 @@
                 }
             }
+        }
+        return result;
+    }
+
+    /**
+     * Open the given URL.
+     * @param new_layer true if the URL needs to be opened in a new layer, false otherwise
+     * @param url The URL to open
+     */
+    public void openUrl(boolean new_layer, final String url) {
+        PleaseWaitProgressMonitor monitor = new PleaseWaitProgressMonitor(tr("Download Data"));
+        Collection<DownloadTask> tasks = findDownloadTasks(url);
+        DownloadTask task = null;
+        Future<?> future = null;
+        if (!tasks.isEmpty()) {
+            // TODO: handle multiple suitable tasks ?
+            future = tasks.iterator().next().loadUrl(new_layer, url, monitor);
         }
         if (future != null) {
Index: /trunk/src/org/openstreetmap/josm/actions/downloadtasks/DownloadGpsTask.java
===================================================================
--- /trunk/src/org/openstreetmap/josm/actions/downloadtasks/DownloadGpsTask.java	(revision 5690)
+++ /trunk/src/org/openstreetmap/josm/actions/downloadtasks/DownloadGpsTask.java	(revision 5691)
@@ -5,4 +5,5 @@
 
 import java.io.IOException;
+import java.net.URL;
 import java.util.concurrent.Future;
 import java.util.regex.Matcher;
@@ -178,3 +179,9 @@
         }
     }
+
+    @Override
+    public String getConfirmationMessage(URL url) {
+        // TODO
+        return null;
+    }
 }
Index: /trunk/src/org/openstreetmap/josm/actions/downloadtasks/DownloadOsmTask.java
===================================================================
--- /trunk/src/org/openstreetmap/josm/actions/downloadtasks/DownloadOsmTask.java	(revision 5690)
+++ /trunk/src/org/openstreetmap/josm/actions/downloadtasks/DownloadOsmTask.java	(revision 5691)
@@ -6,4 +6,5 @@
 import java.awt.geom.Area;
 import java.io.IOException;
+import java.net.URL;
 import java.util.ArrayList;
 import java.util.Collection;
@@ -17,4 +18,5 @@
 
 import javax.swing.JOptionPane;
+
 import org.openstreetmap.josm.Main;
 import org.openstreetmap.josm.data.Bounds;
@@ -45,4 +47,10 @@
  */
 public class DownloadOsmTask extends AbstractDownloadTask {
+    
+    private static final String PATTERN_OSM_API_URL           = "http://.*/api/0.6/(map|nodes?|ways?|relations?|\\*).*";
+    private static final String PATTERN_OVERPASS_API_URL      = "http://.*/interpreter\\?data=.*";
+    private static final String PATTERN_OVERPASS_API_XAPI_URL = "http://.*/xapi\\?.*\\[@meta\\].*";
+    private static final String PATTERN_EXTERNAL_OSM_FILE     = "https?://.*/.*\\.osm";
+    
     protected Bounds currentBounds;
     protected DataSet downloadedData;
@@ -145,8 +153,8 @@
     public boolean acceptsUrl(String url) {
         return url != null && (
-                url.matches("http://.*/api/0.6/(map|nodes?|ways?|relations?|\\*).*")// OSM API 0.6 and XAPI
-             || url.matches("http://.*/interpreter\\?data=.*")                      // Overpass API
-             || url.matches("http://.*/xapi\\?.*\\[@meta\\].*")                     // Overpass API XAPI compatibility layer
-             || url.matches("https?://.*/.*\\.osm")                                 // Remote .osm files
+                url.matches(PATTERN_OSM_API_URL)           // OSM API 0.6 and XAPI
+             || url.matches(PATTERN_OVERPASS_API_URL)      // Overpass API
+             || url.matches(PATTERN_OVERPASS_API_XAPI_URL) // Overpass API XAPI compatibility layer
+             || url.matches(PATTERN_EXTERNAL_OSM_FILE)     // Remote .osm files
                 );
     }
@@ -352,3 +360,22 @@
         }
     }
+
+    @Override
+    public String getConfirmationMessage(URL url) {
+        if (url != null) {
+            String urlString = url.toExternalForm();
+            if (urlString.matches(PATTERN_OSM_API_URL)) {
+                // TODO: proper i18n after stabilization
+                String message = "<ul><li>"+tr("OSM Server URL:") + " " + url.getHost() + "</li><li>" +
+                        tr("Command")+": "+url.getPath()+"</li>";
+                if (url.getQuery() != null) {
+                    message += "<li>" + tr("Request details: {0}", url.getQuery().replaceAll(",\\s*", ", ")) + "</li>";
+                }
+                message += "</ul>";
+                return message;
+            }
+            // TODO: other APIs
+        }
+        return null;
+    }
 }
Index: /trunk/src/org/openstreetmap/josm/actions/downloadtasks/DownloadTask.java
===================================================================
--- /trunk/src/org/openstreetmap/josm/actions/downloadtasks/DownloadTask.java	(revision 5690)
+++ /trunk/src/org/openstreetmap/josm/actions/downloadtasks/DownloadTask.java	(revision 5691)
@@ -2,4 +2,5 @@
 package org.openstreetmap.josm.actions.downloadtasks;
 
+import java.net.URL;
 import java.util.List;
 import java.util.concurrent.Future;
@@ -92,3 +93,11 @@
      */
     public void cancel();
+    
+    /**
+     * Replies the HTML-formatted confirmation message to be shown to user when the given URL needs to be confirmed before loading.
+     * @param url The URL to be confirmed
+     * @return The HTML-formatted confirmation message to be shown to user
+     * @since 
+     */
+    public String getConfirmationMessage(URL url);
 }
Index: /trunk/src/org/openstreetmap/josm/io/remotecontrol/handler/ImportHandler.java
===================================================================
--- /trunk/src/org/openstreetmap/josm/io/remotecontrol/handler/ImportHandler.java	(revision 5690)
+++ /trunk/src/org/openstreetmap/josm/io/remotecontrol/handler/ImportHandler.java	(revision 5691)
@@ -4,6 +4,10 @@
 import static org.openstreetmap.josm.tools.I18n.tr;
 
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.util.Collection;
 import java.util.HashMap;
 
+import org.openstreetmap.josm.Main;
 import org.openstreetmap.josm.actions.downloadtasks.DownloadOsmTask;
 import org.openstreetmap.josm.actions.downloadtasks.DownloadTask;
@@ -19,10 +23,16 @@
      */
     public static final String command = "import";
+    
+    private URL url;
+    private Collection<DownloadTask> suitableDownloadTasks;
 
     @Override
     protected void handleRequest() throws RequestHandlerErrorException {
         try {
-            DownloadTask osmTask = new DownloadOsmTask();
-            osmTask.loadUrl(false, args.get("url"), null);
+            if (suitableDownloadTasks != null && !suitableDownloadTasks.isEmpty()) {
+                // TODO: add new_layer parameter
+                // TODO: handle multiple suitable download tasks ?
+                suitableDownloadTasks.iterator().next().loadUrl(false, url.toExternalForm(), null);
+            }
         } catch (Exception ex) {
             System.out.println("RemoteControl: Error parsing import remote control request:");
@@ -39,6 +49,16 @@
     @Override
     public String getPermissionMessage() {
+        // URL can be any suitable URL giving back OSM data, including OSM API calls, even if calls to the main API
+        // should rather be passed to LoadAndZoomHandler or LoadObjectHandler.
+        // Other API instances will however use the import handler to force JOSM to make requests to this API instance.
+        // (Example with OSM-FR website that makes calls to the OSM-FR API)
+        // For user-friendliness, let's try to decode these OSM API calls to give a better confirmation message.
+        String taskMessage = null;
+        if (suitableDownloadTasks != null && !suitableDownloadTasks.isEmpty()) {
+            // TODO: handle multiple suitable download tasks ?
+            taskMessage = suitableDownloadTasks.iterator().next().getConfirmationMessage(url);
+        }
         return tr("Remote Control has been asked to import data from the following URL:")
-                + "<br>" + args.get("url");
+                + "<br>" + (taskMessage == null ? url.toString() : taskMessage);
     }
 
@@ -80,5 +100,18 @@
     @Override
     protected void validateRequest() throws RequestHandlerBadRequestException {
-        // Nothing to do
+        final String urlString = args.get("url");
+        try {
+            // Ensure the URL is valid
+            url = new URL(urlString);
+        } catch (MalformedURLException e) {
+            throw new RequestHandlerBadRequestException("MalformedURLException: "+e.getMessage());
+        }
+        // Find download tasks for the given URL
+        suitableDownloadTasks = Main.main.menu.openLocation.findDownloadTasks(urlString);
+        if (suitableDownloadTasks.isEmpty()) {
+            // It should maybe be better to reject the request in that case ?
+            // For compatibility reasons with older instances of JOSM, arbitrary choice of DownloadOsmTask
+            suitableDownloadTasks.add(new DownloadOsmTask());
+        }
     }
 }
Index: /trunk/src/org/openstreetmap/josm/io/remotecontrol/handler/RequestHandler.java
===================================================================
--- /trunk/src/org/openstreetmap/josm/io/remotecontrol/handler/RequestHandler.java	(revision 5690)
+++ /trunk/src/org/openstreetmap/josm/io/remotecontrol/handler/RequestHandler.java	(revision 5691)
@@ -11,4 +11,5 @@
 import java.util.List;
 
+import javax.swing.JLabel;
 import javax.swing.JOptionPane;
 
@@ -129,7 +130,13 @@
          */
         if (Main.pref.getBoolean(globalConfirmationKey, globalConfirmationDefault)) {
-            if (JOptionPane.showConfirmDialog(Main.parent,
-                "<html>" + getPermissionMessage() +
-                "<br>" + tr("Do you want to allow this?"),
+            // Ensure dialog box does not exceed main window size
+            Integer maxWidth = (int) Math.max(200, Main.parent.getWidth()*0.6);
+            String message = "<html><div>" + getPermissionMessage() +
+                    "<br/>" + tr("Do you want to allow this?") + "</div></html>";
+            JLabel label = new JLabel(message);
+            if (label.getPreferredSize().width > maxWidth) {
+                label.setText(message.replaceFirst("<div>", "<div style=\"width:" + maxWidth + "px;\">"));
+            }
+            if (JOptionPane.showConfirmDialog(Main.parent, label,
                 tr("Confirm Remote Control action"),
                 JOptionPane.YES_NO_OPTION) != JOptionPane.YES_OPTION) {
