"Binder" tutorial errata (for 6.1)?
Jeff Hoffman <[email protected]>
| Newsgroups | gmane.linux.redhat.ccm.general |
|---|---|
| Message-ID | <[email protected]> |
Hello,
Is the documentation errata available publicly, anywhere? Has any errata
been published, so far?
If not, I have the following to submit, after having struggled to get
the Binder application tutorial up and running on my 6.1 installation:
- The documentation specifies than the optional data attribute can be
used to specify a custom loader, and even specifies its use in the
binder app. It does not, however, provide the loader. Here is the one I
used:
---
package com.example.binder;
import com.arsdigita.kernel.KernelExcursion;
import com.arsdigita.loader.PackageLoader;
import com.arsdigita.runtime.ScriptContext;
import com.arsdigita.kernel.Kernel;
import com.arsdigita.web.Application;
import com.arsdigita.web.ApplicationType;
import org.apache.log4j.Logger;
public class BinderLoader extends PackageLoader {
private static final Logger s_log =
Logger.getLogger(BinderLoader.class);
public BinderLoader() {
}
public void run(final ScriptContext ctx) {
new KernelExcursion() {
public void excurse() {
setEffectiveParty(Kernel.getSystemParty());
loadBinderApp();
}
}.run();
}
private Application loadBinderApp() {
ApplicationType binderType = ApplicationType.createApplicationType(
"binder", "Binder", Binder.BASE_DATA_OBJECT_TYPE);
binderType.setDescription("Jeff's Binder");
Application binder = Application.createApplication(binderType,
"binder",
"Binder 1",
null);
return binder;
}
}
---
- Once the loader has run, the application still bails with a
NullPointerException in BaseDispatcher.forward(). Inspecting the code
revealed that Web.getServletContext(contextPath) was returning null.
Further inspection of ContextRegistrationServlet revealed its existance
and purpose.
The following web.xml worked for me, where the one in the docs did not.
YMMV:
---
<!DOCTYPE web-app
PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
"http://java.sun.com/j2ee/dtds/web-app_2_3.dtd">
<web-app>
<servlet>
<servlet-name>binder</servlet-name>
<servlet-class>com.example.binder.BinderServlet</servlet-class>
</servlet>
<servlet>
<servlet-name>reg</servlet-name>
<servlet-class>com.arsdigita.web.ContextRegistrationServlet</servlet-class>
<init-param>
<param-name>uri</param-name>
<param-value>/binder/</param-value>
</init-param>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>binder</servlet-name>
<url-pattern>/*</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>reg</servlet-name>
<url-pattern>/__ccm__/null/reg/*</url-pattern>
</servlet-mapping>
</web-app>
---
- The location of web.xml in the docs was shown as:
web/binder/WEB-INF/web.xml
Perhaps because I created my project, called binder itself, with
ccm-devel-create.pl, this location was redundant for me. I used:
web/WEB-INF/web.xml
and it worked for me.
Hope this helps someone. If I did anything naive, or missed an
opportunity for completeness, I'd appreciate pointers.
Jeff K. Hoffman
Chief Technology Officer
Planned Giving Design Center
Any corrections or additions for completeness would be appreciated.
--
Redhat-ccm-list mailing list
[email protected]
https://www.redhat.com/mailman/listinfo/redhat-ccm-list
Archives: https://www.redhat.com/pipermail/redhat-ccm-list/