[prev in list] [next in list] [prev in thread] [next in thread]
List: xml-cocoon-cvs
Subject: cvs commit: cocoon-2.1/src/blocks/portal/java/org/apache/cocoon/portal/transformation HTMLEventLinkT
From: vgritsenko () apache ! org
Date: 2004-03-31 20:32:46
Message-ID: 20040331203246.86813.qmail () minotaur ! apache ! org
[Download RAW message or body]
vgritsenko 2004/03/31 12:32:45
Modified: src/blocks/javaflow/java/org/apache/cocoon/components/flow/java
AbstractCocoonFlow.java
src/blocks/portal/java/org/apache/cocoon/portal/transformation
HTMLEventLinkTransformer.java
Log:
fix compilation errors (jdk 1.3)
Revision Changes Path
1.2 +14 -12 \
cocoon-2.1/src/blocks/javaflow/java/org/apache/cocoon/components/flow/java/AbstractCocoonFlow.java
Index: AbstractCocoonFlow.java
===================================================================
RCS file: /home/cvs/cocoon-2.1/src/blocks/javaflow/java/org/apache/cocoon/components/flow/java/AbstractCocoonFlow.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- AbstractCocoonFlow.java 29 Mar 2004 17:47:21 -0000 1.1
+++ AbstractCocoonFlow.java 31 Mar 2004 20:32:45 -0000 1.2
@@ -15,8 +15,7 @@
*/
package org.apache.cocoon.components.flow.java;
-import java.io.OutputStream;
-
+import org.apache.avalon.framework.CascadingRuntimeException;
import org.apache.avalon.framework.logger.Logger;
import org.apache.cocoon.components.ContextHelper;
import org.apache.cocoon.components.flow.FlowHelper;
@@ -24,6 +23,8 @@
import org.apache.cocoon.environment.Request;
import org.apache.excalibur.source.SourceUtil;
+import java.io.OutputStream;
+
/**
* Abstract class to add basic methods for flow handling.
*
@@ -50,7 +51,7 @@
System.out.println("send page and wait '" + uri + "'");
if (Continuation.currentContinuation()!=null) {
ContinuationContext context = getContext();
-
+
FlowHelper.setContextObject(ContextHelper.getObjectModel(context.getAvalonContext()), \
bizdata);
if (SourceUtil.indexOfSchemeColon(uri) == -1) {
@@ -61,8 +62,8 @@
try {
context.getRedirector().redirect(false, uri);
} catch (Exception e) {
- throw new RuntimeException("Cannot redirect to '"+uri+"'", e);
- }
+ throw new CascadingRuntimeException("Cannot redirect to \
'"+uri+"'", e); + }
} else {
throw new IllegalArgumentException("uri is not allowed to contain \
a scheme (cocoon:/ is always automatically used)"); }
@@ -79,7 +80,7 @@
System.out.println("send page '" + uri + "'");
ContinuationContext context = getContext();
-
+
FlowHelper.setContextObject(ContextHelper.getObjectModel(context.getAvalonContext()), \
bizdata);
if (SourceUtil.indexOfSchemeColon(uri) == -1) {
@@ -90,7 +91,7 @@
try {
context.getRedirector().redirect(false, uri);
} catch (Exception e) {
- throw new RuntimeException("Cannot redirect to '"+uri+"'", e);
+ throw new CascadingRuntimeException("Cannot redirect to \
'"+uri+"'", e); }
} else {
throw new IllegalArgumentException("uri is not allowed to contain a \
scheme (cocoon:/ is always automatically used)"); @@ -111,7 +112,7 @@
pipeUtil.service(context.getServiceManager());
pipeUtil.processToStream(uri, bizdata, out);
} catch (Exception e) {
- throw new RuntimeException("Cannot process pipeline to '"+uri+"'", e);
+ throw new CascadingRuntimeException("Cannot process pipeline to \
'"+uri+"'", e); }
}
@@ -119,7 +120,7 @@
try {
getContext().getRedirector().redirect(false, uri);
} catch (Exception e) {
- throw new RuntimeException("Cannot redirect to '"+uri+"'", e);
+ throw new CascadingRuntimeException("Cannot redirect to '"+uri+"'", \
e); }
}
@@ -134,7 +135,7 @@
try {
return getContext().getServiceManager().lookup(id);
} catch (Exception e) {
- throw new RuntimeException("Cannot lookup component '"+id+"'", e);
+ throw new CascadingRuntimeException("Cannot lookup component \
'"+id+"'", e); }
}
@@ -144,7 +145,8 @@
* @param component a component
*/
public void releaseComponent( Object component ) {
- if (component!=null)
+ if (component != null) {
getContext().getServiceManager().release(component);
+ }
}
}
1.6 +25 -25 \
cocoon-2.1/src/blocks/portal/java/org/apache/cocoon/portal/transformation/HTMLEventLinkTransformer.java
Index: HTMLEventLinkTransformer.java
===================================================================
RCS file: /home/cvs/cocoon-2.1/src/blocks/portal/java/org/apache/cocoon/portal/transformation/HTMLEventLinkTransformer.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- HTMLEventLinkTransformer.java 26 Mar 2004 09:36:30 -0000 1.5
+++ HTMLEventLinkTransformer.java 31 Mar 2004 20:32:45 -0000 1.6
@@ -1,12 +1,12 @@
/*
* Copyright 2004,2004 The Apache Software Foundation.
- *
+ *
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -33,19 +33,19 @@
* The transformer listens for the element a and form. Links
* that only contain an anchor are ignored.
* Current we only support POSTing of forms.
- *
+ *
* @author <a href="mailto:cziegeler@apache.org">Carsten Ziegeler</a>
* @version CVS $Id$
*/
-public class HTMLEventLinkTransformer
+public class HTMLEventLinkTransformer
extends AbstractCopletTransformer {
-
+
/** The temporary attribute used to store the uri */
protected String attributeName;
-
+
/** The jxpath for the attribute */
protected String jxPath;
-
+
/* (non-Javadoc)
* @see org.apache.cocoon.sitemap.SitemapModelComponent#setup(org.apache.cocoon.environment.SourceResolver, \
java.util.Map, java.lang.String, \
org.apache.avalon.framework.parameters.Parameters)
*/
@@ -67,7 +67,7 @@
boolean processed = false;
if ("a".equals(name) ) {
final boolean isRemoteAnchor = this.isRemoteAnchor(name, attr);
- this.stack.push(Boolean.valueOf(isRemoteAnchor));
+ this.stack.push(isRemoteAnchor? Boolean.TRUE: Boolean.FALSE);
if ( isRemoteAnchor ) {
this.createAnchorEvent(uri, name, raw, attr);
processed = true;
@@ -101,18 +101,18 @@
CopletTransformer.LINK_ELEM,
"coplet:" + CopletTransformer.LINK_ELEM);
this.xmlConsumer.endPrefixMapping("coplet");
- processed = true;
+ processed = true;
}
if ( !processed ) {
super.endElement(uri, name, raw);
}
}
- protected void createAnchorEvent(String uri, String name, String raw, \
Attributes attributes) + protected void createAnchorEvent(String uri, String \
name, String raw, Attributes attributes) throws SAXException {
AttributesImpl newAttributes = new AttributesImpl();
String link = attributes.getValue("href");
-
+
CopletInstanceData cid = this.getCopletInstanceData();
link = this.getLink((String)cid.getTemporaryAttribute(this.attributeName), \
link);
@@ -127,14 +127,14 @@
newAttributes);
}
- protected void createFormEvent(String uri, String name, String raw, Attributes \
attributes) + protected void createFormEvent(String uri, String name, String \
raw, Attributes attributes) throws SAXException {
AttributesImpl newAttributes = new AttributesImpl();
String link = attributes.getValue("action");
-
+
CopletInstanceData cid = this.getCopletInstanceData();
link = this.getLink((String)cid.getTemporaryAttribute(this.attributeName), \
link);
-
+
newAttributes.addCDATAAttribute("path", this.jxPath);
newAttributes.addCDATAAttribute("value", link);
newAttributes.addCDATAAttribute("coplet", cid.getId());
@@ -147,33 +147,33 @@
newAttributes);
}
-
+
protected String getLink(String base, String link) {
final String v = SourceUtil.absolutize(base, link);
return v;
}
-
-
+
+
/**
* Determine if the element is an url and if the url points to some
- * remote source.
- *
+ * remote source.
+ *
* @param name the name of the element
* @param attributes the attributes of the element
* @return true if the href url is an anchor pointing to a remote source
*/
protected boolean isRemoteAnchor(String name, Attributes attributes) {
String link = attributes.getValue("href");
-
- // no empty link to current document
+
+ // no empty link to current document
if (link != null && link.trim().length() > 0) {
// check reference to document fragment
if (!link.trim().startsWith("#")) {
return true;
}
}
-
+
return false;
}
-
+
}
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic