Grails로 프로그래밍 된 웹 앱에서 작업하고 있습니다. 특정 보고서를 표시하는 데 사용되는 페이지가 있으며이 보고서에는 첨부 파일이 포함될 수 있습니다. 첨부 파일은 documentum에 저장되며 현재 사용자가 첨부 파일을 클릭하면 첨부 파일이 저장된 문서 위치의 링크 일 뿐이며 사용자에게 자격 증명을 입력하라는 메시지를 표시합니다. 내 응용 프로그램은 구성 파일에 저장된 문서 자격 증명을 가지고 있으므로 사용자가 자신의 자격 증명을 입력하도록 강요하는 대신 이러한 속성을 사용하려고합니다. RESTful 서비스를 사용하여 링크를 검색하지만 링크를 사용하여 사용자 컴퓨터에 직접 다운로드하는 방법을 찾고 있습니다.Grails에서 인증을 요청하지 않고 URL에서 콘텐츠를 다운로드 중
private def getFileInfo(def id, def subject) {
// product show view needs the following four lists to display the document information correctly
def ATRReportInstance = ATRReport.findByTrackingNumber(id)
def linkList = []
def nameList = []
def formatList = []
def idList = []
// open up a connection to the documentum server
def doc = connectToDocumentum()
if (!doc) return
def rest = doc.rest
def response = doc.response
if (response.status == 200) {
// retrieve the folder for this product (the name of this folder is the product's ID)
def rObjectId = rest.get(documentumServer + "/repositories/" + documentumfilestore + "?dql=select r_object_id from dm_folder where any r_folder_path='" + atrreportfolderpath + "/" + id + "'") {
auth authuser, authpass
}
// get the folder's ID from the folder object retrieved above
def folderObjectID
rObjectId.json.entries.each {
entry - >
folderObjectID = entry.content.properties.r_object_id
}
// get all of the documents in the product's MSDS folder using the folder ID retrieved above
def resp = rest.get(documentumServer + "/repositories/" + documentumfilestore + "?dql=select r_object_id, object_name, a_content_type, subject from cbs_document where any i_folder_id= '" + folderObjectID + "'") {
auth authuser, authpass
}
// cycle through the documents above to populate the four MSDS document information lists
def x = 0
resp.json.entries.each {
entry - >
if (entry.content.properties.subject == subject) {
// get the document's content object from the document's ID
def content = rest.get(documentumServer + "/repositories/" + documentumfilestore + "/objects/" + entry.content.properties.r_object_id + "/contents/content" + "?media-url-policy=local") {
auth authuser, authpass
}
if (entry.content.properties.r_object_id != null && ATRReportInstance.inactiveFiles != null && ATRReportInstance.inactiveFiles.contains(entry.content.properties.r_object_id.toString())) {} else {
linkList[x] = getLink(content.json.links, "enclosure")
if (linkList[x].contains("format=msg"))
linkList[x] = linkList[x].toString().substring(0, linkList[x].toString().indexOf("content-media")) + "content-media.msg"
formatList[x] = entry.content.properties.a_content_type
nameList[x] = entry.content.properties.object_name
idList[x] = entry.content.properties.r_object_id
x++
}
}
}
return [linkList: linkList, nameList: nameList, formatList: formatList, idList: idList]
} else {
// return null if documentum is unavailable
flash.message = message(code: 'error.documentum.unavailable')
return null
}
}
나는 URL에 걸릴 작동 할 수 있습니다 사용자에게 문서를 다운로드 할 수있는 또 다른 기능을 쓰고 생각하고 있어요,하지만 난 Grails를 내 해당 문서를 검색하는 방법을 알아낼 수 없습니다.