To get the host name and the port and the context you can use
ServerConfiguration.getDefaultBaseUrl() (if you set that value properly after
install in the first place).
To getURI including the repository prefix you can use
URI2RepositoryManager.getInstance().getURI("dms",dmsHM.getContentByUuid(uuid).getHandle());
HTH,
Jan
On Nov 4, 2010, at 11:00 PM, Dinh Bao Dang wrote:
>
> Hi everyone,
>
> I have a problem converting UUID Links to absolute ones under Magnolia 3.6.8.
>
> I have my UUID Link, which points to an image, from a dialog field with
> controlType = uuidLink.
>
> I tried some classes but they didn't work:
>
> String imgPath = LinkUtil.convertUUIDsToAbsoluteLinks(uuid);
>
> UUIDLink uuidImage = new UUIDLink();
> uuidImage.parseUUIDLink(uuid);
> String imgPath = uuidImage.getHandle();
>
> String imgPath =
> LinkResolver.Factory.getInstance().convertToAbsoluteLinks(uuid,true);
>
> Only this works:
>
> LinkHelper.convertUUIDtoHandle(uuid,"dms") but this only gives me the
> relative path with /dms as root. So I have to put /dms , the context path and
> host myself in front of it. If there is no better way, I have to go this way.
> How do I get my host name?
>
> In the end I need a URL object or a java.io.File object. Is there a way to
> get a file object from uuid?
>
> Regards, Bao
>
>
> ----------------------------------------------------------------
> For list details see
> http://www.magnolia-cms.com/home/community/mailing-lists.html
> To unsubscribe, E-mail to: <[email protected]>
> ----------------------------------------------------------------
----------------------------------------------------------------
For list details see
http://www.magnolia-cms.com/home/community/mailing-lists.html
To unsubscribe, E-mail to: <[email protected]>
----------------------------------------------------------------