Changeset 1992
- Timestamp:
- Sep 3, 2011, 9:06:39 PM (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/grails-app/controllers/RestController.groovy
r1990 r1992 426 426 // Create data for all assays 427 427 moduleURL = new URL(params.moduleURL) 428 moduleInet = InetAddress.getByName(moduleURL.getHost()) 428 try { 429 moduleInet = InetAddress.getByName(moduleURL.getHost()) 430 } 431 catch(Exception e) { 432 moduleInet = moduleURL.host 433 } 434 429 435 assays.each{ assay -> 430 436 /** … … 472 478 473 479 def doesModuleMatch = { assay, moduleURL, moduleInet -> 474 // only resolve hosts if the urls do not match identically 475 def assayModuleURL = new URL(assay.module.url) 476 def assayModuleInet = InetAddress.getByName(assayModuleURL.getHost()) 477 478 return ( 479 moduleInet.hostAddress == assayModuleInet.hostAddress && 480 (moduleURL.path.replaceAll(/[^a-zA-Z0-9]/, "") == assayModuleURL.path.replaceAll(/[^a-zA-Z0-9]/, "")) 481 ) 480 481 try { 482 483 // only resolve hosts if the urls do not match identically 484 def assayModuleURL = new URL(assay.module.url) 485 def assayModuleInet = InetAddress.getByName(assayModuleURL.getHost()) 486 487 return ( 488 moduleInet.hostAddress == assayModuleInet.hostAddress && 489 (moduleURL.path.replaceAll(/[^a-zA-Z0-9]/, "") == assayModuleURL.path.replaceAll(/[^a-zA-Z0-9]/, "")) 490 ) 491 } 492 catch (Exception e) { 493 // If for some reason an error occurs (e.g. because the hostname is invalid and throws an UnknownHostException) 494 // assume the calling module does not equal the assay module considered 495 return false 496 } 482 497 } 483 498
Note: See TracChangeset
for help on using the changeset viewer.