Changeset 16426 in josm for trunk/src/org/openstreetmap/josm/io/OnlineResource.java
- Timestamp:
- 2020-05-16T20:59:34+02:00 (4 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/io/OnlineResource.java
r14999 r16426 3 3 4 4 import static org.openstreetmap.josm.tools.I18n.tr; 5 6 import org.openstreetmap.josm.spi.preferences.Config; 5 7 6 8 /** … … 37 39 38 40 /** 41 * Replies whether the given URL matches this online resource 42 * @return whether the given URL matches this online resource 43 */ 44 public final boolean matches(String url) { 45 final String baseUrl; 46 switch (this) { 47 case ALL: 48 return true; 49 case OSM_API: 50 baseUrl = OsmApi.getOsmApi().getServerUrl(); 51 break; 52 case JOSM_WEBSITE: 53 baseUrl = Config.getUrls().getJOSMWebsite(); 54 break; 55 default: 56 return false; 57 } 58 return url.startsWith(baseUrl.substring(baseUrl.indexOf("://")), url.indexOf("://")); 59 } 60 61 /** 39 62 * Ensures resource is not accessed in offline mode. 40 63 * @param downloadString The attempted download string 41 * @param resourceString The resource download string that should not be accessed64 * @param ignore ignored 42 65 * @throws OfflineAccessException if resource is accessed in offline mode, in any protocol 66 * @deprecated use {@link NetworkManager#isOffline(String)} 43 67 */ 44 public final void checkOfflineAccess(String downloadString, String resourceString) {45 if (NetworkManager.isOffline(this) && downloadString46 .startsWith(resourceString.substring(resourceString.indexOf("://")), downloadString.indexOf("://"))) {68 @Deprecated 69 public final void checkOfflineAccess(String downloadString, String ignore) { 70 if (NetworkManager.isOffline(downloadString)) { 47 71 throw new OfflineAccessException(tr("Unable to access ''{0}'': {1} not available (offline mode)", downloadString, getLocName())); 48 72 }
Note:
See TracChangeset
for help on using the changeset viewer.