Search in sources :

Example 1 with XWikiURLFactoryServiceImpl

use of com.xpn.xwiki.web.XWikiURLFactoryServiceImpl in project xwiki-platform by xwiki.

the class XWiki method getURLFactoryService.

public XWikiURLFactoryService getURLFactoryService() {
    if (this.urlFactoryService == null) {
        synchronized (this.URLFACTORY_SERVICE_LOCK) {
            if (this.urlFactoryService == null) {
                LOGGER.info("Initializing URLFactory Service...");
                XWikiURLFactoryService factoryService = null;
                String urlFactoryServiceClass = getConfiguration().getProperty("xwiki.urlfactory.serviceclass");
                if (urlFactoryServiceClass != null) {
                    try {
                        if (LOGGER.isDebugEnabled()) {
                            LOGGER.debug("Using custom URLFactory Service Class [" + urlFactoryServiceClass + "]");
                        }
                        factoryService = (XWikiURLFactoryService) Class.forName(urlFactoryServiceClass).getConstructor(new Class<?>[] { XWiki.class }).newInstance(new Object[] { this });
                    } catch (Exception e) {
                        factoryService = null;
                        LOGGER.warn("Failed to initialize URLFactory Service [" + urlFactoryServiceClass + "]", e);
                    }
                }
                if (factoryService == null) {
                    if (LOGGER.isDebugEnabled()) {
                        LOGGER.debug("Using default URLFactory Service Class [" + urlFactoryServiceClass + "]");
                    }
                    factoryService = new XWikiURLFactoryServiceImpl(this);
                }
                // Set the urlFactoryService object in one assignment to prevent threading
                // issues when checking for
                // null above.
                this.urlFactoryService = factoryService;
            }
        }
    }
    return this.urlFactoryService;
}
Also used : XWikiURLFactoryServiceImpl(com.xpn.xwiki.web.XWikiURLFactoryServiceImpl) BaseClass(com.xpn.xwiki.objects.classes.BaseClass) PropertyClass(com.xpn.xwiki.objects.classes.PropertyClass) PasswordClass(com.xpn.xwiki.objects.classes.PasswordClass) MetaClass(com.xpn.xwiki.objects.meta.MetaClass) ParseGroovyFromString(com.xpn.xwiki.internal.render.groovy.ParseGroovyFromString) IncludeServletAsString(com.xpn.xwiki.web.includeservletasstring.IncludeServletAsString) XWikiURLFactoryService(com.xpn.xwiki.web.XWikiURLFactoryService) WikiManagerException(org.xwiki.wiki.manager.WikiManagerException) IOException(java.io.IOException) JobException(org.xwiki.job.JobException) ParseException(org.xwiki.rendering.parser.ParseException) QueryException(org.xwiki.query.QueryException) URIException(org.apache.commons.httpclient.URIException) InvocationTargetException(java.lang.reflect.InvocationTargetException) HibernateException(org.hibernate.HibernateException) ComponentLookupException(org.xwiki.component.manager.ComponentLookupException) NamingException(javax.naming.NamingException) FileNotFoundException(java.io.FileNotFoundException) MalformedURLException(java.net.MalformedURLException)

Aggregations

ParseGroovyFromString (com.xpn.xwiki.internal.render.groovy.ParseGroovyFromString)1 BaseClass (com.xpn.xwiki.objects.classes.BaseClass)1 PasswordClass (com.xpn.xwiki.objects.classes.PasswordClass)1 PropertyClass (com.xpn.xwiki.objects.classes.PropertyClass)1 MetaClass (com.xpn.xwiki.objects.meta.MetaClass)1 XWikiURLFactoryService (com.xpn.xwiki.web.XWikiURLFactoryService)1 XWikiURLFactoryServiceImpl (com.xpn.xwiki.web.XWikiURLFactoryServiceImpl)1 IncludeServletAsString (com.xpn.xwiki.web.includeservletasstring.IncludeServletAsString)1 FileNotFoundException (java.io.FileNotFoundException)1 IOException (java.io.IOException)1 InvocationTargetException (java.lang.reflect.InvocationTargetException)1 MalformedURLException (java.net.MalformedURLException)1 NamingException (javax.naming.NamingException)1 URIException (org.apache.commons.httpclient.URIException)1 HibernateException (org.hibernate.HibernateException)1 ComponentLookupException (org.xwiki.component.manager.ComponentLookupException)1 JobException (org.xwiki.job.JobException)1 QueryException (org.xwiki.query.QueryException)1 ParseException (org.xwiki.rendering.parser.ParseException)1 WikiManagerException (org.xwiki.wiki.manager.WikiManagerException)1