We need to make sure this is documented and fix the tutorial. One shouldn't have to extend the servlet to get Abdera working. I guess its a question of what is best practice... Is it best practice to extend DefaultProvider, add your adapters and then supply the init-param for your provider? The problem I have with this approach is that it seems a little overly simplistic as you still need to get access to your backend somehow (the pre-built adapters are another story).

Dan

David Primmer wrote:
vasu and i figured it out.

I put the init params into the web.xml:

    <init-param>
      <param-name>org.apache.abdera.protocol.server.Provider</param-name>
      <param-value>org.apache.abdera.example.CustomProvider</param-value>
    </init-param>

then i get them from the config and have the manager create the providor:

  @Override
  protected Provider createProvider() {
    return manager.newProvider(getProperties(getServletConfig()));
  }

if you leave the init params out, you create a DefaultProvider instead
of your CustomProvider

davep

On Fri, Apr 11, 2008 at 2:04 PM, David Primmer <[EMAIL PROTECTED]> wrote:
I'm doing server setup that I thought should be better documented.
 Basically, I'd like to make the CustomProvider example work with a
 web.xml based setup. I see some info on it on the wiki but the example
 itself uses java code to compose the app and to start jetty.

 So I made a CustomSampleServlet that extends AbderaServlet and re-uses
 the other two files from the custom example.

 This is what it does:

 public class CustomSampleServlet extends AbderaServlet {

  private final static Log log = LogFactory.getLog(AbderaServlet.class);

  @Override
  protected Provider createProvider() {
    return new CustomProvider();
  }

  @Override
  public void init() {
    log.debug("Initialing Abdera Servlet");
    manager = createServiceManager();
    provider = createProvider();
    log.debug("Using provider - " + provider);
  }

 }


 Then in my web.xml I have what is at the bottom of this page:
 http://cwiki.apache.org/confluence/display/ABDERA/Your+first+AtomPub+Server


 line 179 of ServletRequestContext does:
 Abdera abdera = provider.getAbdera();

 but returns null. This doesn't seem right. Next thing i know, i have a
 null pointer exception on ServletRequestContext.getHost. Can someone
 help with the provider bootstrap code?

 Does this have something to do with leaving out this sort of thing?:
 servletHolder.setInitParameter(ServiceManager.PROVIDER,
 CustomProvider.class.getName());

 thanks.

 davep



--
Dan Diephouse
MuleSource
http://mulesource.com | http://netzooid.com

Reply via email to