vgritsenko 2002/10/21 18:52:23 Modified: . Tag: cocoon_2_0_3_branch changes.xml src/java/org/apache/cocoon/acting Tag: cocoon_2_0_3_branch ResourceExistsAction.java Log: Src attribute can be used now with ResourceExistsAction. Old parameter syntax preserved. Revision Changes Path No revision No revision 1.138.2.58 +5 -1 xml-cocoon2/changes.xml Index: changes.xml =================================================================== RCS file: /home/cvs/xml-cocoon2/changes.xml,v retrieving revision 1.138.2.57 retrieving revision 1.138.2.58 diff -u -r1.138.2.57 -r1.138.2.58 --- changes.xml 25 Sep 2002 07:42:21 -0000 1.138.2.57 +++ changes.xml 22 Oct 2002 01:52:23 -0000 1.138.2.58 @@ -39,6 +39,10 @@ </devs> <release version="@version@" date="@date@"> + <action dev="VG" type="update"> + Src attribute can be used now with ResourceExistsAction. Old parameter + syntax preserved. + </action> <action dev="CZ" type="fix"> Fixed prefix mapping for the sql transformer. </action> No revision No revision 1.5.2.1 +11 -8 xml-cocoon2/src/java/org/apache/cocoon/acting/ResourceExistsAction.java Index: ResourceExistsAction.java =================================================================== RCS file: /home/cvs/xml-cocoon2/src/java/org/apache/cocoon/acting/ResourceExistsAction.java,v retrieving revision 1.5 retrieving revision 1.5.2.1 diff -u -r1.5 -r1.5.2.1 --- ResourceExistsAction.java 22 Feb 2002 06:59:26 -0000 1.5 +++ ResourceExistsAction.java 22 Oct 2002 01:52:23 -0000 1.5.2.1 @@ -61,9 +61,11 @@ import java.util.Map; /** - * This action simply checks to see if a given resource exists. It takes a - * single parameter named 'url' and returns an empty map if it exists and - * null otherwise. It has only been tested with context urls. + * This action simply checks to see if a given resource exists. It checks + * whether the specified in the src attribute source exists or not. + * The action returns empty <code>Map</code> if it exists, null otherwise. + * <p>Instead of src attribute, source can be specified using + * parameter named 'url' (this is old syntax). * * @author <a href="mailto:balld@;apache.org">Donald Ball</a> * @version CVS $Id$ @@ -71,18 +73,19 @@ public class ResourceExistsAction extends ComposerAction implements ThreadSafe { public Map act(Redirector redirector, SourceResolver resolver, Map objectModel, String source, Parameters parameters) throws Exception { - String urlstring = parameters.getParameter("url",null); + String urlstring = parameters.getParameter("url", source); Source src = null; try { src = resolver.resolve(urlstring); src.getInputStream(); } catch (Exception e) { - getLogger().debug("ResourceExistsAction: exception: ",e); + getLogger().debug("Exception", e); return null; } finally { - if (src != null) src.recycle(); + if (src != null) { + src.recycle(); + } } return EMPTY_MAP; } - }
---------------------------------------------------------------------- In case of troubles, e-mail: [EMAIL PROTECTED] To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]