Skip to content

Commit

Permalink
Bump up to 5.0 and fix local config loading issue
Browse files Browse the repository at this point in the history
  • Loading branch information
qifeng-bai committed Sep 12, 2022
1 parent 06158d6 commit 07db760
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 17 deletions.
9 changes: 4 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,11 @@ This application/plugin provides a web UI for a back-end service called [**bioca

An example Grails application that uses this plugin, is the [**generic-hub**](https://github.com/AtlasOfLivingAustralia/generic-hub) app. There are other implementations listed in the [ALA Github repository](https://github.com/AtlasOfLivingAustralia?query=-hub) (all implementations have a suffix '-hub').

## Updates
5.x support OIDC authentication

## Versions
The grails4 branch contains the 1.5.x series of the plugin compatible with Grails 4.0.12.
5.x is based on Grails 4.0.12 and Java 11

The grails2 branch contains the 1.5.x series of the plugin compatible with Grails 2.x.

Expand All @@ -24,10 +27,6 @@ To load and view you own occurrence record data, you'll need to install and run

A full list of the configuration settings (and their default values) are found in `src/main/groovy/au/org/ala/biocache/hubs/defaultConfig.groovy`.

## Grails 4

Starting with verison 4.x

## Grails 3

Starting with version 1.7 biocache-hubs has been migrated to run on Grails 3 and Java 8
Expand Down
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ buildscript {
}
}

version "4.1.0-SNAPSHOT"
version "5.0-SNAPSHOT"
group "au.org.ala.plugins.grails"

apply plugin:"eclipse"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@

package au.org.ala.biocache.hubs

import grails.converters.JSON
import grails.plugin.cache.CacheEvict
import grails.plugin.cache.Cacheable

Expand Down Expand Up @@ -437,20 +438,27 @@ class WebServicesService {
JSONElement getJsonElements(String url, Boolean wsAuth = false, Boolean includeUser = false) {

log.debug "(internal) getJson URL = " + url
Map result = webService.get(url, [:], ContentType.APPLICATION_JSON, wsAuth, includeUser)
def conn = new URL(url).openConnection()
if (conn instanceof HttpURLConnection) {
Map result = webService.get(url, [:], ContentType.APPLICATION_JSON, wsAuth, includeUser)

if (result.error) {
if (result.error) {

def error = "Failed to get json from web service (${url}) status ${result.statusCode} : ${result.error}"
log.error error
throw new RestClientException(error)
}
def error = "Failed to get json from web service (${url}) status ${result.statusCode} : ${result.error}"
log.error error
throw new RestClientException(error)
}

if (result.resp instanceof Collection) {
return new JSONArray(result.resp)
}
if (result.resp instanceof Map) {
return new JSONObject(result.resp)
if (result.resp instanceof Collection) {
return new JSONArray(result.resp)
}
if (result.resp instanceof Map) {
return new JSONObject(result.resp)
}
} else {
InputStream stream = conn.getInputStream()
JSONElement jsonOut = JSON.parse(stream, "UTF-8")
return jsonOut
}

def error = "Failed to get json from web service (${url}) : ${result}"
Expand Down

0 comments on commit 07db760

Please sign in to comment.