gpt4 book ai didi

grails - 从URL下载内容而不提示在Grails中进行身份验证

转载 作者:行者123 更新时间:2023-12-02 15:46:11 24 4
gpt4 key购买 nike

我正在使用Grails编程的Web应用程序。我有一个页面用于显示某些报告,这些报告可以包含附件。附件存储在documentum中,当前,当用户单击它时,它只是到documentum中存储附件的位置的链接,并提示用户输入其凭据。我的应用程序的文档凭证存储在配置文件中,因此我想使用这些凭证,而不是强制用户输入自己的凭证。我正在使用RESTful服务来检索链接,但是我试图找到一种使用链接直接下载到用户计算机的方法。

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中检索该文档。

最佳答案

如果要绕过登录,则可以设置SSO解决方案(需要DCTM进行一些工作)或按照您的建议执行功能。但是,在执行此操作时应考虑许可条款。

关于grails - 从URL下载内容而不提示在Grails中进行身份验证,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47601242/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com