Erster Versuch, anhand von ccm-faq eine legacy compatible app mit dispatcher zu ersetzen durch eine legacy free app ohne dispatcher sondern mit application servlet. Noch nicht vollständig erfolgreich. Weitere Formatierungen.
git-svn-id: https://svn.libreccm.org/ccm/trunk@939 8810af33-2d31-482b-a856-94f89814c4dfmaster
parent
f0ce996a35
commit
71fc621f8d
|
|
@ -42,8 +42,8 @@ public class BebopMapDispatcher extends MapDispatcher {
|
||||||
|
|
||||||
private PresentationManager m_presManager;
|
private PresentationManager m_presManager;
|
||||||
|
|
||||||
private static final Logger s_log =
|
/** Private logger instance to help debugging. */
|
||||||
Logger.getLogger(BebopMapDispatcher.class);
|
private static final Logger s_log = Logger.getLogger(BebopMapDispatcher.class);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor creates BebopMapDispatcher with empty URL mapped to "/" and
|
* Constructor creates BebopMapDispatcher with empty URL mapped to "/" and
|
||||||
|
|
|
||||||
|
|
@ -98,7 +98,8 @@ public abstract class BaseApplicationServlet extends BaseServlet {
|
||||||
@Override
|
@Override
|
||||||
protected final void doService(final HttpServletRequest sreq,
|
protected final void doService(final HttpServletRequest sreq,
|
||||||
final HttpServletResponse sresp)
|
final HttpServletResponse sresp)
|
||||||
throws ServletException, IOException {
|
throws ServletException, IOException {
|
||||||
|
|
||||||
final Application app = getApplication(sreq);
|
final Application app = getApplication(sreq);
|
||||||
|
|
||||||
if (app == null) {
|
if (app == null) {
|
||||||
|
|
|
||||||
|
|
@ -43,7 +43,8 @@ public class FaqDispatcher extends BebopMapDispatcher {
|
||||||
Logger.getLogger(FaqDispatcher.class);
|
Logger.getLogger(FaqDispatcher.class);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
* Constructor, sets up internal data structures and builds the user
|
||||||
|
* interface (public [index] page and admin page)
|
||||||
*/
|
*/
|
||||||
public FaqDispatcher() {
|
public FaqDispatcher() {
|
||||||
super();
|
super();
|
||||||
|
|
@ -63,6 +64,10 @@ public class FaqDispatcher extends BebopMapDispatcher {
|
||||||
setMap(m);
|
setMap(m);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
private FaqPage buildIndexPage() {
|
private FaqPage buildIndexPage() {
|
||||||
FaqPage p = new FaqPage();
|
FaqPage p = new FaqPage();
|
||||||
|
|
||||||
|
|
@ -79,6 +84,10 @@ public class FaqDispatcher extends BebopMapDispatcher {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
private FaqPage buildAdminIndexPage() {
|
private FaqPage buildAdminIndexPage() {
|
||||||
|
|
||||||
FaqPage p = new FaqPage("admin");
|
FaqPage p = new FaqPage("admin");
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,92 @@
|
||||||
|
/*
|
||||||
|
* Copyright (C) 2011 Peter boy (pboy@barkhof.uni-bremen.de
|
||||||
|
*
|
||||||
|
* This library is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU Lesser General Public License
|
||||||
|
* as published by the Free Software Foundation; either version 2.1 of
|
||||||
|
* the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This library is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
* Lesser General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Lesser General Public
|
||||||
|
* License along with this library; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
package com.arsdigita.faq;
|
||||||
|
|
||||||
|
import com.arsdigita.bebop.Page;
|
||||||
|
import com.arsdigita.bebop.page.BebopApplicationServlet;
|
||||||
|
import com.arsdigita.faq.ui.FaqAdminView;
|
||||||
|
import com.arsdigita.faq.ui.FaqPage;
|
||||||
|
import com.arsdigita.faq.ui.FaqUserView;
|
||||||
|
import javax.servlet.ServletException;
|
||||||
|
|
||||||
|
import org.apache.log4j.Logger;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author pb
|
||||||
|
*/
|
||||||
|
public class FaqServlet extends BebopApplicationServlet {
|
||||||
|
|
||||||
|
/** Private logger instance to faciliate debugging procedures */
|
||||||
|
private static final Logger s_log = Logger.getLogger(FaqServlet.class);
|
||||||
|
|
||||||
|
|
||||||
|
public void init() throws ServletException {
|
||||||
|
super.init();
|
||||||
|
|
||||||
|
Page index = buildIndexPage();
|
||||||
|
Page admin = buildAdminIndexPage();
|
||||||
|
|
||||||
|
put("/", index);
|
||||||
|
put("/index.jsp", index);
|
||||||
|
put("/one.jsp", index);
|
||||||
|
|
||||||
|
put("admin/", admin);
|
||||||
|
put("admin/index.jsp", admin);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
private FaqPage buildIndexPage() {
|
||||||
|
FaqPage p = new FaqPage();
|
||||||
|
|
||||||
|
p.add(new FaqUserView());
|
||||||
|
|
||||||
|
/*CommentsService commentsService =
|
||||||
|
* new CommentsService(req, FaqHelper.getFaqID(req));
|
||||||
|
* p.add(commentsService.buildCommentsComponent(
|
||||||
|
* "comments/one-object"));
|
||||||
|
*/
|
||||||
|
|
||||||
|
p.lock();
|
||||||
|
return p;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
private FaqPage buildAdminIndexPage() {
|
||||||
|
|
||||||
|
FaqPage p = new FaqPage("admin");
|
||||||
|
|
||||||
|
FaqAdminView faqAdminTabs = new FaqAdminView();
|
||||||
|
faqAdminTabs.setKey("FaqAdminTabs");
|
||||||
|
p.add(faqAdminTabs);
|
||||||
|
|
||||||
|
p.lock();
|
||||||
|
return p;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -18,16 +18,10 @@
|
||||||
*/
|
*/
|
||||||
package com.arsdigita.faq;
|
package com.arsdigita.faq;
|
||||||
|
|
||||||
// import com.arsdigita.mimetypes.*;
|
|
||||||
//import com.arsdigita.domain.DomainObject;
|
|
||||||
import com.arsdigita.faq.ui.FaqQuestionsPortlet;
|
import com.arsdigita.faq.ui.FaqQuestionsPortlet;
|
||||||
//import com.arsdigita.kernel.ACSObjectInstantiator;
|
|
||||||
import com.arsdigita.kernel.Kernel;
|
import com.arsdigita.kernel.Kernel;
|
||||||
import com.arsdigita.kernel.KernelExcursion;
|
import com.arsdigita.kernel.KernelExcursion;
|
||||||
import com.arsdigita.loader.PackageLoader;
|
import com.arsdigita.loader.PackageLoader;
|
||||||
//import com.arsdigita.persistence.DataObject;
|
|
||||||
//import com.arsdigita.portal.PortletType;
|
|
||||||
//import com.arsdigita.portal.apportlet.AppPortletSetup;
|
|
||||||
import com.arsdigita.portal.apportlet.AppPortletType;
|
import com.arsdigita.portal.apportlet.AppPortletType;
|
||||||
import com.arsdigita.runtime.ScriptContext;
|
import com.arsdigita.runtime.ScriptContext;
|
||||||
import com.arsdigita.web.ApplicationType;
|
import com.arsdigita.web.ApplicationType;
|
||||||
|
|
@ -85,16 +79,22 @@ public class Loader extends PackageLoader {
|
||||||
*/
|
*/
|
||||||
private void loadFAQApplicationType() {
|
private void loadFAQApplicationType() {
|
||||||
|
|
||||||
ApplicationType type = ApplicationType.createApplicationType(
|
/* Setup a new style legacy compatible application type. */
|
||||||
"faq",
|
// ApplicationType type = ApplicationType.createApplicationType(
|
||||||
"Frequently Asked Questions",
|
// "faq",
|
||||||
Faq.BASE_DATA_OBJECT_TYPE);
|
// "Frequently Asked Questions",
|
||||||
type.setDescription
|
// Faq.BASE_DATA_OBJECT_TYPE);
|
||||||
("FAQ's empower users to share knowledge.");
|
|
||||||
// Current code requires an apps specific dispatcher class. Has to be
|
// Current code requires an apps specific dispatcher class. Has to be
|
||||||
// modified to be able to create a legacy free app type.
|
// modified to be able to create a legacy free app type.
|
||||||
type.setDispatcherClass
|
// type.setDispatcherClass
|
||||||
("com.arsdigita.faq.FaqDispatcher");
|
// ("com.arsdigita.faq.FaqDispatcher");
|
||||||
|
|
||||||
|
/* Setup as new stype legacy free aplcation */
|
||||||
|
ApplicationType type = new ApplicationType("FAQ",
|
||||||
|
Faq.BASE_DATA_OBJECT_TYPE);
|
||||||
|
// type independent:
|
||||||
|
type.setDescription
|
||||||
|
("Frequently Asked Questions empower users to share knowledge.");
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -53,19 +53,20 @@ public class ForumServlet extends BebopApplicationServlet
|
||||||
@Override
|
@Override
|
||||||
public void init() throws ServletException {
|
public void init() throws ServletException {
|
||||||
super.init();
|
super.init();
|
||||||
s_log.debug("creating forum page");
|
s_log.debug("creating forum page");
|
||||||
|
|
||||||
final Page forum = ForumPageFactory.getPage(ForumPageFactory.FORUM_PAGE);
|
final Page forum = ForumPageFactory.getPage(ForumPageFactory.FORUM_PAGE);
|
||||||
s_log.debug("creating thread page");
|
s_log.debug("creating thread page");
|
||||||
final Page thread = ForumPageFactory.getPage(ForumPageFactory.THREAD_PAGE);
|
final Page thread = ForumPageFactory.getPage(ForumPageFactory.THREAD_PAGE);
|
||||||
|
|
||||||
put("/", forum);
|
put("/", forum);
|
||||||
put("/index.jsp", forum);
|
put("/index.jsp", forum);
|
||||||
put("/thread.jsp", thread);
|
put("/thread.jsp", thread);
|
||||||
if (Forum.getConfig().disableClientPageCaching()) {
|
if (Forum.getConfig().disableClientPageCaching()) {
|
||||||
s_log.debug("caching disabled");
|
s_log.debug("caching disabled");
|
||||||
disableClientCaching("/");
|
disableClientCaching("/");
|
||||||
disableClientCaching("/index.jsp");
|
disableClientCaching("/index.jsp");
|
||||||
disableClientCaching("/thread.jsp");
|
disableClientCaching("/thread.jsp");
|
||||||
}
|
}
|
||||||
|
|
||||||
// allow other pages to be added
|
// allow other pages to be added
|
||||||
|
|
@ -73,13 +74,12 @@ public class ForumServlet extends BebopApplicationServlet
|
||||||
// for AJAX category asignment
|
// for AJAX category asignment
|
||||||
Iterator it = ForumPageFactory.getPages();
|
Iterator it = ForumPageFactory.getPages();
|
||||||
while (it.hasNext()) {
|
while (it.hasNext()) {
|
||||||
Object key = (Object)it.next();
|
Object key = (Object)it.next();
|
||||||
if (!key.equals(ForumPageFactory.FORUM_PAGE) &&
|
if (!key.equals(ForumPageFactory.FORUM_PAGE) &&
|
||||||
!key.equals(ForumPageFactory.THREAD_PAGE)) {
|
!key.equals(ForumPageFactory.THREAD_PAGE)) {
|
||||||
put("/" + key, ForumPageFactory.getPage((String)key));
|
put("/" + key, ForumPageFactory.getPage((String)key));
|
||||||
if (Forum.getConfig().disableClientPageCaching()) {
|
if (Forum.getConfig().disableClientPageCaching()) {
|
||||||
disableClientCaching("/" + key);
|
disableClientCaching("/" + key);
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -87,5 +87,4 @@ public class ForumServlet extends BebopApplicationServlet
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -88,6 +88,7 @@ public class Loader extends PackageLoader {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* TODO: What is it for? Execution is currently commented out.
|
* TODO: What is it for? Execution is currently commented out.
|
||||||
|
* Referenced class com.arsdigita.forum.Inbox does not exist.
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
private static ApplicationType setupInboxAppType() {
|
private static ApplicationType setupInboxAppType() {
|
||||||
|
|
|
||||||
|
|
@ -47,7 +47,7 @@ ccm-cms-types-newsitem
|
||||||
# ccm-auth-http
|
# ccm-auth-http
|
||||||
# ccm-bookmarks
|
# ccm-bookmarks
|
||||||
ccm-docmgr
|
ccm-docmgr
|
||||||
ccm-docrepo
|
# ccm-docrepo
|
||||||
ccm-faq
|
ccm-faq
|
||||||
# ccm-formbuilder-pdf
|
# ccm-formbuilder-pdf
|
||||||
ccm-forum
|
ccm-forum
|
||||||
|
|
|
||||||
|
|
@ -63,6 +63,8 @@
|
||||||
<!-- <ccm:application name="ccm-auth-http"/> -->
|
<!-- <ccm:application name="ccm-auth-http"/> -->
|
||||||
<!-- <ccm:application name="ccm-bookmarks"/> -->
|
<!-- <ccm:application name="ccm-bookmarks"/> -->
|
||||||
<ccm:application name="ccm-docmgr"/>
|
<ccm:application name="ccm-docmgr"/>
|
||||||
|
<!-- <ccm:application name="ccm-docrepo"/> -->
|
||||||
|
<ccm:application name="ccm-faq"/>
|
||||||
<!-- <ccm:application name="ccm-formbuilder-pdf"/> -->
|
<!-- <ccm:application name="ccm-formbuilder-pdf"/> -->
|
||||||
<ccm:application name="ccm-forum"/>
|
<ccm:application name="ccm-forum"/>
|
||||||
<!-- <ccm:application name="ccm-forum-categorised"/> -->
|
<!-- <ccm:application name="ccm-forum-categorised"/> -->
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue