Re: Best practices for validating request params?

2003-06-28 Thread Simon Price
You may want to take a look at the (from my dodgy memory) req-params 
action which does a simple existential check on request parameters. 
There's an example of its use in the modular database sample code's sitemap.

Cheers

Simon

Sonny Sukumar wrote:
Hi guys,

I was wondering what the best way is to validate request parameters.  I 
have a few questions:

1.) What is the best way to validate the *existence* of all expected 
request params (both for simple queries and for posting form data)?

By this, I mean I'd ideally like to notify the client if any request 
param wasn't sent.  I was thinking I could write a dedicated action to 
do this validation before another action extracts/formats the values.

2.) Do you think it is even a good practice to take the time/effort/cpu 
power to validate that all expected request params were sent and notify 
the client if they were not?

Otherwise, my action that extracts/formats the values would just end up 
throwing things like NullPointerExceptions, NumberFormatExceptions, etc. 
when it tries to extract/format the values.  This doesn't seem very 
elegant at all to me, even if I do wrap them in ProcessingExceptions 
before throwing them.

One other reason I don't want to throw these seemingly odd and random 
exceptions is because they'll just give a stack trace that says my code 
failed on Line XXX.  On my team we have another development group that 
is working on buiding the actual XHTML webpages and making sure they 
work with the backend.  So these sorts of exceptions and stack traces 
won't help them at all to figure out what went wrong.  If I notify them 
they forgot a param, they can say "Oh , I forgot to pass the XYZ 
param--that's why it's failing" and fix their XHTML code in short order.

I'm interested to hear all of your thoughts!

Thanks,

Sonny

_
STOP MORE SPAM with the new MSN 8 and get 2 months FREE*  
http://join.msn.com/?page=features/junkmail

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



--

---
Simon Price
Institute for Learning and Research Technology
University of Bristol
8-10 Berkeley Square
Bristol BS8 1HH
United Kingdom
Direct: +44 (0)7071 226 720
Office: +44 (0)117 928 7193
Fax: +44 (0)117 928 7112
[EMAIL PROTECTED]
http://www.ilrt.bristol.ac.uk
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


Best practices for validating request params?

2003-06-28 Thread Sonny Sukumar
Hi guys,

I was wondering what the best way is to validate request parameters.  I have 
a few questions:

1.) What is the best way to validate the *existence* of all expected request 
params (both for simple queries and for posting form data)?

By this, I mean I'd ideally like to notify the client if any request param 
wasn't sent.  I was thinking I could write a dedicated action to do this 
validation before another action extracts/formats the values.

2.) Do you think it is even a good practice to take the time/effort/cpu 
power to validate that all expected request params were sent and notify the 
client if they were not?

Otherwise, my action that extracts/formats the values would just end up 
throwing things like NullPointerExceptions, NumberFormatExceptions, etc. 
when it tries to extract/format the values.  This doesn't seem very elegant 
at all to me, even if I do wrap them in ProcessingExceptions before throwing 
them.

One other reason I don't want to throw these seemingly odd and random 
exceptions is because they'll just give a stack trace that says my code 
failed on Line XXX.  On my team we have another development group that is 
working on buiding the actual XHTML webpages and making sure they work with 
the backend.  So these sorts of exceptions and stack traces won't help them 
at all to figure out what went wrong.  If I notify them they forgot a param, 
they can say "Oh , I forgot to pass the XYZ param--that's why it's failing" 
and fix their XHTML code in short order.

I'm interested to hear all of your thoughts!

Thanks,

Sonny

_
STOP MORE SPAM with the new MSN 8 and get 2 months FREE*  
http://join.msn.com/?page=features/junkmail

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


RE: reading xml from pipeline into a flow script

2003-06-28 Thread Jonathan Spaeth
Title: RE: reading xml from pipeline into a flow script





One simple way of accomplishing this is to simply, define pipeline to generate, transform, and serialize the xml.  Then, in the flowscript, simply use the jaxp dom api to load the generated xml:

flow() {
    var document = Packages.javax.xml.parsers.DocumentBuilderFactory.newInstance().newDocumentBuilder().build(http://uri-to-xml-file);

    ...


    document.getDocumentElement();
    // it is now a dom
}



-Original Message-
From: Simon Price [mailto:[EMAIL PROTECTED]] 
Sent: Saturday, June 28, 2003 3:25 PM
To: [EMAIL PROTECTED]
Subject: reading xml from pipeline into a flow script


 From within a flow script, I would like to read (or pass in) xml 
generated by a series of pipeline xslt transformations.


Please could someone give me a pointer on how to do this?


Cheers


Simon


---
Simon Price
Institute for Learning and Research Technology
University of Bristol
8-10 Berkeley Square
Bristol BS8 1HH
United Kingdom


Direct: +44 (0)7071 226 720
Office: +44 (0)117 928 7193
Fax: +44 (0)117 928 7112
[EMAIL PROTECTED]
http://www.ilrt.bristol.ac.uk



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]





reading xml from pipeline into a flow script

2003-06-28 Thread Simon Price
From within a flow script, I would like to read (or pass in) xml 
generated by a series of pipeline xslt transformations.

Please could someone give me a pointer on how to do this?

Cheers

Simon

---
Simon Price
Institute for Learning and Research Technology
University of Bristol
8-10 Berkeley Square
Bristol BS8 1HH
United Kingdom
Direct: +44 (0)7071 226 720
Office: +44 (0)117 928 7193
Fax: +44 (0)117 928 7112
[EMAIL PROTECTED]
http://www.ilrt.bristol.ac.uk
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


RE: add user to unix

2003-06-28 Thread Geoff Howard
With Runtime.exec() but you need to read up heavily on it's use and/or  
ask about it on a more appropriate general java list or forum.  

I can tell you quickly that anytime you need to use exec() you should 
look into a threaded approach to handle parsing the standard error and 
standard out streams of your native process or you risk a hung jvm.

Geoff

> 3- a java class which calls a shell script
> 
> is there any one who can tell me how i can realise this, i think the most
> simply is possibility 3, but how i can do that ?


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



add user to unix

2003-06-28 Thread Sliman Bouchareb
hello experts,
i have a small applikation where the users can log in in to a portalpage
(mysql-database), if they are not in the database they can create a user
account (user,pass).
what i want is when they create a useraccount, that a user be automatically
created also under unix to a usergroup which have less priviliges, this
allow them to connect the workstation by using telnet.

first i thought this is impossible to do, but i read some postings in other
forums and there are 3 possibilities:

1- when a user create a user-account: a java class create a file with user
and pass and a cronjob look everytime to the file if there are new user odr
not, if yes so he can add them

2- a java class which add the user under unix
3- a java class which calls a shell script

is there any one who can tell me how i can realise this, i think the most
simply is possibility 3, but how i can do that ?

thanx
Sliman


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: svgz to jpeg ?

2003-06-28 Thread Upayavira
On 28 Jun 2003 at 8:39, rob wrote:

> Thanks for you reply,
> 
> but how do I generate the source ?
> 
> The file generator only seems to accept uncompressed
> svg. When I use a compressed svg as the source I get the
> following error message :

Ah. So your file on disc is compressed svg. Okay, so you need to uncompress it into 
XML and pass that into the SVG2JPG serializer. There's two ways to do that, either 
with a zip generator (I think there's an example of one in the Langham & Ziegler 
Cocoon book), or using the Jar protocol (see 
http://wiki.cocoondev.org/Wiki.jsp?page=JarProtocolExample).

Both should extract your zipped SVG ready for converting to JPG.

Hope that helps.

Regards, Upayavira


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Apache 2.0.43 - Tomcat 4.1 - Cocoon 2.0.4 problem

2003-06-28 Thread Martín Mauri
Hi,

I've setup an Apache / Tomcat / Cocoon integrated configuration. Fortunately
the Apache / Tomcat part works pretty well, but I'm facing problems with the
Cocoon part...I think it's redirection problem as my servlets are served
well, but when I try to access a .xml file it simply shows me the text and
not the result...

here's my mod_jk.conf file, look at the /cocoon part and tell me if
something's wrong please! any idea? thanks !

Martin


mod_jk.conf
Description: Binary data
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Re: install cocoon 2.1-m2 on tomcat 4.1.24

2003-06-28 Thread Peter Ross
On Fri, Jun 27, 2003 at 11:32:00AM -0400, Geoff Howard wrote:
> At 09:36 AM 6/27/2003, you wrote:
> >Geoff,
> >
> >I think you misunderstood my mail, I *DON'T* have a copy of
> >xmlParserAPIs.jar in the tomcat common/endorsed directory.
> 
> Ah, sorry - I thought the situation was reversed.
> 
> >However I just found the problem, inspired by some info from the link
> >you mention.  The problem was that the start menu items for
> >starting/stoping tomcat didn't use the startup or shutdown scripts and
> >hence java.endorsed.dirs wasn't being set and therefore the incorrect
> >jars were being referenced.
> 
> Ok, let me make sure I understand this one: so you installed tomcat on
> windows and when using the windows icons installed for starting and
> stopping tomcat, you find that they don't set the endorsed dir in the
> same way as the shell script?  That would be a useful thing to keep in
> mind and may well be unintentional on their part.  If that's the case,
> it would be worth submitting a bug and patch to them to see if they
> want to correct that for future releases?
> 
Yes that is correct. 

I do plan to submit a bug report when I can work out where to file it.

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Javascript within XSP-Actions?

2003-06-28 Thread Markus Heussen
Hi all!

Does anybody know if I can use javascript for writing custom xsp actions?
What about the configuration?

Thanks for every help.

Markus


I tried this but it doesn't work:




http://localhost"/>

http://localhost:8081"/>



My xsp action page:


http://apache.org/xsp";
xmlns:xsp-action="http://apache.org/cocoon/action/1.0";
xmlns:matrix="http://schema.rheinland.net/matrix/matrix.htm";>


if (1==1) { test = "test"; }
else { test = "false"; }






I know that I can use javascript in xsp generators. That works fine.


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: svgz to jpeg ?

2003-06-28 Thread rob



Thanks for you reply,
 
but how do I generate the source ?
 
The file generator only seems to accept 
uncompressed
svg. When I use a compressed svg as the source I 
get the
following error message :
 
Original Exception: org.xml.sax.SAXParseException: 
Content is not allowed in prolog.	at 
org.apache.xerces.util.ErrorHandlerWrapper.createSAXParseException(Unknown 
Source)	at org.apache.xerces.util.ErrorHandlerWrapper.fatalError(Unknown 
Source)	at org.apache.xerces.impl.XMLErrorReporter.reportError(Unknown 
Source)	at org.apache.xerces.impl.XMLErrorReporter.reportError(Unknown 
Source)	at org.apache.xerces.impl.XMLScanner.reportFatalError(Unknown 
Source)	at 
org.apache.xerces.impl.XMLDocumentScannerImpl$PrologDispatcher.dispatch(Unknown 
Source)	at 
org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown 
Source)	at 
org.apache.xerces.impl.XMLVersionDetector.scanDocument(Unknown 
Source)	at org.apache.xerces.parsers.DTDConfiguration.parse(Unknown 
Source)	at org.apache.xerces.parsers.DTDConfiguration.parse(Unknown 
Source)	at org.apache.xerces.parsers.XMLParser.parse(Unknown 
Source)	at org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown 
Source)	at 
org.apache.excalibur.xml.impl.JaxpParser.parse(JaxpParser.java:318)	at 
org.apache.excalibur.xml.impl.JaxpParser.parse(JaxpParser.java:337)	at 
org.apache.cocoon.components.source.SourceUtil.parse(SourceUtil.java:198)	at 
org.apache.cocoon.generation.FileGenerator.generate(FileGenerator.java:140)	at 
org.apache.cocoon.components.pipeline.impl.AbstractCachingProcessingPipeline.processXMLPipeline(AbstractCachingProcessingPipeline.java:277)	at 
org.apache.cocoon.components.pipeline.AbstractProcessingPipeline.process(AbstractProcessingPipeline.java:489)	at 
org.apache.cocoon.components.treeprocessor.sitemap.SerializeNode.invoke(SerializeNode.java:150)	at 
org.apache.cocoon.components.treeprocessor.AbstractParentProcessingNode.invokeNodes(AbstractParentProcessingNode.java:84)	at 
org.apache.cocoon.components.treeprocessor.sitemap.PreparableMatchNode.invoke(PreparableMatchNode.java:164)	at 
org.apache.cocoon.components.treeprocessor.AbstractParentProcessingNode.invokeNodes(AbstractParentProcessingNode.java:108)	at 
org.apache.cocoon.components.treeprocessor.sitemap.PipelineNode.invoke(PipelineNode.java:162)	at 
org.apache.cocoon.components.treeprocessor.AbstractParentProcessingNode.invokeNodes(AbstractParentProcessingNode.java:108)	at 
org.apache.cocoon.components.treeprocessor.sitemap.PipelinesNode.invoke(PipelinesNode.java:162)	at 
org.apache.cocoon.components.treeprocessor.TreeProcessor.process(TreeProcessor.java:325)	at 
org.apache.cocoon.components.treeprocessor.TreeProcessor.process(TreeProcessor.java:307)	at 
org.apache.cocoon.components.treeprocessor.sitemap.MountNode.invoke(MountNode.java:133)	at 
org.apache.cocoon.components.treeprocessor.AbstractParentProcessingNode.invokeNodes(AbstractParentProcessingNode.java:84)	at 
org.apache.cocoon.components.treeprocessor.sitemap.PreparableMatchNode.invoke(PreparableMatchNode.java:164)	at 
org.apache.cocoon.components.treeprocessor.AbstractParentProcessingNode.invokeNodes(AbstractParentProcessingNode.java:108)	at 
org.apache.cocoon.components.treeprocessor.sitemap.PipelineNode.invoke(PipelineNode.java:162)	at 
org.apache.cocoon.components.treeprocessor.AbstractParentProcessingNode.invokeNodes(AbstractParentProcessingNode.java:108)	at 
org.apache.cocoon.components.treeprocessor.sitemap.PipelinesNode.invoke(PipelinesNode.java:162)	at 
org.apache.cocoon.components.treeprocessor.TreeProcessor.process(TreeProcessor.java:325)	at 
org.apache.cocoon.components.treeprocessor.TreeProcessor.process(TreeProcessor.java:307)	at 
org.apache.cocoon.components.treeprocessor.sitemap.MountNode.invoke(MountNode.java:133)	at 
org.apache.cocoon.components.treeprocessor.AbstractParentProcessingNode.invokeNodes(AbstractParentProcessingNode.java:84)	at 
org.apache.cocoon.components.treeprocessor.sitemap.PreparableMatchNode.invoke(PreparableMatchNode.java:164)	at 
org.apache.cocoon.components.treeprocessor.AbstractParentProcessingNode.invokeNodes(AbstractParentProcessingNode.java:108)	at 
org.apache.cocoon.components.treeprocessor.sitemap.PipelineNode.invoke(PipelineNode.java:162)	at 
org.apache.cocoon.components.treeprocessor.AbstractParentProcessingNode.invokeNodes(AbstractParentProcessingNode.java:108)	at 
org.apache.cocoon.components.treeprocessor.sitemap.PipelinesNode.invoke(PipelinesNode.java:162)	at 
org.apache.cocoon.components.treeprocessor.TreeProcessor.process(TreeProcessor.java:325)	at 
org.apache.cocoon.components.treeprocessor.TreeProcessor.process(TreeProcessor.java:307)	at 
org.apache.cocoon.Cocoon.process(Cocoon.java:628)	at 
org.apache.cocoon.servlet.CocoonServlet.service(CocoonServlet.java:1139)	at 
javax.servlet.http.HttpServlet.service(HttpServlet.java:853)	at 
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:247)	at 
org.apache.catalina.core.Applic