You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by Marcial Rosales <ma...@spectel.com> on 2004/06/17 18:10:59 UTC

How to compile XSP yourself (automated builds)?

	Hi all,

	I have tried to generate a small piece of code that allow me to compile the XSP pages outside Cocoon runtime.
	I intend to compile all the xsp files during each build so that we can guarantee that everything is fine.

	In order to do that I am using:
		- org.apache.cocoon.generation.ServerPagesGenerator  class
		- I am invoking setup on the above class to indicate which file is to be compile among other emulated parameters, such as:
			- objectModel: I create mock Context, Request, Session and Response using CommandLine-based implementations provided by Cocoon
			- SourceResolver: I have implemented by own SourceResolver
			- empty org.apache.avalon.framework.parameters.Parameters instance.
		- and finally (I haven't got here yet) invoke generate() to obtain the xml associated with it.

	This is a snippet of code I have been working on:

        ServerPagesGenerator spg = new ServerPagesGenerator();
        SourceResolver sr = new MySourceResolver();
        Map omb = createMockObjectModel();
        String xspFile = "myxsp.xsp";

        try {
            spg.setup(sr, omb.getObjectModel(contextPath), xspFile, new Parameters());
        }catch(Exception e) {
            e.printStackTrace();
        }


        However, I am getting a NullPointerException within ServerPagesGenerator class. My question is whether the mock environment I have tried to reproduce is faithful or not. Obviously it is not, but I wonder what is wrong with it.

	Any hint or advice is very welcome

	Thx

	Marcial




Re: How to compile XSP yourself (automated builds)?

Posted by Joerg Heinicke <jo...@gmx.de>.
On 17.06.2004 18:10, Marcial Rosales wrote:

> I have tried to generate a small piece of code that allow me to
> compile the XSP pages outside Cocoon runtime. I intend to compile all
> the xsp files during each build so that we can guarantee that
> everything is fine.

Maybe it's better to try the CLI and get the precompilation to work 
there. I don't remember correctly if there were problems too.

> However, I am getting a NullPointerException within
> ServerPagesGenerator class. My question is whether the mock
> environment I have tried to reproduce is faithful or not. Obviously
> it is not, but I wonder what is wrong with it.

Difficult to say. In theory you should see it when looking for what's 
null. Setting up a mock environment is probably not that easy, that's 
why I suggested to use the command line environment.

Joerg

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org