Revision: 14968
http://gate.svn.sourceforge.net/gate/?rev=14968&view=rev
Author: markagreenwood
Date: 2012-01-09 18:59:51 +0000 (Mon, 09 Jan 2012)
Log Message:
-----------
add support for relative URLs in the site XMl files
Modified Paths:
--------------
gate/trunk/src/gate/gui/creole/manager/RemoteUpdateSite.java
Modified: gate/trunk/src/gate/gui/creole/manager/RemoteUpdateSite.java
===================================================================
--- gate/trunk/src/gate/gui/creole/manager/RemoteUpdateSite.java
2012-01-09 18:21:19 UTC (rev 14967)
+++ gate/trunk/src/gate/gui/creole/manager/RemoteUpdateSite.java
2012-01-09 18:59:51 UTC (rev 14968)
@@ -14,12 +14,15 @@
package gate.gui.creole.manager;
+import java.net.MalformedURLException;
import java.net.URI;
+import java.net.URL;
import java.net.URLConnection;
import java.util.Collections;
import java.util.List;
import com.thoughtworks.xstream.XStream;
+import com.thoughtworks.xstream.converters.SingleValueConverter;
public class RemoteUpdateSite {
@@ -49,6 +52,26 @@
xs.alias("UpdateSite", List.class);
xs.alias("CreolePlugin", CreolePlugin.class);
xs.useAttributeFor(CreolePlugin.class, "url");
+ xs.registerConverter(new SingleValueConverter() {
+ @Override
+ public boolean canConvert(@SuppressWarnings("rawtypes") Class type) {
+ return URL.class.isAssignableFrom(type);
+ }
+
+ @Override
+ public String toString(Object obj) {
+ throw new UnsupportedOperationException("Converting URLs to
Strings is not currently supported");
+ }
+
+ @Override
+ public Object fromString(String value) {
+ try {
+ return new URL(uri.toURL(), value);
+ } catch(MalformedURLException e) {
+ throw new RuntimeException("Not a valid URL",e);
+ }
+ }
+ });
URLConnection conn = uri.toURL().openConnection();
conn.setConnectTimeout(5000);
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
------------------------------------------------------------------------------
Ridiculously easy VDI. With Citrix VDI-in-a-Box, you don't need a complex
infrastructure or vast IT resources to deliver seamless, secure access to
virtual desktops. With this all-in-one solution, easily deploy virtual
desktops for less than the cost of PCs and save 60% on VDI infrastructure
costs. Try it free! http://p.sf.net/sfu/Citrix-VDIinabox
_______________________________________________
GATE-cvs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/gate-cvs