On Fri, 2005-12-16 at 12:46, Sean Gilligan wrote:
> Thanks, Allen.  Looks good!  My only suggestion for a possible change is 
> that perhaps the rsd.vm file shouldn't live in the "flavors" directory, 
> since it is no longer being served by the FlavorServlet?

true, however i don't think that's a big deal.  we actually had things that way 
for the foaf feeds already.

> 
> Should I resubmit my patch with website.vm referencing the new RSD url? 
>   Should I also move rsd.vm to another location?  Should I add this 
> servlet to the patch?  What about web.xml?  Is it generated by xdoclet?

yes, we will need to use the new RSD url.  i will handle the rest as far as 
adding the RSDServlet and rsd.vm.

-- Allen

> 
> -- Sean
> 
> Allen Gilliland wrote:
> > I hacked up a very simple RSDServlet which uses velocity and I am willing 
> > to commit it if everyone is in agreement.  This will add a new servlet 
> > mapped to /rsd/*, so that you can get the rsd for a weblog via 
> > /rsd/<handle>.
> > 
> > Here's the code if anyone really wants to take a look ...
> > 
> > public class RSDServlet extends VelocityServlet {
> >     
> >     private static Log mLogger = LogFactory.getLog(RSDServlet.class);
> >     
> >     
> >     /**
> >      * Process a request for an rsd file.
> >      */
> >     public Template handleRequest(HttpServletRequest request,
> >                                 HttpServletResponse response, 
> >                                 Context ctx) 
> >             throws IOException {
> >         
> >         Template template = null;
> >         WeblogRequest weblogRequest = null;
> >         WebsiteData weblog = null;
> >         
> >         // first off lets parse the incoming request and validate it
> >         try {
> >             weblogRequest = new WeblogRequest(request);
> >             
> >             // now make sure the specified weblog really exists
> >             UserManager userMgr = 
> > RollerFactory.getRoller().getUserManager();
> >             weblog = 
> > userMgr.getWebsiteByHandle(weblogRequest.getWeblogHandle(), Boolean.TRUE);
> >             
> >         } catch(InvalidRequestException ire) {
> >             // An error initializing the request is considered to be a 404
> >             response.sendError(HttpServletResponse.SC_NOT_FOUND);
> >             request.setAttribute("DisplayException", ire);
> >             mLogger.error("Bad Request: "+ire.getMessage());
> >             
> >             return null;
> >             
> >         } catch(RollerException re) {
> >             // error looking up the weblog, we assume it doesn't exist
> >             response.sendError(HttpServletResponse.SC_NOT_FOUND);
> >             request.setAttribute("DisplayException", re);
> >             mLogger.warn("Unable to lookup weblog ["+
> >                     weblogRequest.getWeblogHandle()+"] "+re.getMessage());
> >             
> >             return null;
> >         }
> >         
> >         
> >         // request appears to be valid, lets render
> >         try {
> >             
> >             // setup context
> >             ctx.put("website", weblog);
> >             
> >             RollerContext rollerContext = new RollerContext();
> >             ctx.put("absBaseURL", 
> > rollerContext.getAbsoluteContextUrl(request));
> >             
> >             // lookup our rsd template
> >             template = getTemplate("/flavors/rsd.vm");
> >             
> >             // make sure response content type is properly set
> >             response.setContentType("application/rsd+xml");
> >             
> >         } catch(ResourceNotFoundException rnfe ) {
> >             
> >             response.sendError(HttpServletResponse.SC_NOT_FOUND);
> >             request.setAttribute("DisplayException", rnfe);
> >             mLogger.warn("ResourceNotFound: "+ request.getRequestURL());
> >             mLogger.debug(rnfe);
> >         } catch(Exception e) {
> >             
> >             
> > response.sendError(HttpServletResponse.SC_INTERNAL_SERVER_ERROR);
> >             request.setAttribute("DisplayException", e);
> >             mLogger.error("Unexpected exception", e);
> >         }
> >         
> >         return template;
> >     }
> >     
> > }
> > 
> > 
> > and the rsd.vm file ...
> > 
> > <rsd version="1.0">
> >   <service>
> >     <engineName>Roller Weblogger</engineName>
> >     <engineLink>http://www.rollerweblogger.org/</engineLink>
> >     <homePageLink>${absBaseURL}/page/${website.handle}/</homePageLink>
> >     <apis>
> >       <api name="blogger" preferred="false"
> >          apiLink="${absBaseURL}/xmlrpc"
> >          blogID="${website.handle}"/> 
> >       <api name="metaWeblog" preferred="true"
> >          apiLink="${absBaseURL}/xmlrpc"
> >          blogID="${website.handle}"/>
> >     </apis>
> >   </service>
> > </rsd>
> > 
> > -- Allen
> > 
> > 
> > On Wed, 2005-12-14 at 20:46, Sean Gilligan wrote:
> >> Allen Gilliland wrote:
> >>> I don't think the patch came through because I'm guessing the mailing
> >>> list is stripping all attachments :/
> >> I attached the patch to ROL-930 in JIRA:
> >> http://opensource2.atlassian.com/projects/roller/browse/ROL-930
> >> rather than to the mailing list.
> >>
> >>> Also, I want to be fairly careful about the decision to just add the RSD
> >>> support to the FlavorServlet.  I still prefer the RSD servlet idea.
> >> I think the RSDServlet idea makes sense, but I'm a Roller beginner and 
> >> have no real experience with Struts.  (I'm migrating my web-layer skills 
> >> from Turbine to SpringMVC)
> >>
> >> In any event, someone could commit the patch I've submitted and that 
> >> would enable RSD  and update the theme templates.  Separately (and 
> >> hopefully before 2.1) someone could create an RSDServlet (or 
> >> RSDController, etc.) as a more lightweight solution.
> >>
> >> I'm willing to write the RSDServlet (or controller/action) if that's 
> >> what people decide is necessary to get the RSD patch committed, but I'm 
> >> a little hesitant to dive into Roller web.xml/struts/web configuration 
> >> if I can avoid it ;)
> >>
> >> -- Sean
> > 
> > 
> > 
> 

Reply via email to