abdera-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "David Primmer" <david.prim...@gmail.com>
Subject Re: need help with the custom provider example
Date Fri, 11 Apr 2008 22:27:36 GMT
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 <david.primmer@gmail.com> 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
>

Mime
View raw message