CCM NG: Some fixes

git-svn-id: https://svn.libreccm.org/ccm/ccm_ng@4543 8810af33-2d31-482b-a856-94f89814c4df
pull/2/head
jensp 2017-01-30 18:51:18 +00:00
parent 2f4b67dc4e
commit 1485a95de1
12 changed files with 74 additions and 39 deletions

View File

@ -93,17 +93,20 @@
<groupId>org.apache.maven.plugins</groupId> <groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId> <artifactId>maven-war-plugin</artifactId>
<configuration> <configuration>
<!--<webResources>
<resource>
<directory>../ccm-theme-foundry/src/main/resources/themes</directory>
</resource>
</webResources>-->
<overlays> <overlays>
<overlay> <overlay>
<groupId>org.libreccm</groupId> <groupId>org.libreccm</groupId>
<artifactId>ccm-theme-foundry</artifactId> <artifactId>ccm-theme-foundry</artifactId>
<type>jar</type> <type>jar</type>
</overlay> </overlay>
<overlay>
<groupId>org.librecms</groupId>
<artifactId>ccm-cms</artifactId>
<type>jar</type>
<includes>
<include>templates/</include>
</includes>
</overlay>
</overlays> </overlays>
</configuration> </configuration>
</plugin> </plugin>

View File

@ -51,5 +51,11 @@
<Logger name="org.librecms.contentsection.ContentSectionSetup" <Logger name="org.librecms.contentsection.ContentSectionSetup"
level="debug"> level="debug">
</Logger> </Logger>
<Logger name="org.librecms.contentsection.ContentSectionServlet"
level="debug">
</Logger>
<Logger name="com.arsdigita.web.DefaultApplicationFileResolver"
level="debug">
</Logger>
</Loggers> </Loggers>
</Configuration> </Configuration>

View File

@ -31,7 +31,8 @@
<property name="hibernate.hbm2ddl.auto" value="validate"/> <property name="hibernate.hbm2ddl.auto" value="validate"/>
<property name="hibernate.connection.autocommit" value="false" /> <property name="hibernate.connection.autocommit" value="false" />
<property name="hibernate.id.new_generator_mappings" value="true"/> <property name="hibernate.id.new_generator_mappings" value="true"/>
<property name="wildfly.jpa.hibernate.search.module"
value="org.hibernate.search.orm:main"/>
<!-- <!--

View File

@ -30,18 +30,22 @@ public class CmsConstants {
public static final String CMS_BUNDLE = "org.librecms.CmsResources"; public static final String CMS_BUNDLE = "org.librecms.CmsResources";
public static final String CMS_FOLDER_BUNDLE public static final String CMS_FOLDER_BUNDLE
= "com.arsdigita.cms.ui.folder.CMSFolderResources"; = "com.arsdigita.cms.ui.folder.CMSFolderResources";
public static final String CONTENT_CENTER_APP_TYPE public static final String CONTENT_CENTER_APP_TYPE
= "com.arsdigita.cms.ContentCenter"; = "com.arsdigita.cms.ContentCenter";
public static final String CONTENT_CENTER_URL = "/content-center/"; public static final String CONTENT_CENTER_URL = "/content-center/";
public static final String CONTENT_CENTER_DESC_BUNDLE public static final String CONTENT_CENTER_DESC_BUNDLE
= "org.librecms.contentcenter.ContentCenterResources"; = "org.librecms.contentcenter.ContentCenterResources";
public static final String CONTENT_SECTION_APP_TYPE public static final String CONTENT_SECTION_APP_TYPE
= "org.librecms.contentsection.ContentSection"; = "org.librecms.contentsection.ContentSection";
public static final String CONTENT_SECTION_SERVLET_PATH public static final String CONTENT_SECTION_SERVLET_PATH
= "/templates/servlet/content-section/*"; = "/templates/servlet/content-section/*";
public static final String CMS_SERVICE_SERVLET_PATH
= "/templates/servlet/cms-service/*";
public static final String CONTENT_ITEM_SERVLET_PATH
= "/templates/servlet/content-item/*";
public static final String CONTENT_SECTION_DESC_BUNDLE public static final String CONTENT_SECTION_DESC_BUNDLE
= "org.librecms.contentsection.ContentSectionResources"; = "org.librecms.contentsection.ContentSectionResources";

View File

@ -51,6 +51,7 @@ import javax.servlet.http.HttpServletResponse;
import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger; import org.apache.logging.log4j.Logger;
import org.arsdigita.cms.CMSConfig;
import org.libreccm.cdi.utils.CdiUtil; import org.libreccm.cdi.utils.CdiUtil;
import org.libreccm.l10n.GlobalizationHelper; import org.libreccm.l10n.GlobalizationHelper;
import org.libreccm.security.PermissionChecker; import org.libreccm.security.PermissionChecker;
@ -100,7 +101,11 @@ import javax.servlet.RequestDispatcher;
* @author <a href="mailto:pboy@barkhof.uni-bremen.de">Peter Boy</a> * @author <a href="mailto:pboy@barkhof.uni-bremen.de">Peter Boy</a>
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a> * @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
*/ */
@WebServlet(urlPatterns = {CmsConstants.CONTENT_SECTION_SERVLET_PATH}) @WebServlet(urlPatterns = {CmsConstants.CONTENT_SECTION_SERVLET_PATH,
"/templates/servlet/content-section/",
"/templates/servlet/content-section",
CmsConstants.CMS_SERVICE_SERVLET_PATH,
CmsConstants.CONTENT_ITEM_SERVLET_PATH})
public class ContentSectionServlet extends BaseApplicationServlet { public class ContentSectionServlet extends BaseApplicationServlet {
private static final long serialVersionUID = 8061725145564728637L; private static final long serialVersionUID = 8061725145564728637L;
@ -173,17 +178,15 @@ public class ContentSectionServlet extends BaseApplicationServlet {
// optional init-param named template-path from ~/WEB-INF/web.xml // optional init-param named template-path from ~/WEB-INF/web.xml
// may overwrite configuration parameters // may overwrite configuration parameters
String templatePath = config.getInitParameter("template-path"); String templatePath = config.getInitParameter("template-path");
//ToDo if (templatePath == null) {
/*if (templatePath == null) { m_templatePath = CMSConfig.getConfig().getTemplateRootPath();
m_templatePath = ContentSection.getConfig().getTemplateRoot();
} else { } else {
m_templatePath = config.getInitParameter("template-path"); m_templatePath = config.getInitParameter("template-path");
}*/ }
// optional init-param named file-resolver from ~/WEB-INF/web.xml // optional init-param named file-resolver from ~/WEB-INF/web.xml
String resolverName = config.getInitParameter("file-resolver"); String resolverName = config.getInitParameter("file-resolver");
//ToDo
if (resolverName == null) { if (resolverName == null) {
m_resolver = WebConfig.getConfig().getResolver(); m_resolver = WebConfig.getConfig().getResolver();
} else { } else {
@ -196,7 +199,7 @@ public class ContentSectionServlet extends BaseApplicationServlet {
// NEW STUFF here will be used to process the pages in this servlet // NEW STUFF here will be used to process the pages in this servlet
// Currently NOT working // Currently NOT working
// addPage("/admin", new MainPage()); // index page at address ~/cs // addPage("/admin", new MainPage()); // index page at address ~/cs
// addPage("/admin/index.jsp", new MainPage()); // addPage("/admin/index.jsp", new MainPage());
// addPage("/admin/item.jsp", new MainPage()); // addPage("/admin/item.jsp", new MainPage());
} }
@ -246,16 +249,19 @@ public class ContentSectionServlet extends BaseApplicationServlet {
//Only for testing PageModel //Only for testing PageModel
if (url != null && url.endsWith("page-model/")) { if (url != null && url.endsWith("page-model/")) {
getServletContext() getServletContext()
.getRequestDispatcher("/page-model.bebop") .getRequestDispatcher("/page-model.bebop")
.include(request, response); .include(request, response);
return; return;
} }
//End Test PageModel //End Test PageModel
LOGGER.info("Resolving URL {} and trying as item first."); LOGGER.info("Resolving URL {} and trying as item first.", url);
final ItemResolver itemResolver = getItemResolver(section); final ItemResolver itemResolver = getItemResolver(section);
String pathInfo = request.getPathInfo(); String pathInfo = request.getPathInfo();
if (pathInfo == null) {
pathInfo = "/";
}
final ContentItem item = getItem(section, pathInfo, itemResolver); final ContentItem item = getItem(section, pathInfo, itemResolver);
@ -314,7 +320,9 @@ public class ContentSectionServlet extends BaseApplicationServlet {
request.setAttribute(CONTENT_SECTION, section); request.setAttribute(CONTENT_SECTION, section);
RequestDispatcher rd = m_resolver.resolve(m_templatePath, RequestDispatcher rd = m_resolver.resolve(m_templatePath,
request, response, app); request,
response,
app);
if (rd != null) { if (rd != null) {
if (LOGGER.isDebugEnabled()) { if (LOGGER.isDebugEnabled()) {
LOGGER.debug("Got dispatcher " + rd); LOGGER.debug("Got dispatcher " + rd);
@ -323,7 +331,7 @@ public class ContentSectionServlet extends BaseApplicationServlet {
response); response);
} else { } else {
if (LOGGER.isDebugEnabled()) { if (LOGGER.isDebugEnabled()) {
LOGGER.debug("No dispatcher found for" + rd); LOGGER.debug("No dispatcher found for " + rd);
} }
String requestUri = request.getRequestURI(); // same as ctx.getRemainingURLPart() String requestUri = request.getRequestURI(); // same as ctx.getRemainingURLPart()
response.sendError(404, requestUri response.sendError(404, requestUri
@ -370,7 +378,6 @@ public class ContentSectionServlet extends BaseApplicationServlet {
// //
// templateResolver.setTemplateContext(sTemplateContext, request); // templateResolver.setTemplateContext(sTemplateContext, request);
// ToDo End // ToDo End
// Work out how long to cache for.... // Work out how long to cache for....
// We take minimum(default timeout, lifecycle expiry) // We take minimum(default timeout, lifecycle expiry)
Lifecycle cycle = item.getLifecycle(); Lifecycle cycle = item.getLifecycle();
@ -444,9 +451,6 @@ public class ContentSectionServlet extends BaseApplicationServlet {
if (url.endsWith(XML_SUFFIX)) { if (url.endsWith(XML_SUFFIX)) {
request.setAttribute(XML_MODE, Boolean.TRUE); request.setAttribute(XML_MODE, Boolean.TRUE);
LOGGER.debug("StraightXML Requested"); LOGGER.debug("StraightXML Requested");
itemUrl = String.format(
"/%s",
url.substring(0, url.length() - XML_SUFFIX.length()));
itemUrl = "/" + url.substring(0, url.length() - XML_SUFFIX.length()); itemUrl = "/" + url.substring(0, url.length() - XML_SUFFIX.length());
} else { } else {
request.setAttribute(XML_MODE, Boolean.FALSE); request.setAttribute(XML_MODE, Boolean.FALSE);

View File

@ -18,6 +18,8 @@
*/ */
package org.librecms.contentsection; package org.librecms.contentsection;
import com.arsdigita.cms.dispatcher.MultilingualItemResolver;
import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger; import org.apache.logging.log4j.Logger;
import org.libreccm.modules.InstallEvent; import org.libreccm.modules.InstallEvent;
@ -44,6 +46,8 @@ public class ContentSectionSetup extends AbstractCcmApplicationSetup {
private static final String INITIAL_CONTENT_SECTIONS private static final String INITIAL_CONTENT_SECTIONS
= "org.librecms.initial_content_sections"; = "org.librecms.initial_content_sections";
private static final String DEFAULT_ITEM_RESOLVER
= "org.librecms.default_item_resolver";
public ContentSectionSetup(final InstallEvent event) { public ContentSectionSetup(final InstallEvent event) {
super(event); super(event);
@ -79,6 +83,16 @@ public class ContentSectionSetup extends AbstractCcmApplicationSetup {
section.setDisplayName(sectionName); section.setDisplayName(sectionName);
section.setLabel(sectionName); section.setLabel(sectionName);
if (getIntegrationProps().getProperty(DEFAULT_ITEM_RESOLVER) == null
|| getIntegrationProps().getProperty(DEFAULT_ITEM_RESOLVER)
.trim().isEmpty()) {
section.setItemResolverClass(getIntegrationProps().getProperty(
DEFAULT_ITEM_RESOLVER));
} else {
section.setItemResolverClass(MultilingualItemResolver.class
.getName());
}
LOGGER.debug("New content section properties: " LOGGER.debug("New content section properties: "
+ "uuid = {}; " + "uuid = {}; "
+ "applicationType = \"{}\"; " + "applicationType = \"{}\"; "

View File

@ -499,6 +499,9 @@ public class CCMDispatcherServlet extends BaseServlet {
if (path.length() > (m_instanceURI.length() + 1)) { if (path.length() > (m_instanceURI.length() + 1)) {
target.append(path.substring(m_instanceURI.length() + 1)); target.append(path.substring(m_instanceURI.length() + 1));
} }
if (target.charAt(target.length() - 1) != '/') {
target.append('/');
}
target.append("?"); target.append("?");
target.append(BaseApplicationServlet.APPLICATION_ID_PARAMETER); target.append(BaseApplicationServlet.APPLICATION_ID_PARAMETER);
target.append("="); target.append("=");

View File

@ -277,7 +277,7 @@
<dependency> <dependency>
<groupId>org.hibernate</groupId> <groupId>org.hibernate</groupId>
<artifactId>hibernate-search-orm</artifactId> <artifactId>hibernate-search-orm</artifactId>
<version>5.5.5.Final</version> <version>5.5.4.Final</version>
</dependency> </dependency>
<!-- <!--