/** * Constructs a new site object without title and id information, * with a site matcher generated from the provided URL.<p> * * This is to be used for test purposes only.<p> * * @param siteRoot root directory of this site in the OpenCms VFS * @param siteURL the URL to create the site matcher for this site from */ public CmsSite(String siteRoot, String siteURL) { this(siteRoot, new CmsSiteMatcher(siteURL)); }
/** * Returns <code>true</code> if the given site matcher matches the configured OpenCms workplace.<p> * * @param matcher the site matcher to match the site with * * @return <code>true</code> if the given site matcher matches the configured OpenCms workplace */ public boolean isWorkplaceRequest(CmsSiteMatcher matcher) { return (m_workplaceSiteMatcher != null) && m_workplaceSiteMatcher.equals(matcher); }
/** * Returns the server url of this site root.<p> * * @return the server url */ public String getUrl() { return m_siteMatcher.getUrl(); }
/** * Initializes the member variables.<p> * * @param serverProtocol to protocol required to access this site * @param serverName the server URL prefix to which this site is mapped * @param serverPort the port required to access this site * @param timeOffset the time offset */ private void init(String serverProtocol, String serverName, int serverPort, long timeOffset) { setServerProtocol(serverProtocol); setServerName(serverName); setServerPort(serverPort); setTimeOffset(timeOffset); } }
siteElement.addAttribute(A_SERVER, site.getSiteMatcher().toString()); siteElement.addAttribute(A_URI, site.getSiteRoot().concat("/")); CmsSiteMatcher matcher = (CmsSiteMatcher)aliasIterator.next(); Element aliasElement = siteElement.addElement(N_ALIAS); aliasElement.addAttribute(A_SERVER, matcher.getUrl()); if (matcher.getTimeOffset() != 0) { aliasElement.addAttribute(A_OFFSET, "" + matcher.getTimeOffset());
CmsSiteMatcher targetMatcher = new CmsSiteMatcher(targetUri); if (OpenCms.getSiteManager().isMatching(targetMatcher) || targetMatcher.equals(cms.getRequestContext().getRequestMatcher())) { || targetMatcher.equals(cms.getRequestContext().getRequestMatcher()); if (isWorkplaceServer) { String selectedPath;
/** * Constructs a new site matcher object.<p> * * @param serverProtocol to protocol required to access this site * @param serverName the server URL prefix to which this site is mapped * @param serverPort the port required to access this site * @param timeOffset the time offset */ public CmsSiteMatcher(String serverProtocol, String serverName, int serverPort, long timeOffset) { init(serverProtocol, serverName, serverPort, timeOffset); }
/** * Matches the given request against all configures sites and returns * the matching site, or the default site if no sites matches.<p> * * @param req the request to match * * @return the matching site, or the default site if no sites matches */ public CmsSite matchRequest(HttpServletRequest req) { CmsSiteMatcher matcher = getRequestMatcher(req); if (matcher.getTimeOffset() != 0) { HttpSession session = req.getSession(); if (session != null) { session.setAttribute(CmsContextInfo.ATTRIBUTE_REQUEST_TIME, new Long(System.currentTimeMillis() + matcher.getTimeOffset())); } } CmsSite site = matchSite(matcher); if (LOG.isDebugEnabled()) { String requestServer = req.getScheme() + "://" + req.getServerName() + ":" + req.getServerPort(); LOG.debug(Messages.get().getBundle().key( Messages.LOG_MATCHING_REQUEST_TO_SITE_2, requestServer, site.toString())); } return site; }
/** * Returns a clone of this Objects instance.<p> * * @return a clone of this instance */ @Override public Object clone() { return new CmsSite( getSiteRoot(), (CmsUUID)getSiteRootUUID().clone(), getTitle(), (CmsSiteMatcher)getSiteMatcher().clone(), String.valueOf(getPosition())); }
/** * Initializes the member variables.<p> * * @param serverProtocol to protocol required to access this site * @param serverName the server URL prefix to which this site is mapped * @param serverPort the port required to access this site * @param timeOffset the time offset */ private void init(String serverProtocol, String serverName, int serverPort, long timeOffset) { setServerProtocol(serverProtocol); setServerName(serverName); setServerPort(serverPort); setTimeOffset(timeOffset); } }
siteElement.addAttribute(A_SERVER, site.getSiteMatcher().toString()); siteElement.addAttribute(A_URI, site.getSiteRoot().concat("/")); siteElement.addAttribute(A_TITLE, site.getTitle()); CmsSiteMatcher matcher = aliasIterator.next(); Element aliasElement = siteElement.addElement(N_ALIAS); aliasElement.addAttribute(A_SERVER, matcher.getUrl()); if (matcher.getTimeOffset() != 0) { aliasElement.addAttribute(A_OFFSET, "" + matcher.getTimeOffset());
/** * Constructs a new site matcher object.<p> * * @param serverProtocol to protocol required to access this site * @param serverName the server URL prefix to which this site is mapped * @param serverPort the port required to access this site */ public CmsSiteMatcher(String serverProtocol, String serverName, int serverPort) { init(serverProtocol, serverName, serverPort, 0); }
/** * Matches the given request against all configures sites and returns * the matching site, or the default site if no sites matches.<p> * * @param req the request to match * * @return the matching site, or the default site if no sites matches */ public CmsSite matchRequest(HttpServletRequest req) { CmsSiteMatcher matcher = getRequestMatcher(req); if (matcher.getTimeOffset() != 0) { HttpSession session = req.getSession(); if (session != null) { session.setAttribute( CmsContextInfo.ATTRIBUTE_REQUEST_TIME, new Long(System.currentTimeMillis() + matcher.getTimeOffset())); } } CmsSite site = matchSite(matcher); if (LOG.isDebugEnabled()) { String requestServer = req.getScheme() + "://" + req.getServerName() + ":" + req.getServerPort(); LOG.debug( Messages.get().getBundle().key( Messages.LOG_MATCHING_REQUEST_TO_SITE_2, requestServer, site.toString())); } return site; }
/** * Returns a clone of this Objects instance.<p> * * @return a clone of this instance */ @Override public Object clone() { return new CmsSite( getSiteRoot(), (CmsUUID)getSiteRootUUID().clone(), getTitle(), (CmsSiteMatcher)getSiteMatcher().clone(), String.valueOf(getPosition()), getErrorPage(), getSecureServer(), isExclusiveUrl(), isExclusiveError(), isWebserver(), getAliases()); }
/** * Returns a clone of this Objects instance.<p> * * @return a clone of this instance */ @Override public Object clone() { return new CmsSiteMatcher(m_serverProtocol, m_serverName, m_serverPort, (m_timeOffset / 1000L)); }
/** * Returns the server url of this site root.<p> * * @return the server url */ public String getUrl() { return m_siteMatcher.getUrl(); }
/** * @see java.lang.Object#equals(java.lang.Object) */ @Override public boolean equals(Object obj) { if (obj == this) { return true; } if (obj instanceof CmsSite) { return (m_siteMatcher != null) && m_siteMatcher.equals(((CmsSite)obj).m_siteMatcher); } return false; }
/** * Constructs a new site matcher object.<p> * * @param serverProtocol to protocol required to access this site * @param serverName the server URL prefix to which this site is mapped * @param serverPort the port required to access this site * @param timeOffset the time offset */ public CmsSiteMatcher(String serverProtocol, String serverName, int serverPort, long timeOffset) { init(serverProtocol, serverName, serverPort, timeOffset); }
time += OpenCms.getSiteManager().getSiteForSiteRoot(dbc.getRequestContext().getSiteRoot()).getSiteMatcher().getTimeOffset();
/** * Returns a clone of this Objects instance.<p> * * @return a clone of this instance */ @Override public Object clone() { return new CmsSiteMatcher(m_serverProtocol, m_serverName, m_serverPort, (m_timeOffset / 1000L)); }