@@ -17,10 +17,13 @@ package au.org.ala.specieslist
17
17
import grails.converters.JSON
18
18
import grails.web.JSONBuilder
19
19
import groovyx.net.http.HTTPBuilder
20
+ import org.apache.http.entity.ContentType
20
21
21
22
class BieService {
22
23
23
24
def grailsApplication
25
+ def webService
26
+ def authService
24
27
25
28
def bulkLookupSpecies (list ) {
26
29
Map map = [:]
@@ -57,17 +60,14 @@ class BieService {
57
60
}
58
61
}
59
62
60
- def generateFieldGuide (druid ,guids ){
63
+ def generateFieldGuide (druid ,guids , email ){
61
64
def title = " The field guide for " + druid
62
- def link = grailsApplication. config. grails. serverURL + " /speciesListItems /list/" + druid
65
+ def link = grailsApplication. config. grails. serverURL + " /speciesListItem /list/" + druid
63
66
try {
64
- def http = new HTTPBuilder (grailsApplication. config. fieldGuide. baseURL + " /generate" )
67
+ def http = new HTTPBuilder (grailsApplication. config. fieldGuide. baseURL + " /generate" + " ?email= " + email )
65
68
http. setHeaders([' User-Agent' : " ${ grailsApplication.config.outboundhttp.useragent} " ])
66
- def response = http. post(body : createJsonForFieldGuide(title, link, guids), requestContentType :groovyx.net.http.ContentType . JSON ){ resp ->
67
- def responseURL = grailsApplication. config. fieldGuide. baseURL + " /guide/" + resp. headers[' fileId' ]. getValue()
68
- log. debug(responseURL)
69
- return responseURL
70
- }
69
+ def response = http. post(body : createJsonForFieldGuide(title, link, guids), requestContentType :ContentType . APPLICATION_JSON )
70
+ return response
71
71
} catch (ex) {
72
72
log. error(" Unable to generate field guide " ,ex)
73
73
return null
0 commit comments