如何从Alfresco Share网页脚本中检索主机名 [英] How to retrieve the hostname from an Alfresco Share webscript

查看:87
本文介绍了如何从Alfresco Share网页脚本中检索主机名的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想知道如何从Surf中的根对象中得知当前的主机名。

I'd like to know how you can know the current hostname from a Root Object in Surf.

我正在编写一个服务于JNLP的Web脚本,因此我没有页面上下文,并且 $ {url.context} 仅返回 / share

I'm writting a webscript which serve a JNLP, so I have no page context, and ${url.context} only returns /share.

我正在寻找如何拥有主机名 http://foobar.com ,或者是否可以从服务器端使用。

I'm looking how I can have the hostname http://foobar.com or if this is possible at all from server side.

我经历过: http ://wiki.alfresco.com/wiki/Surf_Platform_-__Freemarker_Template_and_JavaScript_API# 没有成功

推荐答案

在存储库方面,Alfresco和Share的URL是已知的。您可以从 SysAdminParams中获取所有各个部分。 ,您可以使用 UrlUtils 将不同的部分结合在一起,为您提供完整的URL。

On the repository side, the URLs for Alfresco and Share are known. You can get all the individual parts from SysAdminParams and you can use UrlUtils to have the different parts joined together for you to give a full URL.

据我所知,这些详细信息仅在Alfresco存储库中保留层,并且永远不会传递给Share。共享中的所有绝对URL似乎都是在回购中生成的,并通过

As far as I can tell though, these details are only ever held on the Alfresco Repository tier, and are never passed over to Share. All the absolute URLs in Share seem to be generated in the Repo and sent over

发送,然后一个选项是让您将网页脚本更改为回购网页脚本而不是共享一。这样您就可以访问相应的bean。 Share将为您代理Repo Web脚本,因此您仍然可以以登录用户的身份直接在Share中访问它。您需要一个类似于 / share / proxy / alfresco / my / web / script 的URL来访问它们。

One option then is for you to change your webscript to be a repo webscript rather than a share one. That'll give you access to the appropriate beans. Share will proxy Repo webscripts for you, so you can still access it directly in Share as the logged in user. You'll want a URL a bit like /share/proxy/alfresco/my/web/script to access them.

否则,创建一个新的仓库Web脚本,该脚本公开SysAdminParams和Share URL的有用部分,并让您的共享Web脚本抓取(可能是通过缓存)。也有很多类似的例子。

Otherwise, create a new repo webscript that exposes the useful bits of the SysAdminParams and Share URLs, and have your share webscript fetch it (likely with caching). There are lots of examples of that too to work with.

这篇关于如何从Alfresco Share网页脚本中检索主机名的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆