CCM NG: Some fixes

git-svn-id: https://svn.libreccm.org/ccm/ccm_ng@4543 8810af33-2d31-482b-a856-94f89814c4df

Former-commit-id: 3e7bfa33aa
pull/2/head
jensp 2017-01-30 18:51:18 +00:00
parent 6949d6f496
commit 69e4b2f5a5
12 changed files with 74 additions and 39 deletions

View File

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

View File

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

View File

@ -31,7 +31,8 @@
<property name="hibernate.hbm2ddl.auto" value="validate"/>
<property name="hibernate.connection.autocommit" value="false" />
<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_FOLDER_BUNDLE
= "com.arsdigita.cms.ui.folder.CMSFolderResources";
= "com.arsdigita.cms.ui.folder.CMSFolderResources";
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_DESC_BUNDLE
= "org.librecms.contentcenter.ContentCenterResources";
= "org.librecms.contentcenter.ContentCenterResources";
public static final String CONTENT_SECTION_APP_TYPE
= "org.librecms.contentsection.ContentSection";
public static final String CONTENT_SECTION_SERVLET_PATH
= "/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
= "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.Logger;
import org.arsdigita.cms.CMSConfig;
import org.libreccm.cdi.utils.CdiUtil;
import org.libreccm.l10n.GlobalizationHelper;
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: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 {
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
// may overwrite configuration parameters
String templatePath = config.getInitParameter("template-path");
//ToDo
/*if (templatePath == null) {
m_templatePath = ContentSection.getConfig().getTemplateRoot();
if (templatePath == null) {
m_templatePath = CMSConfig.getConfig().getTemplateRootPath();
} else {
m_templatePath = config.getInitParameter("template-path");
}*/
}
// optional init-param named file-resolver from ~/WEB-INF/web.xml
String resolverName = config.getInitParameter("file-resolver");
//ToDo
if (resolverName == null) {
m_resolver = WebConfig.getConfig().getResolver();
} else {
@ -196,7 +199,7 @@ public class ContentSectionServlet extends BaseApplicationServlet {
// NEW STUFF here will be used to process the pages in this servlet
// 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/item.jsp", new MainPage());
}
@ -246,16 +249,19 @@ public class ContentSectionServlet extends BaseApplicationServlet {
//Only for testing PageModel
if (url != null && url.endsWith("page-model/")) {
getServletContext()
.getRequestDispatcher("/page-model.bebop")
.include(request, response);
.getRequestDispatcher("/page-model.bebop")
.include(request, response);
return;
}
//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);
String pathInfo = request.getPathInfo();
if (pathInfo == null) {
pathInfo = "/";
}
final ContentItem item = getItem(section, pathInfo, itemResolver);
@ -314,7 +320,9 @@ public class ContentSectionServlet extends BaseApplicationServlet {
request.setAttribute(CONTENT_SECTION, section);
RequestDispatcher rd = m_resolver.resolve(m_templatePath,
request, response, app);
request,
response,
app);
if (rd != null) {
if (LOGGER.isDebugEnabled()) {
LOGGER.debug("Got dispatcher " + rd);
@ -323,7 +331,7 @@ public class ContentSectionServlet extends BaseApplicationServlet {
response);
} else {
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()
response.sendError(404, requestUri
@ -370,7 +378,6 @@ public class ContentSectionServlet extends BaseApplicationServlet {
//
// templateResolver.setTemplateContext(sTemplateContext, request);
// ToDo End
// Work out how long to cache for....
// We take minimum(default timeout, lifecycle expiry)
Lifecycle cycle = item.getLifecycle();
@ -444,9 +451,6 @@ public class ContentSectionServlet extends BaseApplicationServlet {
if (url.endsWith(XML_SUFFIX)) {
request.setAttribute(XML_MODE, Boolean.TRUE);
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());
} else {
request.setAttribute(XML_MODE, Boolean.FALSE);

View File

@ -18,6 +18,8 @@
*/
package org.librecms.contentsection;
import com.arsdigita.cms.dispatcher.MultilingualItemResolver;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.libreccm.modules.InstallEvent;
@ -44,6 +46,8 @@ public class ContentSectionSetup extends AbstractCcmApplicationSetup {
private static final String 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) {
super(event);
@ -79,6 +83,16 @@ public class ContentSectionSetup extends AbstractCcmApplicationSetup {
section.setDisplayName(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: "
+ "uuid = {}; "
+ "applicationType = \"{}\"; "

View File

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

View File

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