Discussions
Categories
Groups
Community Home
Categories
INTERNAL ENABLEMENT
POPULAR
PUBLIC CLOUD
PRIVATE CLOUD
Quick Links
MY LINKS
HELPFUL TIPS
Back to website
Home
Web CMS (TeamSite)
Get SiteAddresses
ijh
Hi
I would like to be able to get all the Site Addreses assoicated with a site
I found the getHosts method in the EndUserSite class
In this example the default.site has two site addresses:
site1.com
site1.qa.com
The method getHosts returns a List
When you look at what is returned.
List siteList = site.getHosts();
for (int i=0; i< siteList.size(); i++)
{
System.out.println( siteList.get(i) );
}
When you
You get the following output
mID [0]
mDomain [com]
mServerName [site1]
mID [0]
mDomain [qa.com]
mServerName [site1]
What we want to retreive from the getHosts is the sitename as they appear when editing the the default.site
ie:
site1.com
site1.qa.com
How can I take the List returned by getHosts
and turn it into the actual site addresses
Thanks
I
Find more posts tagged with
Comments
Adam Stoller
I don't have the javadocs in front of me, but based on the output you showed, I'd think it would be relatively easy - for each entry in the list:
I'm assuming that the object(s) returned by getHosts() contains accessor methods for those fields.
ijh
I can't find any accessor methods in the API.
I am failry new to Java.
Are you referring to get methods?
The getHosts() method returns a List Object.
Is there a way to "examine" the list object to see whats available?
Ian
ijh
I found the solution. Thought I would post for others
EndUserSite site = context.getSite();
System.out.println("Site Name = " + site.getDirectory());
System.out.println("Site Dir = " + site.getName());
System.out.println("ErrorPage = " + site.getErrorPage());
List lHosts = site.getHosts();
com.interwoven.livesite.model.SiteHost oSite;
// List all the site addresses associated with the site
for (int i=0; i< lHosts.size(); i++)
{
oSite = (SiteHost)lHosts.get(i);
System.out.println("HostName =" + oSite.getHostName());
System.out.println("ServerName =" + oSite.getServerName());
System.out.println("DomainName =" + oSite.getDomain());
}