You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by cib <c....@laposte.net> on 2001/09/22 04:42:01 UTC
abstract class
Hi,
Thanks to many of you I've got a base for saving the output from cocoon to a
file "output.txt" on my disk: still a little error message bothering me.
class org.apache.cocoon.www.pages.make1_xsp must be declared
abstract. It does not define void generate() from class
org.apache.cocoon.generation.AbstractGenerator
Unfortunately adding "abstract" before the class and the main declaration
didn't change anything. If someone could give me a hand on finding the
correct syntax for this.
<?xml version="1.0" encoding="ISO-8859-1"?>
<xsp:page
language="java"
xmlns:xsp="http://apache.org/xsp"
xmlns:esql="http://apache.org/cocoon/SQL/v2">
<xsp:structure>
<xsp:include>java.io.*</xsp:include>
</xsp:structure>
<xsp:logic>
class make_xsl {
public void main(String[]) throws IOException {
FileReader entree = new
FileReader(("http//:localhost/cocoon/test/make.xsl"));
FileWriter sortie = new FileWriter("output.txt");
int c;
while ( (c = entree.read()) != -1 )
sortie.write(c);
sortie.close();
entree.close();
}
}
</xsp:logic>
<page>
<xsp:logic>
make_xsl anObject = new make_xsl();
anObject.main();
</xsp:logic>
If you see this, it works.
</page>
</xsp:page>
thanks for your clues.
Cib
France, Bordeaux, xml and gay pride.
---------------------------------------------------------------------
Please check that your question has not already been answered in the
FAQ before posting. <http://xml.apache.org/cocoon/faqs.html>
To unsubscribe, e-mail: <co...@xml.apache.org>
For additional commands, e-mail: <co...@xml.apache.org>
Re: abstract class Tomcat fails
Posted by cib <c....@laposte.net>.
Hi,
(I did read your message, but thought that "remove arguments" meant remove
the "args" that was in main(String[] args)" : I've got the point now it
must be absolutly identical -empty- to the call)
The code did compile in javac, but not in cocoon2.0b2 : it said:
"Exception java.io.IOException must be caught, or it must be declared in the
throws clause of this method"
I spent the day in exceptions tutorials and ended up with:
class make_xsl {
public void main() {
try {
FileReader entree = new FileReader("a1.html");
FileWriter sortie = new FileWriter("output.txt");
int c;
while ( (c = entree.read()) != -1 )
sortie.write(c);
sortie.close();
entree.close();
} catch (FileNotFoundException e) {
System.err.println("CheckedIODemo: " + e);
System.exit(-1);
} catch (java.io.IOException e) {
System.err.println("CheckedIODemo: " + e);
System.exit(-1);
} catch (NoSuchMethodError e) {
System.err.println("CheckedIODemo: " + e);
System.exit(-1);
} catch (Exception e) {
System.err.println("CheckedIODemo: " + e);
System.exit(-1);
}
}
}
PROBLEM:
-it only works if a1.html (the input file) is in Tomcat/bin
-it makes cocoon and tomcat go down (404 for all pages in localhost, even
Tomcat welcome page) if there is no a1.html in Tomcat/bin or if I try a url
http://localhost/cocoon/a1.html to get a1.html from an xsp generation.
I guess I'm not a java master yet.
Thanks for your help.
Cib
France, Bordeaux, xml and gay pride.
----- Original Message -----
From: "Christian Haul" <ha...@dvs1.informatik.tu-darmstadt.de>
To: <co...@xml.apache.org>
Cc: "cib" <ve...@caramail.com>
Sent: Saturday, September 22, 2001 10:03 AM
Subject: Re: abstract class
> Cib,
>
> I'd really appreciate it if you'd care to read me responses and don't
> post the same question over and over.
>
> If you change your code the code as indicated it compiles OK.
>
> On 22.Sep.2001 -- 04:42 AM, cib wrote:
> > <?xml version="1.0" encoding="ISO-8859-1"?>
> >
> > <xsp:page
> > language="java"
> > xmlns:xsp="http://apache.org/xsp"
> > xmlns:esql="http://apache.org/cocoon/SQL/v2">
> >
> > <xsp:structure>
> > <xsp:include>java.io.*</xsp:include>
> > </xsp:structure>
> >
> > <xsp:logic>
> > class make_xsl {
> public void main( ) throws IOException {
> // before: public void main(String[]) throws IOException {
>
> > FileReader entree = new
> > FileReader(("http//:localhost/cocoon/test/make.xsl"));
> > FileWriter sortie = new FileWriter("output.txt");
> > int c;
> > while ( (c = entree.read()) != -1 )
> > sortie.write(c);
> > sortie.close();
> > entree.close();
> > }
> > }
> > </xsp:logic>
> >
> > <page>
> >
> > <xsp:logic>
> > make_xsl anObject = new make_xsl();
> > anObject.main();
> > </xsp:logic>
> >
> >
> > If you see this, it works.
> >
> > </page>
> > </xsp:page>
>
> Chris.
>
> --
> C h r i s t i a n H a u l
> haul@informatik.tu-darmstadt.de
> fingerprint: 99B0 1D9D 7919 644A 4837 7D73 FEF9 6856 335A 9E08
>
> ---------------------------------------------------------------------
> Please check that your question has not already been answered in the
> FAQ before posting. <http://xml.apache.org/cocoon/faqs.html>
>
> To unsubscribe, e-mail: <co...@xml.apache.org>
> For additional commands, e-mail: <co...@xml.apache.org>
>
---------------------------------------------------------------------
Please check that your question has not already been answered in the
FAQ before posting. <http://xml.apache.org/cocoon/faqs.html>
To unsubscribe, e-mail: <co...@xml.apache.org>
For additional commands, e-mail: <co...@xml.apache.org>
Re: abstract class
Posted by Christian Haul <ha...@dvs1.informatik.tu-darmstadt.de>.
Cib,
I'd really appreciate it if you'd care to read me responses and don't
post the same question over and over.
If you change your code the code as indicated it compiles OK.
On 22.Sep.2001 -- 04:42 AM, cib wrote:
> <?xml version="1.0" encoding="ISO-8859-1"?>
>
> <xsp:page
> language="java"
> xmlns:xsp="http://apache.org/xsp"
> xmlns:esql="http://apache.org/cocoon/SQL/v2">
>
> <xsp:structure>
> <xsp:include>java.io.*</xsp:include>
> </xsp:structure>
>
> <xsp:logic>
> class make_xsl {
public void main( ) throws IOException {
// before: public void main(String[]) throws IOException {
> FileReader entree = new
> FileReader(("http//:localhost/cocoon/test/make.xsl"));
> FileWriter sortie = new FileWriter("output.txt");
> int c;
> while ( (c = entree.read()) != -1 )
> sortie.write(c);
> sortie.close();
> entree.close();
> }
> }
> </xsp:logic>
>
> <page>
>
> <xsp:logic>
> make_xsl anObject = new make_xsl();
> anObject.main();
> </xsp:logic>
>
>
> If you see this, it works.
>
> </page>
> </xsp:page>
Chris.
--
C h r i s t i a n H a u l
haul@informatik.tu-darmstadt.de
fingerprint: 99B0 1D9D 7919 644A 4837 7D73 FEF9 6856 335A 9E08
---------------------------------------------------------------------
Please check that your question has not already been answered in the
FAQ before posting. <http://xml.apache.org/cocoon/faqs.html>
To unsubscribe, e-mail: <co...@xml.apache.org>
For additional commands, e-mail: <co...@xml.apache.org>
Re: abstract class
Posted by Mario Muja <ma...@delaval.com>.
Hi,
if your code allows to write the result of an XSP including ESQL
statements to disk, then please, please, please send us a snapshot of
the code and a short example, how it can be used.
Thank you very much for you help.
Mario
cib wrote:
>Hi,
>Thanks to many of you I've got a base for saving the output from cocoon to a
>file "output.txt" on my disk: still a little error message bothering me.
>
>class org.apache.cocoon.www.pages.make1_xsp must be declared
>abstract. It does not define void generate() from class
>org.apache.cocoon.generation.AbstractGenerator
>
>Unfortunately adding "abstract" before the class and the main declaration
>didn't change anything. If someone could give me a hand on finding the
>correct syntax for this.
>
><?xml version="1.0" encoding="ISO-8859-1"?>
>
><xsp:page
> language="java"
> xmlns:xsp="http://apache.org/xsp"
> xmlns:esql="http://apache.org/cocoon/SQL/v2">
>
><xsp:structure>
> <xsp:include>java.io.*</xsp:include>
></xsp:structure>
>
><xsp:logic>
>class make_xsl {
> public void main(String[]) throws IOException {
> FileReader entree = new
>FileReader(("http//:localhost/cocoon/test/make.xsl"));
> FileWriter sortie = new FileWriter("output.txt");
> int c;
> while ( (c = entree.read()) != -1 )
>sortie.write(c);
>sortie.close();
>entree.close();
> }
>}
></xsp:logic>
>
> <page>
>
><xsp:logic>
> make_xsl anObject = new make_xsl();
> anObject.main();
></xsp:logic>
>
>
>If you see this, it works.
>
> </page>
></xsp:page>
>
>thanks for your clues.
>
>Cib
>
>France, Bordeaux, xml and gay pride.
>
>
>
>---------------------------------------------------------------------
>Please check that your question has not already been answered in the
>FAQ before posting. <http://xml.apache.org/cocoon/faqs.html>
>
>To unsubscribe, e-mail: <co...@xml.apache.org>
>For additional commands, e-mail: <co...@xml.apache.org>
>
>
---------------------------------------------------------------------
Please check that your question has not already been answered in the
FAQ before posting. <http://xml.apache.org/cocoon/faqs.html>
To unsubscribe, e-mail: <co...@xml.apache.org>
For additional commands, e-mail: <co...@xml.apache.org>