cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "David Cittadini" <David.Cittad...@blackmarble.com>
Subject RE: Bugs!
Date Thu, 28 Dec 2000 12:35:18 GMT
Thanks.  That helped a little bit but not quite.  If you look at my example
I go from testloader.xml to testlogic.xsl to testdisplay.xsl.  The purpose
of testlogic and testdisplay is to split the logic processing from the
presentation.  The problem seems to be inside testlogic.xsl.    If I remove
the line "<xsl:processing-instruction
name="cocoon-process">type="xsp"</xsl:processing-instruction>" then the
pages work 100% (but of course there is no logic processing).  However, if I
need logic processing inside testlogic.xsl then I need to add back that
line.  This is when I get the problem that is only fixed by deleting the
repository mid stream.  So, we seem to know where the error occurs.  Any
suggestions on how to fix it?

Thanks for the help.

Attached is a cut-and-paste of the last zip files in case something was
missing:

----------- TestLoader.xml --------------
<?xml version="1.0"?>
<?cocoon-process type="xsp"?>
<?cocoon-process type="xslt"?>
<?xml-stylesheet href="TestLogic.xsl" type="text/xsl"?>

<xsp:page xmlns:xsp="http://www.apache.org/1999/XSP/Core"
              xmlns:util="http://www.apache.org/1999/XSP/Util">
     <page>
      <util:include-uri>
	<util:href>
		<xsp:expr>"http://borg/servlet/xmldatabaseserver?fullname=" +
request.getParameter("fullname")</xsp:expr>
	</util:href>
      </util:include-uri>
     </page>
</xsp:page>


----------- TestLogic.xsl --------------

<?xml version="1.0"?>
<xsl:stylesheet version="1.0"
   xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
   xmlns:xsp="http://www.apache.org/1999/XSP/Core">

	<xsl:template match="names">
		<xsl:processing-instruction
name="cocoon-process">type="xsp"</xsl:processing-instruction>
		<xsl:processing-instruction
name="cocoon-process">type="xslt"</xsl:processing-instruction>
		<xsl:processing-instruction name="xml-stylesheet">href="TestDisplay.xsl"
type="text/xsl"</xsl:processing-instruction>
		<xsp:page language="java" xmlns:xsp="http://www.apache.org/1999/XSP/Core">
			<xsp:logic>
			</xsp:logic>
			<xsl:copy>
				<xsl:apply-templates/>
			</xsl:copy>
		</xsp:page>
	</xsl:template>

	<xsl:template match="company">
		<xsl:copy-of select="."/>
	</xsl:template>

	<xsl:template match="fullname">
		<xsl:copy-of select="."/>
	</xsl:template>
</xsl:stylesheet>


----------- TestDisplay.xml --------------

<?xml version="1.0"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
	<xsl:template match="names">
		<xsl:processing-instruction
name="cocoon-format">type="text/html"</xsl:processing-instruction>
		<html>
			<head>
				<title><xsl:value-of select="company"/></title>
			</head>
			<body topmargin="0" leftmargin="0" marginwidth="0" marginheight="0">
				<table border="1" bgcolor="#FFFFFF" bordercolor="#000000"
cellspacing="0" cellpadding="4">
					<tr>
						<td align="center" valign="middle" bgcolor="#C0C0C0">
							<big><big><xsl:value-of select="company"/><xsl:text>
</xsl:text><xsl:value-of select="fullname"/></big></big>
						</td>
					</tr>
				</table>
			</body>
		</html>
	</xsl:template>
</xsl:stylesheet>


----------- Simple.java --------------

import java.io.*;
import java.text.*;
import java.util.*;
import javax.servlet.*;
import javax.servlet.http.*;

public class Simple extends HttpServlet {
    public void doGet(HttpServletRequest request, HttpServletResponse
response) throws IOException, ServletException {
	response.setContentType("text/xml");
	PrintWriter out = response.getWriter();
	out.println("<?xml version=\"1.0\" encoding=\"UTF-8\"?>");
	out.println("<names version=\"3.0\">");
	out.println("    <company>Test Company</company>");
	out.println("    <fullname>" + request.getParameter("fullname")
+"</fullname>");
	out.println("</names>");
    }

    public void doPost(HttpServletRequest request, HttpServletResponse
response) throws IOException, ServletException {
        doGet(request, response);
    }

}


-----Original Message-----
From: jeff@socialchange.net.au [mailto:jeff@socialchange.net.au]
Sent: Thursday, 28 December 2000 9:31
To: cocoon-users@xml.apache.org
Cc: David Cittadini
Subject: RE: Bugs!

Sorry, I've just discovered my version of gmail doesn't read attachments :/
While I figure out how to demunge your .zip, here's a modified XSP that
uses an XSLT. From what I gather, this is what you say doesn't work.
The servlet Simple.java can return text/xml or text/html, it doesn't make a
difference.

---- test.xml ----
<?xml version="1.0"?>

<?cocoon-process type="xsp"?>
<?cocoon-process type="xslt"?>
<?xml-stylesheet href="test.xsl" type="text/xsl"?>

<xsp:page
    language="java"
    xmlns:xsp="http://www.apache.org/1999/XSP/Core"
    xmlns:util="http://www.apache.org/1999/XSP/Util"
    xmlns:request="http://www.apache.org/1999/XSP/Request"
>
<page>
    <util:include-uri>
        <util:href>

<xsp:expr>"http://localhost:8080/taglib/servlet/Simple?firstname="+<request:
get-parameter name="name" default="joe"/></xsp:expr>
        </util:href>
    </util:include-uri>
</page>
</xsp:page>
----

---- test.xsl ----
<?xml version="1.0"?>

<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
  xmlns:xsp="http://www.apache.org/1999/XSP/Core"
>
<xsl:template match="page">
    <xsl:processing-instruction
name="cocoon-format">type="text/html"</xsl:processing-instruction>
    <xsl:copy-of select="node()"/>
</xsl:template>

</xsl:stylesheet>
----


--Jeff

>
> ------=_NextPart_000_0046_01C070FD.56563160
> Content-Type: text/plain;
> charset="iso-8859-1"
> Content-Transfer-Encoding: 7bit
>
> Hi,
>
> Thanks for that.  I am using xml content.  The example you gave me is OK
> until I add a <?cocoon-process type="xslt"?> and a <?xml-stylesheet?>
> definition.  It seems that as soon as I add the XSLT declaration it loops
as
> mentioned in my post and only works if I manually delete the "repository"
> directory while the request is in progress.
>
> Attached is a very basic demo to show the error.  If you run this, the
page
> is only displayed if you delete the contents of the repository directory
> while the page is being processed
>
> Regards, David.
>
>
>
> -----Original Message-----
> From: jeff@socialchange.net.au [mailto:jeff@socialchange.net.au]
> Sent: Thursday, 28 December 2000 1:17
> To: cocoon-users@xml.apache.org
> Cc: David Cittadini
> Subject: Re: Bugs!
>
>
> > I have found the following problem in Cocoon version 1.8 as well as in
the
> > current live CVS repository.  If I access the XML file in Scenario 1
> below,
> > Cocoon will continuously call "testservlet" until the system eventually
> runs
> > out of memory.  However, if I delete all the files in the "repository"
> > directory while Cocoon is making this continuous calls, Cocoon will
> suddenly
> > stop re-calling "testservlet", process the call correctly and the
correct
> > data will be displayed in the browser.  Exactly the same thing will
happen
> > in Scenario 2 even though the "uid" is static instead of dynamic, as in
> > Scenario 1.  It only seems to work if I delete the files in the
repository
> > while the call is running.
>
> I can't replicate the problem here.. I'm using 1.8.1dev from CVS last
week.
> Is your
> servlet returning text/xml or text/html? Either way, it must be
well-formed.
> Here's
> what I got working:
>
> ---- WEB-INF/classes/Simple.java
> import java.io.*;
> import java.text.*;
> import java.util.*;
> import javax.servlet.*;
> import javax.servlet.http.*;
>
> public class Simple extends HttpServlet {
>
> public void doGet(HttpServletRequest request,
> HttpServletResponse response)
> throws IOException, ServletException
> {
> response.setContentType("text/html");
>
> PrintWriter out = response.getWriter();
> out.println("<html>");
> out.println("<body>");
> out.println("firstname="+request.getParameter("firstname"));
> out.println("lastname="+request.getParameter("lastname"));
> out.println("</body>");
> out.println("</html>");
> }
>
> public void doPost(HttpServletRequest request,
> HttpServletResponse response)
> throws IOException, ServletException
> {
> doGet(request, response);
> }
>
> }
> ----
>
>
> ---- /test.xml ----
> <?xml version="1.0"?>
> <?cocoon-process type="xsp"?>
> <?cocoon-format type="text/html"?>
> <xsp:page xmlns:xsp="http://www.apache.org/1999/XSP/Core"
> xmlns:util="http://www.apache.org/1999/XSP/Util"
> xmlns:request="http://www.apache.org/1999/XSP/Request"
> >
> <page>
> <util:include-uri>
> <util:href>
>
<xsp:expr>"http://localhost:8080/taglib/servlet/Simple?firstname="+<request:
> get-parameter name="name" default="joe"/></xsp:expr>
> </util:href>
> </util:include-uri>
> </page>
> </xsp:page>
> ----
>
> (Note you'll have to change the URL in test.xml)
>
> Then if I request http://localhost:8080/taglib/test.xml?name=John, I get:
> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN"
> "http://www.w3.org/TR/REC-html40/strict.dtd">
> <page xmlns:request="http://www.apache.org/1999/XSP/Request">
> <html>
> <body>
> firstname=John
> lastname=null
> </body>
> </html>
> </page>
> <!-- This page was served in 84 milliseconds by Cocoon 1.8.1-dev -->
>
>
> >
> > I am sure you are aware of the next bug:  In Scenario 1, Cocoon does
> > recognise any dynamic parameters other than the one passed when it is
> first
> > accessed.  If you pass a new parameter it just shows the data from the
> first
> > call.  In order to get it work "dynamically", you have to manually
delete
> > all the files in the "repository" directory and run the call again.
This
> > means that there is a problem in the cache.
>
> Something's really weird with your setup ;P You're not editing XSPs on a
> different computer with a date set in the future, are you? Other than
that,
> I've no idea. Reinstall cocoon, and if it's still doing weird stuff,
> sprinkle holy
> water over your computer.
>
> --Jeff
>
> >
> >
> > SCENARIO 1
> > ==========
> >
> > <?xml version="1.0"?>
> > <?cocoon-process type="xsp"?>
> > <?cocoon-process type="xslt"?>
> > <?xml-stylesheet href="test.xsl" type="text/xsl"?>
> > <xsp:page xmlns:xsp="http://www.apache.org/1999/XSP/Core"
> > xmlns:util="http://www.apache.org/1999/XSP/Util">
> > <page>
> > <util:include-uri>
> > <util:href>
> >
> > <xsp:expr>"http://localhost/servlet/testservlet?uid=" +
> > request.getParameter("uid")</xsp:expr>
> > </util:href>
> > </util:include-uri>
> > </page>
> > </xsp:page>
> >
> > SCENARIO 2
> > ==========
> > <?xml version="1.0"?>
> > <?cocoon-process type="xsp"?>
> > <?cocoon-process type="xslt"?>
> > <?xml-stylesheet href="test.xsl " type="text/xsl"?>
> > <xsp:page xmlns:xsp="http://www.apache.org/1999/XSP/Core"
> > xmlns:util="http://www.apache.org/1999/XSP/Util">
> > <page>
> > <util:include-uri>
> > <util:href>
> >
> > <xsp:expr>"http://borg/servlet/xmldatabaseserver?uid=testid"</xsp:expr>
> > </util:href>
> > </util:include-uri>
> > </page>
> > </xsp:page>
>
> ------=_NextPart_000_0046_01C070FD.56563160
> Content-Type: application/x-zip-compressed;
> name="bugs.ZIP"
> Content-Transfer-Encoding: base64
> Content-Disposition: attachment;
> filename="bugs.ZIP"
>
>
UEsDBBQAAAAIAAmSnCnGk92HNgEAAGEDAAANAAA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GF5LnhzbFBLAQIUABQA
>
AAAIAL2QnCnrZ+GwDwEAAAYCAAAOAAAAAAAAAAEAIAC2gQMDAABUZXN0TG9hZGVyLnhtbFBLAQIU
>
ABQAAAAIAFaTnClTbCsGVQEAACoDAAALAAAAAAAAAAEAIAC2gT4EAABTaW1wbGUuamF2YVBLBQYA
> AAAABAAEAO0AAAC8BQAAAAA=
>
>
> ------=_NextPart_000_0046_01C070FD.56563160
> Content-Type: text/plain; charset=us-ascii
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: cocoon-users-unsubscribe@xml.apache.org
> For additional commands, e-mail: cocoon-users-help@xml.apache.org
> ------=_NextPart_000_0046_01C070FD.56563160--


Mime
View raw message