You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@cocoon.apache.org by st...@locus.apache.org on 2000/09/28 00:53:36 UTC

cvs commit: xml-cocoon/src/org/apache/cocoon/serialization XLinkSerializer.java

stefano     00/09/27 15:53:36

  Modified:    src/org/apache/cocoon/serialization Tag: xml-cocoon2
                        XLinkSerializer.java
  Log:
  uses now extended linking semantics
  
  Revision  Changes    Path
  No                   revision
  
  
  No                   revision
  
  
  1.1.2.4   +14 -10    xml-cocoon/src/org/apache/cocoon/serialization/Attic/XLinkSerializer.java
  
  Index: XLinkSerializer.java
  ===================================================================
  RCS file: /home/cvs/xml-cocoon/src/org/apache/cocoon/serialization/Attic/XLinkSerializer.java,v
  retrieving revision 1.1.2.3
  retrieving revision 1.1.2.4
  diff -u -r1.1.2.3 -r1.1.2.4
  --- XLinkSerializer.java	2000/09/27 16:15:49	1.1.2.3
  +++ XLinkSerializer.java	2000/09/27 22:53:35	1.1.2.4
  @@ -17,19 +17,19 @@
   import org.xml.sax.Attributes;
   import org.xml.sax.SAXException;
   
  -import org.apache.cocoon.xml.xlink.XLinkPipe;
  +import org.apache.cocoon.xml.xlink.ExtendedXLinkPipe;
   
   /**
    * @author <a href="mailto:stefano@apache.org">Stefano Mazzocchi</a>
  - * @version CVS $Revision: 1.1.2.3 $ $Date: 2000/09/27 16:15:49 $
  + * @version CVS $Revision: 1.1.2.4 $ $Date: 2000/09/27 22:53:35 $
    */
   
  -public class XLinkSerializer extends XLinkPipe implements Serializer {
  +public class XLinkSerializer extends ExtendedXLinkPipe implements Serializer {
   
       private PrintStream out;
  -    
  +
       /**
  -     * Set the <code>OutputStream</code> where the requested resource should 
  +     * Set the <code>OutputStream</code> where the requested resource should
        * be serialized.
        */
       public void setOutputStream(OutputStream out) throws IOException {
  @@ -42,17 +42,21 @@
       public String getMimeType() {
           return Cocoon.LINK_CONTENT_TYPE;
       }
  -    
  -    public void simpleLink(String href, String role, String arcrole, String title, String show, String actuate, String uri, String name, String raw, Attributes attr) 
  +
  +    public void simpleLink(String href, String role, String arcrole, String title, String show, String actuate, String uri, String name, String raw, Attributes attr)
       throws SAXException {
  -        encode(href, role, out);
  +        if (isLocal(href)) encode(href, role, out);
       }
   
       public void startLocator(String href, String role, String title, String label, String uri, String name, String raw, Attributes attr)
       throws SAXException {
  -        encode(href, role, out);
  +        if (isLocal(href)) encode(href, role, out);
       }
  -    
  +
  +    private boolean isLocal(String href) {
  +        return (href.indexOf("://") == -1);
  +    }
  +
       private void encode(String href, String role, PrintStream out) {
           if ((role == null) || role.equals(Cocoon.LINK_CRAWLING_ROLE)) {
               out.print('+');