ivelin 2002/07/28 07:03:52
Modified: src/java/org/apache/cocoon/samples/xmlform WizardAction.java
Added: src/java/org/apache/cocoon/samples/xmlform
UsageFeedbackAction.java
Log:
added WSDL & REST style Web Service support to the XMLForm demo
Revision Changes Path
1.6 +6 -21
xml-cocoon2/src/java/org/apache/cocoon/samples/xmlform/WizardAction.java
Index: WizardAction.java
===================================================================
RCS file:
/home/cvs/xml-cocoon2/src/java/org/apache/cocoon/samples/xmlform/WizardAction.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- WizardAction.java 4 Jul 2002 20:57:47 -0000 1.5
+++ WizardAction.java 28 Jul 2002 14:03:52 -0000 1.6
@@ -102,7 +102,6 @@
final String CMD_NEXT = "next";
final String CMD_PREV = "prev";
-
/**
* The first callback method which is called
* when an action is invoked.
@@ -110,7 +109,7 @@
* It is called before population.
*
*
- * @return null if the Action is prepared to continue.
+ * @return null if the Action is prepared to continue - the normal case.
* an objectModel map which will be immediately returned by the action.
*
* This method is a good place to handle buttons with Cancel
@@ -121,6 +120,7 @@
protected Map prepare()
{
+ // following is navigation logic for the GUI version
if ( getCommand() == null )
{
// initial link
@@ -247,6 +247,7 @@
// based on the current form view
// make some decisions regarding checkboxes, etc.
String formView = getFormView();
+ if (formView == null) return;
if ( formView.equals ( VIEW_DEPLOYMENT ) )
{
// deal with the publish checkbox
@@ -294,22 +295,6 @@
}
- public String getFile( String FileName ) {
- Source source = null;
- try {
- source = getSourceResolver().resolveURI(FileName);
- final String FILE_PREFIX = "file:";
- String path = source.getSystemId();
- if(path.startsWith(FILE_PREFIX))
- path = path.substring(FILE_PREFIX.length());
- return path;
- } catch(Exception e) {
- getLogger().error("could not read mapping file",e);
- return null;
- } finally {
- this.getSourceResolver().release( source );
- }
- }
}
1.1
xml-cocoon2/src/java/org/apache/cocoon/samples/xmlform/UsageFeedbackAction.java
Index: UsageFeedbackAction.java
===================================================================
/*
* $Header:
/home/cvs/xml-cocoon2/src/java/org/apache/cocoon/samples/xmlform/UsageFeedbackAction.java,v
1.1 2002/07/28 14:03:52 ivelin Exp $
* $Revision: 1.1 $
* $Date: 2002/07/28 14:03:52 $
*
* ====================================================================
* The Apache Software License, Version 1.1
*
*
*
* Copyright (c) 1999-2001 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* 3. The end-user documentation included with the redistribution, if
* any, must include the following acknowlegement:
* "This product includes software developed by the
* Apache Software Foundation (http://www.apache.org/)."
* Alternately, this acknowlegement may appear in the software itself,
* if and wherever such third-party acknowlegements normally appear.
*
* 4. The names "The Jakarta Project", "Commons", and "Apache Software
* Foundation" must not be used to endorse or promote products derived
* from this software without prior written permission. For written
* permission, please contact [EMAIL PROTECTED]
*
* 5. Products derived from this software may not be called "Apache"
* nor may "Apache" appear in their names without prior written
* permission of the Apache Group.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
* ====================================================================
*
* This software consists of voluntary contributions made by many
* individuals on behalf of the Apache Software Foundation and was
* originally based on software copyright (c) 2001, Plotnix, Inc,
* <http://www.plotnix.com/>.
* For more information on the Apache Software Foundation, please see
* <http://www.apache.org/>.
*/
package org.apache.cocoon.samples.xmlform;
// Java classes
import java.util.Map;
// Framework classes
import org.apache.excalibur.source.Source;
import org.apache.avalon.framework.parameters.ParameterException;
// Cocoon Form
import org.apache.cocoon.acting.AbstractXMLFormAction;
import org.apache.cocoon.components.xmlform.Form;
/**
* This action demonstrates
* a relatively complex form handling scenario.
*
* @author Ivelin Ivanov <[EMAIL PROTECTED]>
*/
public class UsageFeedbackAction
extends AbstractXMLFormAction
{
// Web Service Response names
final String SERVICE_RESPONSE_OK = "ok";
final String SERVICE_RESPONSE_ERROR = "error";
/**
* Invoked after form population
*
* Semanticly similar to Struts Action.perform()
*
* Take appropriate action based on the command
*
*/
public Map perform ()
{
getForm().validate();
if ( getForm().getViolations () != null )
{
return page( SERVICE_RESPONSE_ERROR );
}
else
{
return page( SERVICE_RESPONSE_OK );
}
}
}
----------------------------------------------------------------------
In case of troubles, e-mail: [EMAIL PROTECTED]
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]