cancel
Showing results for 
Search instead for 
Did you mean: 

TemplateNode.getUrl()

nyronian
Champ in-the-making
Champ in-the-making
I have noticed the TemplateNode.getUrl() does not include the context in the url.  As a result the returned URL, without adding the context, seems unuasable.  Am I missing something here?  How does one deal with the url context without hardcoding it? 

I know it is available through the FacesContext, or an HTTPServletRequest, but what if you have neither?  i.e. a Utility class that may be run outside of a FacesContext or and HTTPServletRequest. 

Are there methods of dealing with URL's with no context and making them work?

Any help would be appriciated.

Thanks.
2 REPLIES 2

kevinr
Star Contributor
Star Contributor
In 2.1 you have the ${url.context} value that will give you the context (such as /alfresco) - previous to 2.1 you have to hardcode that value into your templates, such as <a href="/alfresco${node.url}">…</a>

Thanks,

Kevin

nyronian
Champ in-the-making
Champ in-the-making
Thanks for your quick response Kevin.

I am on 2.0 right now.  Is the FacesContext or the HTTPServletRequest the only way to retreive that data?  How are you doing it in 2.1?  I was putting the context in a static variable in a class with a static initializer.  The problem is, if it is first initialized by a servlet then I have to pass in the servletrequest to get the context.  Just curious if you know.

Do you know if there are any issues in 2.0 around changing the context?  Is /alfresco hardcoded within the system anywhere that will cause the system to break?

Thanks again.
Getting started

Tags


Find what you came for

We want to make your experience in Hyland Connect as valuable as possible, so we put together some helpful links.