org.barracudamvc.examples.xmlc
Class FindRendererBugTest
java.lang.Object
javax.servlet.GenericServlet
javax.servlet.http.HttpServlet
org.barracudamvc.core.comp.helper.ComponentGateway
org.barracudamvc.examples.xmlc.FindRendererBugTest
- All Implemented Interfaces:
- Serializable, javax.servlet.Servlet, javax.servlet.ServletConfig
public class FindRendererBugTest
- extends ComponentGateway
Here's an example of how the component stuff can be implemented
in a standalone servlet.
- See Also:
- Serialized Form
Methods inherited from class javax.servlet.http.HttpServlet |
doHead, getLastModified, service, service |
Methods inherited from class javax.servlet.GenericServlet |
destroy, getInitParameter, getInitParameterNames, getServletConfig, getServletContext, getServletInfo, getServletName, init, init, log, log |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
FindRendererBugTest
public FindRendererBugTest()
handleDefault
public Document handleDefault(BComponent root,
ViewContext vc,
javax.servlet.http.HttpServletRequest req,
javax.servlet.http.HttpServletResponse resp)
throws IOException
- This class will generate a NPE if renderer.
The scenario is :
1) extend a component : see Mytext inner class
2) manually bind an instance of it to a node
3) also return another instance from, say, BTemplate
Render all this and you get the following exception :
java.lang.NullPointerException
at org.barracudamvc.core.comp.AbstractBComponent.findRendererFactory(AbstractBComponent.java:225)
at org.barracudamvc.core.comp.AbstractBComponent.getRenderer(AbstractBComponent.java:195)
at org.barracudamvc.core.comp.renderer.TemplateHelper.getNode(TemplateHelper.java:401)
at org.barracudamvc.core.comp.renderer.TemplateHelper.copyChildNodes(TemplateHelper.java:153)
at org.barracudamvc.core.comp.renderer.TemplateHelper.getNode(TemplateHelper.java:836)
at org.barracudamvc.core.comp.renderer.TemplateHelper.copyChildNodes(TemplateHelper.java:153)
I think it has something to do with the fact that RendererFactory class and registration are static, and rfDomMap in AbstractBComponent also is static, but I must admit I can't fully explain what is happening.
- Specified by:
handleDefault
in class ComponentGateway
- Parameters:
root
- the root component which will get rendered as a result
of this requestvc
- the ViewContext object describes what features the
client view is capable of supportingreq
- the servlet requestresp
- the servlet response
- Returns:
- the Document to be rendered
- Throws:
IOException
getDOMWriter
public DOMWriter getDOMWriter()
Get a DOMWriter. By default, we use a DefaultDOMWriter. If
you'd like to use something else, override this method.
- Overrides:
getDOMWriter
in class ComponentGateway
- Returns:
- a DOMWriter to be used to render the DOM
Copyright © 2006 BarracudaMVC.org All Rights Reserved.