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 static final Logger s_log =
|
||||
Logger.getLogger(BebopMapDispatcher.class);
|
||||
/** Private logger instance to help debugging. */
|
||||
private static final Logger s_log = Logger.getLogger(BebopMapDispatcher.class);
|
||||
|
||||
/**
|
||||
* Constructor creates BebopMapDispatcher with empty URL mapped to "/" and
|
||||
|
|
|
|||
|
|
@ -98,7 +98,8 @@ public abstract class BaseApplicationServlet extends BaseServlet {
|
|||
@Override
|
||||
protected final void doService(final HttpServletRequest sreq,
|
||||
final HttpServletResponse sresp)
|
||||
throws ServletException, IOException {
|
||||
throws ServletException, IOException {
|
||||
|
||||
final Application app = getApplication(sreq);
|
||||
|
||||
if (app == null) {
|
||||
|
|
|
|||
|
|
@ -43,7 +43,8 @@ public class FaqDispatcher extends BebopMapDispatcher {
|
|||
Logger.getLogger(FaqDispatcher.class);
|
||||
|
||||
/**
|
||||
*
|
||||
* Constructor, sets up internal data structures and builds the user
|
||||
* interface (public [index] page and admin page)
|
||||
*/
|
||||
public FaqDispatcher() {
|
||||
super();
|
||||
|
|
@ -63,6 +64,10 @@ public class FaqDispatcher extends BebopMapDispatcher {
|
|||
setMap(m);
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
private FaqPage buildIndexPage() {
|
||||
FaqPage p = new FaqPage();
|
||||
|
||||
|
|
@ -79,6 +84,10 @@ public class FaqDispatcher extends BebopMapDispatcher {
|
|||
}
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
private FaqPage buildAdminIndexPage() {
|
||||
|
||||
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;
|
||||
|
||||
// import com.arsdigita.mimetypes.*;
|
||||
//import com.arsdigita.domain.DomainObject;
|
||||
import com.arsdigita.faq.ui.FaqQuestionsPortlet;
|
||||
//import com.arsdigita.kernel.ACSObjectInstantiator;
|
||||
import com.arsdigita.kernel.Kernel;
|
||||
import com.arsdigita.kernel.KernelExcursion;
|
||||
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.runtime.ScriptContext;
|
||||
import com.arsdigita.web.ApplicationType;
|
||||
|
|
@ -85,16 +79,22 @@ public class Loader extends PackageLoader {
|
|||
*/
|
||||
private void loadFAQApplicationType() {
|
||||
|
||||
ApplicationType type = ApplicationType.createApplicationType(
|
||||
"faq",
|
||||
"Frequently Asked Questions",
|
||||
Faq.BASE_DATA_OBJECT_TYPE);
|
||||
type.setDescription
|
||||
("FAQ's empower users to share knowledge.");
|
||||
/* Setup a new style legacy compatible application type. */
|
||||
// ApplicationType type = ApplicationType.createApplicationType(
|
||||
// "faq",
|
||||
// "Frequently Asked Questions",
|
||||
// Faq.BASE_DATA_OBJECT_TYPE);
|
||||
// Current code requires an apps specific dispatcher class. Has to be
|
||||
// modified to be able to create a legacy free app type.
|
||||
type.setDispatcherClass
|
||||
("com.arsdigita.faq.FaqDispatcher");
|
||||
// type.setDispatcherClass
|
||||
// ("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
|
||||
public void init() throws ServletException {
|
||||
super.init();
|
||||
s_log.debug("creating forum page");
|
||||
s_log.debug("creating 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);
|
||||
|
||||
put("/", forum);
|
||||
put("/index.jsp", forum);
|
||||
put("/thread.jsp", thread);
|
||||
if (Forum.getConfig().disableClientPageCaching()) {
|
||||
s_log.debug("caching disabled");
|
||||
disableClientCaching("/");
|
||||
disableClientCaching("/index.jsp");
|
||||
disableClientCaching("/thread.jsp");
|
||||
s_log.debug("caching disabled");
|
||||
disableClientCaching("/");
|
||||
disableClientCaching("/index.jsp");
|
||||
disableClientCaching("/thread.jsp");
|
||||
}
|
||||
|
||||
// allow other pages to be added
|
||||
|
|
@ -73,19 +74,17 @@ public class ForumServlet extends BebopApplicationServlet
|
|||
// for AJAX category asignment
|
||||
Iterator it = ForumPageFactory.getPages();
|
||||
while (it.hasNext()) {
|
||||
Object key = (Object)it.next();
|
||||
if (!key.equals(ForumPageFactory.FORUM_PAGE) &&
|
||||
Object key = (Object)it.next();
|
||||
if (!key.equals(ForumPageFactory.FORUM_PAGE) &&
|
||||
!key.equals(ForumPageFactory.THREAD_PAGE)) {
|
||||
put("/" + key, ForumPageFactory.getPage((String)key));
|
||||
if (Forum.getConfig().disableClientPageCaching()) {
|
||||
disableClientCaching("/" + key);
|
||||
|
||||
put("/" + key, ForumPageFactory.getPage((String)key));
|
||||
if (Forum.getConfig().disableClientPageCaching()) {
|
||||
disableClientCaching("/" + key);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -88,6 +88,7 @@ public class Loader extends PackageLoader {
|
|||
|
||||
/**
|
||||
* TODO: What is it for? Execution is currently commented out.
|
||||
* Referenced class com.arsdigita.forum.Inbox does not exist.
|
||||
* @return
|
||||
*/
|
||||
private static ApplicationType setupInboxAppType() {
|
||||
|
|
|
|||
|
|
@ -47,7 +47,7 @@ ccm-cms-types-newsitem
|
|||
# ccm-auth-http
|
||||
# ccm-bookmarks
|
||||
ccm-docmgr
|
||||
ccm-docrepo
|
||||
# ccm-docrepo
|
||||
ccm-faq
|
||||
# ccm-formbuilder-pdf
|
||||
ccm-forum
|
||||
|
|
|
|||
|
|
@ -63,6 +63,8 @@
|
|||
<!-- <ccm:application name="ccm-auth-http"/> -->
|
||||
<!-- <ccm:application name="ccm-bookmarks"/> -->
|
||||
<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-forum"/>
|
||||
<!-- <ccm:application name="ccm-forum-categorised"/> -->
|
||||
|
|
|
|||
Loading…
Reference in New Issue