You are viewing a plain text version of this content. The canonical link for it is here.
Posted to portalapps-dev@portals.apache.org by ta...@apache.org on 2009/04/13 23:18:01 UTC
svn commit: r764612 [4/5] - in /portals/applications/webcontent: ./ trunk/
trunk/webcontent-jar/ trunk/webcontent-jar/src/
trunk/webcontent-jar/src/main/ trunk/webcontent-jar/src/main/java/
trunk/webcontent-jar/src/main/java/org/ trunk/webcontent-jar/s...
Added: portals/applications/webcontent/trunk/webcontent-jar/src/main/java/org/apache/portals/applications/webcontent/rewriter/xml/SaxParserAdaptor.java
URL: http://svn.apache.org/viewvc/portals/applications/webcontent/trunk/webcontent-jar/src/main/java/org/apache/portals/applications/webcontent/rewriter/xml/SaxParserAdaptor.java?rev=764612&view=auto
==============================================================================
--- portals/applications/webcontent/trunk/webcontent-jar/src/main/java/org/apache/portals/applications/webcontent/rewriter/xml/SaxParserAdaptor.java (added)
+++ portals/applications/webcontent/trunk/webcontent-jar/src/main/java/org/apache/portals/applications/webcontent/rewriter/xml/SaxParserAdaptor.java Mon Apr 13 21:17:59 2009
@@ -0,0 +1,311 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.portals.applications.webcontent.rewriter.xml;
+
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.io.Reader;
+import java.io.Writer;
+import java.net.URL;
+import java.util.HashMap;
+import java.util.Map;
+
+import javax.xml.parsers.ParserConfigurationException;
+import javax.xml.parsers.SAXParser;
+import javax.xml.parsers.SAXParserFactory;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.portals.applications.webcontent.rewriter.ParserAdaptor;
+import org.apache.portals.applications.webcontent.rewriter.Rewriter;
+import org.apache.portals.applications.webcontent.rewriter.RewriterException;
+import org.apache.portals.applications.webcontent.rewriter.MutableAttributes;
+import org.apache.portals.applications.webcontent.util.Streams;
+import org.xml.sax.InputSource;
+import org.xml.sax.SAXException;
+import org.xml.sax.helpers.DefaultHandler;
+
+/**
+ * SaxParserAdaptor
+ *
+ * @author <a href="mailto:taylor@apache.org">David Sean Taylor</a>
+ * @version $Id$
+ */
+public class SaxParserAdaptor implements ParserAdaptor
+{
+ protected final static Log log = LogFactory.getLog(SaxParserAdaptor.class);
+ private String lineSeparator;
+
+ private Rewriter rewriter;
+
+
+
+
+ public SaxParserAdaptor()
+ {
+ lineSeparator = System.getProperty("line.separator", "\r\n");
+ }
+
+ public void parse(Rewriter rewriter, Reader reader)
+ throws RewriterException
+ {
+ try
+ {
+ this.rewriter = rewriter;
+ SAXParser sp = getParser();
+ sp.parse(new InputSource(reader), new SaxFormatHandler(null));
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace();
+ throw new RewriterException(e);
+ }
+
+ }
+
+ public void rewrite(Rewriter rewriter, Reader reader, Writer writer)
+ throws RewriterException
+ {
+ // TODO Auto-generated method stub
+ }
+
+ /**
+ * Get a Parser from the SAX Parser factory
+ *
+ * @return A SAXParser
+ */
+ protected SAXParser getParser()
+ throws ParserConfigurationException, SAXException
+ {
+ SAXParserFactory spf = SAXParserFactory.newInstance ();
+ spf.setValidating(false);
+
+ return spf.newSAXParser ();
+ }
+
+ /**
+ * Inner class to handle SAX parsing of XML files
+ */
+ public class SaxFormatHandler extends DefaultHandler
+ {
+ private int elementCount = 0;
+ private boolean emit = true;
+ private Writer writer = null;
+
+ public SaxFormatHandler(Writer writer)
+ {
+ super();
+ this.writer = writer;
+ }
+
+ private void write(String text)
+ throws IOException
+ {
+ if (writer != null)
+ {
+ writer.write(text);
+ }
+ }
+
+ public void characters(char[] values, int start, int length)
+ {
+ if (false == emit)
+ return;
+
+ if (false == rewriter.enterText(values, start))
+ return;
+
+ if (writer != null)
+ {
+ try
+ {
+ writer.write(values);
+ }
+ catch(IOException e)
+ {
+ }
+ }
+ }
+
+ public void startElement(String uri, String localName, String qName, MutableAttributes attributes)
+ throws SAXException
+ {
+// System.out.println("qName = " + qName);
+// System.out.println("localName = " + localName);
+// System.out.println("uri = " + uri);
+ String tag = qName;
+
+ if (false == rewriter.enterStartTagEvent(tag.toString(), attributes))
+ return;
+
+ try
+ {
+ appendTagToResult(tag, attributes);
+ write(lineSeparator);
+ String appended = rewriter.exitStartTagEvent(tag.toString(), attributes);
+ if (null != appended)
+ {
+ write(appended);
+ }
+ }
+ catch (Exception e)
+ {
+ log.error("Start tag parsing error", e);
+ }
+ }
+
+ public void endElement(String uri, String localName, String qName)
+ throws SAXException
+ {
+ String tag = qName;
+ elementCount++;
+ if (false == rewriter.enterEndTagEvent(tag.toString()))
+ return;
+
+ try
+ {
+ addToResult("</").addToResult(tag).addToResult(">");
+
+ write(lineSeparator);
+ String appended = rewriter.exitEndTagEvent(tag.toString());
+ if (null != appended)
+ {
+ write(appended);
+ }
+ }
+ catch (Exception e)
+ {
+ log.error("End tag parsing error", e);
+ }
+
+ }
+
+ /*
+ * Writes output to the final stream for all attributes of a given tag.
+ *
+ * @param tag The HTML tag being output.
+ * @param attrs The mutable HTML attribute set for the current HTML tag.
+ */
+ private void appendTagToResult(String tag, MutableAttributes attrs)
+ {
+ convertURLS(tag, attrs);
+ addToResult("<").addToResult(tag);
+ for (int ix = 0; ix < attrs.getLength(); ix++)
+ {
+ String value = attrs.getValue(ix);
+ addToResult(" ").addToResult(value).addToResult("=\"").
+ addToResult(value).addToResult("\"");
+ }
+ addToResult(">");
+ }
+
+ /*
+ * Used to write tag and attribute objects to the output stream.
+ * Returns a reference to itself so that these calls can be chained.
+ *
+ * @param txt Any text to be written out to stream with toString method.
+ * The object being written should implement its toString method.
+ * @return A handle to the this, the callback, for chaining results.
+ *
+ */
+ private SaxFormatHandler addToResult(Object txt)
+ {
+ // to allow for implementation using Stringbuffer or StringWriter
+ // I don't know yet, which one is better in this case
+ // if (ignoreLevel > 0 ) return this;
+
+ try
+ {
+ write(txt.toString());
+ }
+ catch (Exception e)
+ {
+ System.err.println("Error parsing:" + e);
+ }
+ return this;
+ }
+
+ /*
+ * Determines which HTML Tag/Element is being inspected, and calls the
+ * appropriate converter for that context. This method contains all the
+ * logic for determining how tags are rewritten.
+ *
+ * TODO: it would be better to drive this logic off a state table that is not
+ * tied to the Hot Java parser.
+ *
+ * @param tag TAG from the Callback-Interface.
+ * @param attrs The mutable HTML attribute set for the current HTML element.
+ */
+
+ private void convertURLS(String tag, MutableAttributes attrs)
+ {
+ rewriter.enterConvertTagEvent(tag.toString(), attrs);
+ }
+
+ public InputSource resolveEntity (String publicId, String systemId)
+ {
+
+ try
+ {
+ Map dtds = getDtds();
+ byte[] dtd = (byte[])dtds.get(systemId);
+ if (dtd == null)
+ {
+ ByteArrayOutputStream baos = new ByteArrayOutputStream();
+ URL url = new URL(systemId);
+ Streams.drain(url.openStream(), baos);
+ dtd = baos.toByteArray();
+ dtds.put(systemId, dtd);
+ }
+
+ if (dtd != null)
+ {
+ ByteArrayInputStream bais = new ByteArrayInputStream(dtd);
+ InputSource is = new InputSource(bais);
+ is.setPublicId( publicId );
+ is.setSystemId( systemId );
+
+ return is;
+ }
+ }
+ catch(Throwable t ) // java.io.IOException x
+ {
+ t.printStackTrace();
+ log.error("failed to get URL input source", t);
+ }
+
+ // forces to get dtd over internet
+ return null;
+ }
+
+ }
+
+ // DTD Map
+ static private Map dtds = new HashMap();
+
+ public static Map getDtds()
+ {
+ return dtds;
+ }
+
+ public static void clearDtdCache()
+ {
+ dtds.clear();
+ }
+
+}
Propchange: portals/applications/webcontent/trunk/webcontent-jar/src/main/java/org/apache/portals/applications/webcontent/rewriter/xml/SaxParserAdaptor.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: portals/applications/webcontent/trunk/webcontent-jar/src/main/java/org/apache/portals/applications/webcontent/rewriter/xml/SaxParserAdaptor.java
------------------------------------------------------------------------------
svn:keywords = Id
Added: portals/applications/webcontent/trunk/webcontent-jar/src/main/java/org/apache/portals/applications/webcontent/util/Streams.java
URL: http://svn.apache.org/viewvc/portals/applications/webcontent/trunk/webcontent-jar/src/main/java/org/apache/portals/applications/webcontent/util/Streams.java?rev=764612&view=auto
==============================================================================
--- portals/applications/webcontent/trunk/webcontent-jar/src/main/java/org/apache/portals/applications/webcontent/util/Streams.java (added)
+++ portals/applications/webcontent/trunk/webcontent-jar/src/main/java/org/apache/portals/applications/webcontent/util/Streams.java Mon Apr 13 21:17:59 2009
@@ -0,0 +1,143 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.portals.applications.webcontent.util;
+
+import java.io.ByteArrayOutputStream;
+import java.io.InputStream;
+import java.io.IOException;
+import java.io.OutputStream;
+import java.io.OutputStreamWriter;
+import java.io.Reader;
+import java.io.Writer;
+import java.io.InputStreamReader;
+
+/**
+ * Utility functions related to Streams.
+ *
+ * @author <a href="mailto:taylor@apache.org">David Sean Taylor</a>
+ * @version $Id$
+ */
+public class Streams
+{
+ static final int BLOCK_SIZE=4096;
+
+ public static void drain(InputStream r,OutputStream w) throws IOException
+ {
+ byte[] bytes=new byte[BLOCK_SIZE];
+ try
+ {
+ int length=r.read(bytes);
+ while(length!=-1)
+ {
+ if(length!=0)
+ {
+ w.write(bytes,0,length);
+ }
+ length=r.read(bytes);
+ }
+ }
+ finally
+ {
+ bytes=null;
+ }
+
+ }
+
+ public static void drain(Reader r,Writer w) throws IOException
+ {
+ char[] bytes=new char[BLOCK_SIZE];
+ try
+ {
+ int length=r.read(bytes);
+ while(length!=-1)
+ {
+ if(length!=0)
+ {
+ w.write(bytes,0,length);
+ }
+ length=r.read(bytes);
+ }
+ }
+ finally
+ {
+ bytes=null;
+ }
+
+ }
+
+ public static void drain(Reader r,OutputStream os) throws IOException
+ {
+ Writer w=new OutputStreamWriter(os);
+ drain(r,w);
+ w.flush();
+ }
+
+ public static void drain(InputStream is, Writer w) throws IOException
+ {
+ Reader r = new InputStreamReader(is);
+ drain(r,w);
+ w.flush();
+ }
+
+ public static byte[] drain(InputStream r) throws IOException
+ {
+ ByteArrayOutputStream bytes=new ByteArrayOutputStream();
+ drain(r,bytes);
+ return bytes.toByteArray();
+ }
+
+ public static String getAsString(InputStream is)
+ {
+ int c=0;
+ char lineBuffer[]=new char[128], buf[]=lineBuffer;
+ int room= buf.length, offset=0;
+ try
+ {
+ loop: while (true)
+ {
+ // read chars into a buffer which grows as needed
+ switch (c = is.read() )
+ {
+ case -1: break loop;
+
+ default: if (--room < 0)
+ {
+ buf = new char[offset + 128];
+ room = buf.length - offset - 1;
+ System.arraycopy(lineBuffer, 0,
+ buf, 0, offset);
+ lineBuffer = buf;
+ }
+ buf[offset++] = (char) c;
+ break;
+ }
+ }
+ }
+ catch(IOException ioe)
+ {
+ ioe.printStackTrace();
+ }
+ if ((c == -1) && (offset == 0))
+ {
+ return null;
+ }
+ return String.copyValueOf(buf, 0, offset);
+ }
+
+
+
+}
Propchange: portals/applications/webcontent/trunk/webcontent-jar/src/main/java/org/apache/portals/applications/webcontent/util/Streams.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: portals/applications/webcontent/trunk/webcontent-jar/src/main/java/org/apache/portals/applications/webcontent/util/Streams.java
------------------------------------------------------------------------------
svn:keywords = Id
Added: portals/applications/webcontent/trunk/webcontent-jar/src/test/java/log4j.properties
URL: http://svn.apache.org/viewvc/portals/applications/webcontent/trunk/webcontent-jar/src/test/java/log4j.properties?rev=764612&view=auto
==============================================================================
--- portals/applications/webcontent/trunk/webcontent-jar/src/test/java/log4j.properties (added)
+++ portals/applications/webcontent/trunk/webcontent-jar/src/test/java/log4j.properties Mon Apr 13 21:17:59 2009
@@ -0,0 +1,36 @@
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements. See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You 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.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+# ------------------------------------------------------------------------
+#
+# Logging Configuration
+#
+# $Id$
+#
+# ------------------------------------------------------------------------
+
+log4j.rootLogger = ERROR, errorlogging
+
+log4j.appender.errorlogging = org.apache.log4j.FileAppender
+log4j.appender.errorlogging.file = ${basedir}/target/surefire-reports/tests-error.log
+log4j.appender.errorlogging.layout = org.apache.log4j.PatternLayout
+log4j.appender.errorlogging.layout.conversionPattern = %d [%t] %-5p %c - %m%n
+log4j.appender.errorlogging.append = false
+
+log4j.appender.infologging = org.apache.log4j.FileAppender
+log4j.appender.infologging.file = ${basedir}/target/surefire-reports/tests-info.log
+log4j.appender.infologging.layout = org.apache.log4j.PatternLayout
+log4j.appender.infologging.layout.conversionPattern = %d [%t] %-5p %c - %m%n
+log4j.appender.infologging.append = false
Propchange: portals/applications/webcontent/trunk/webcontent-jar/src/test/java/log4j.properties
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: portals/applications/webcontent/trunk/webcontent-jar/src/test/java/log4j.properties
------------------------------------------------------------------------------
svn:keywords = Id
Added: portals/applications/webcontent/trunk/webcontent-jar/src/test/java/org/apache/portals/applications/webcontent/rewriter/RewriterTestCase.java
URL: http://svn.apache.org/viewvc/portals/applications/webcontent/trunk/webcontent-jar/src/test/java/org/apache/portals/applications/webcontent/rewriter/RewriterTestCase.java?rev=764612&view=auto
==============================================================================
--- portals/applications/webcontent/trunk/webcontent-jar/src/test/java/org/apache/portals/applications/webcontent/rewriter/RewriterTestCase.java (added)
+++ portals/applications/webcontent/trunk/webcontent-jar/src/test/java/org/apache/portals/applications/webcontent/rewriter/RewriterTestCase.java Mon Apr 13 21:17:59 2009
@@ -0,0 +1,48 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.portals.applications.webcontent.rewriter;
+
+import junit.framework.TestCase;
+
+public class RewriterTestCase extends TestCase
+{
+ private String baseDir;
+
+ public RewriterTestCase(String name)
+ {
+ super(name);
+ }
+
+ public String getBaseDir()
+ {
+ if (baseDir == null)
+ {
+ baseDir = System.getProperty("basedir");
+ if (baseDir == null || baseDir.length() == 0)
+ {
+ baseDir = ".";
+ }
+ baseDir += "/";
+ }
+ return baseDir;
+ }
+
+ public void testBase()
+ {
+ System.out.println("Testing...");
+ }
+}
\ No newline at end of file
Propchange: portals/applications/webcontent/trunk/webcontent-jar/src/test/java/org/apache/portals/applications/webcontent/rewriter/RewriterTestCase.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: portals/applications/webcontent/trunk/webcontent-jar/src/test/java/org/apache/portals/applications/webcontent/rewriter/RewriterTestCase.java
------------------------------------------------------------------------------
svn:keywords = Id
Added: portals/applications/webcontent/trunk/webcontent-jar/src/test/java/org/apache/portals/applications/webcontent/rewriter/TestNekoRewriter.java
URL: http://svn.apache.org/viewvc/portals/applications/webcontent/trunk/webcontent-jar/src/test/java/org/apache/portals/applications/webcontent/rewriter/TestNekoRewriter.java?rev=764612&view=auto
==============================================================================
--- portals/applications/webcontent/trunk/webcontent-jar/src/test/java/org/apache/portals/applications/webcontent/rewriter/TestNekoRewriter.java (added)
+++ portals/applications/webcontent/trunk/webcontent-jar/src/test/java/org/apache/portals/applications/webcontent/rewriter/TestNekoRewriter.java Mon Apr 13 21:17:59 2009
@@ -0,0 +1,225 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.portals.applications.webcontent.rewriter;
+
+import java.io.File;
+import java.io.FileReader;
+import java.io.FileWriter;
+import java.io.IOException;
+import java.util.Arrays;
+
+import org.apache.portals.applications.webcontent.rewriter.html.neko.NekoParserAdaptor;
+import org.apache.portals.applications.webcontent.rewriter.rules.Ruleset;
+import org.apache.portals.applications.webcontent.rewriter.xml.SaxParserAdaptor;
+
+import junit.framework.Test;
+import junit.framework.TestSuite;
+import junit.framework.TestCase;
+
+
+/**
+ * TestNekoRewriter
+ *
+ * @author <a href="mailto:dyoung@phase2systems.com">David L Young</a>
+ * @version $Id$
+ */
+public class TestNekoRewriter extends RewriterTestCase
+{
+
+ /**
+ * Defines the testcase name for JUnit.
+ *
+ * @param name
+ * the testcase's name.
+ */
+ public TestNekoRewriter(String name)
+ {
+ super(name);
+ }
+
+ /**
+ * Start the tests.
+ *
+ * @param args
+ * the arguments. Not used
+ */
+ public static void main(String args[])
+ {
+ junit.awtui.TestRunner.main(new String[]
+ { TestNekoRewriter.class.getName()});
+ }
+
+ public static Test suite()
+ {
+ // All methods starting with "test" will be executed in the test suite.
+ return new TestSuite(TestNekoRewriter.class);
+ }
+
+
+ // DOMParser example
+
+ /* BOZO
+
+ public void testDOM() throws Exception
+ {
+ System.out.println( "testing...DOM" ) ;
+
+ // parse something and echo the DOM tree
+ String target = "http://www.google.com" ;
+ System.out.println( "Parsing: " + target ) ;
+
+ DOMParser parser = new DOMParser() ;
+ parser.parse( target ) ;
+ System.out.println( "parse() result..." ) ;
+ print( parser.getDocument(), "" ) ;
+ }
+
+ void print( Node node, String indent )
+ {
+ System.out.println(indent+node.getClass().getName());
+ Node child = node.getFirstChild();
+ while (child != null) {
+ print(child, indent+" ");
+ child = child.getNextSibling();
+ }
+ }
+ */
+
+
+ // SAXParser example
+
+ /* BOZO
+
+ public void testSAX() throws Exception
+ {
+ System.out.println( "testing...SAX" ) ;
+
+ // parse something to stdout
+ String target = "http://www.google.com" ;
+ System.out.println( "Parsing: " + target ) ;
+
+ SAXParser parser = new SAXParser() ;
+
+ // create pipeline filters
+ org.cyberneko.html.filters.Writer writer = new org.cyberneko.html.filters.Writer();
+ Purifier purifier = new Purifier() ;
+
+ // setup filter chain
+ XMLDocumentFilter[] filters = {
+ purifier,
+ writer,
+ };
+
+ parser.setProperty("http://cyberneko.org/html/properties/filters", filters);
+
+ // parse documents
+ XMLInputSource source = new XMLInputSource(null, target, null);
+ parser.parse(source);
+ }
+ */
+
+
+
+ // NekoParserAdapter test
+
+ public void testNekoParserAdaptor() throws Exception
+ {
+ RewriterController controller = getController();
+ FileReader rulesReader = getTestReader("test-remove-rules.xml");
+ Ruleset ruleset = controller.loadRuleset(rulesReader);
+ rulesReader.close();
+ assertNotNull("ruleset is null", ruleset);
+ RulesetRewriter rewriter = controller.createRewriter(ruleset);
+ assertNotNull("ruleset rewriter is null", rewriter);
+
+ FileReader htmlReader = getTestReader("test-001.html");
+ FileWriter htmlWriter = getTestWriter("test-002-output.html");
+
+ ParserAdaptor adaptor = controller.createParserAdaptor("text/html");
+ rewriter.setBaseUrl("http://www.rewriter.com");
+ rewriter.rewrite(adaptor, htmlReader, htmlWriter);
+ htmlReader.close();
+ }
+
+ private RewriterController getController() throws Exception
+ {
+ Class[] rewriterClasses = new Class[]{ RulesetRewriterImpl.class, RulesetRewriterImpl.class};
+
+ Class[] adaptorClasses = new Class[]{ NekoParserAdaptor.class, SaxParserAdaptor.class};
+ return new MappingRewriterController(getBaseDir()+"src/test/webapp/WEB-INF/conf/rewriter-rules-mapping.xml", Arrays.asList(rewriterClasses), Arrays.asList(adaptorClasses));
+ }
+
+ /*
+ private Reader getRemoteReader(String uri) throws IOException
+ {
+ HttpClient client = new HttpClient();
+ GetMethod get = new GetMethod(uri);
+ client.executeMethod(get);
+ BufferedInputStream bis = new BufferedInputStream(get.getResponseBodyAsStream());
+ String encoding = get.getResponseCharSet();
+ return new InputStreamReader(bis, encoding);
+ }
+ */
+
+ /**
+ * Gets a reader for a given filename in the test directory.
+ *
+ * @return A file reader to the test rules file
+ * @throws IOException
+ */
+ private FileReader getTestReader(String filename) throws IOException
+ {
+ return new FileReader(getBaseDir()+"src/test/rewriter/" + filename);
+ }
+
+ /**
+ * Gets a writer for a given filename in the test directory.
+ *
+ * @return A file reader to the test rules file
+ * @throws IOException
+ */
+ private FileWriter getTestWriter(String filename) throws IOException
+ {
+ new File(getBaseDir()+"target/test/rewriter").mkdirs();
+ return new FileWriter(getBaseDir()+"target/test/rewriter/" + filename);
+ }
+
+
+ /* BOZO
+ public void testNekoWebTarget() throws Exception
+ {
+ // parse something with the NekoParserAdaptor
+ String target = "http://www.google.com";
+
+ RewriterController controller = getController();
+ FileReader rulesReader = getTestReader("test-remove-rules.xml");
+ Ruleset ruleset = controller.loadRuleset(rulesReader);
+ rulesReader.close();
+ assertNotNull("ruleset is null", ruleset);
+ RulesetRewriter rewriter = controller.createRewriter(ruleset);
+ assertNotNull("ruleset rewriter is null", rewriter);
+
+ java.io.Reader htmlReader = getRemoteReader(target);
+ java.io.Writer htmlWriter = new OutputStreamWriter(System.out);
+
+ ParserAdaptor adaptor = controller.createParserAdaptor("text/html");
+ rewriter.setBaseUrl("http://www.rewriter.com");
+ rewriter.rewrite(adaptor, htmlReader, htmlWriter);
+ htmlReader.close();
+ }
+ */
+}
Propchange: portals/applications/webcontent/trunk/webcontent-jar/src/test/java/org/apache/portals/applications/webcontent/rewriter/TestNekoRewriter.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: portals/applications/webcontent/trunk/webcontent-jar/src/test/java/org/apache/portals/applications/webcontent/rewriter/TestNekoRewriter.java
------------------------------------------------------------------------------
svn:keywords = Id
Added: portals/applications/webcontent/trunk/webcontent-jar/src/test/java/org/apache/portals/applications/webcontent/rewriter/TestRewriterController.java
URL: http://svn.apache.org/viewvc/portals/applications/webcontent/trunk/webcontent-jar/src/test/java/org/apache/portals/applications/webcontent/rewriter/TestRewriterController.java?rev=764612&view=auto
==============================================================================
--- portals/applications/webcontent/trunk/webcontent-jar/src/test/java/org/apache/portals/applications/webcontent/rewriter/TestRewriterController.java (added)
+++ portals/applications/webcontent/trunk/webcontent-jar/src/test/java/org/apache/portals/applications/webcontent/rewriter/TestRewriterController.java Mon Apr 13 21:17:59 2009
@@ -0,0 +1,304 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.portals.applications.webcontent.rewriter;
+
+import java.io.File;
+import java.io.FileReader;
+import java.io.FileWriter;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.io.Reader;
+import java.net.URL;
+import java.util.Arrays;
+import java.util.Iterator;
+
+import junit.framework.Test;
+import junit.framework.TestSuite;
+
+import org.apache.commons.httpclient.HttpClient;
+import org.apache.commons.httpclient.methods.GetMethod;
+import org.apache.portals.applications.webcontent.rewriter.html.SwingParserAdaptor;
+import org.apache.portals.applications.webcontent.rewriter.rules.Attribute;
+import org.apache.portals.applications.webcontent.rewriter.rules.Rule;
+import org.apache.portals.applications.webcontent.rewriter.rules.Ruleset;
+import org.apache.portals.applications.webcontent.rewriter.rules.Tag;
+import org.apache.portals.applications.webcontent.rewriter.xml.SaxParserAdaptor;
+
+/**
+ * TestRewriterRules
+ *
+ * @author <a href="mailto:taylor@apache.org">David Sean Taylor </a>
+ * @version $Id: TestRewriterController.java,v 1.3 2004/10/13 15:53:22 weaver
+ * Exp $
+ */
+public class TestRewriterController extends RewriterTestCase
+{
+
+ /**
+ * Defines the testcase name for JUnit.
+ *
+ * @param name
+ * the testcase's name.
+ */
+ public TestRewriterController(String name)
+ {
+ super(name);
+ }
+
+ /**
+ * Start the tests.
+ *
+ * @param args
+ * the arguments. Not used
+ */
+ public static void main(String args[])
+ {
+ junit.awtui.TestRunner.main(new String[]
+ { TestRewriterController.class.getName()});
+ }
+
+ public static Test suite()
+ {
+ // All methods starting with "test" will be executed in the test suite.
+ return new TestSuite(TestRewriterController.class);
+ }
+
+ public void testFactories() throws Exception
+ {
+ RewriterController component = getController();
+ assertNotNull("template component is null", component);
+
+ Rewriter basic = component.createRewriter();
+ assertNotNull("basic rewriter is null", basic);
+ FileReader reader = new FileReader(getBaseDir()+"src/test/rewriter/test-rewriter-rules.xml");
+ Ruleset ruleset = component.loadRuleset(reader);
+ assertNotNull("ruleset is null", ruleset);
+ RulesetRewriter rewriter = component.createRewriter(ruleset);
+ assertNotNull("ruleset rewriter is null", rewriter);
+ assertNotNull("ruleset is null", rewriter.getRuleset());
+ }
+
+ public void testRules() throws Exception
+ {
+ RewriterController component = getController();
+ assertNotNull("template component is null", component);
+
+ assertNotNull("rewriter component is null", component);
+ FileReader reader = new FileReader(getBaseDir()+"src/test/rewriter/test-rewriter-rules.xml");
+ Ruleset ruleset = component.loadRuleset(reader);
+ assertNotNull("ruleset is null", ruleset);
+ assertEquals("ruleset id", "test-set-101", ruleset.getId());
+ Iterator rules = ruleset.getRules().iterator();
+ assertNotNull("rules is null", rules);
+
+ //
+ // test tags
+ //
+ Iterator tags = ruleset.getTags().iterator();
+ while (tags.hasNext())
+ {
+ Tag tag = (Tag) tags.next();
+ if (tag.getId().equalsIgnoreCase("FORM"))
+ {
+ assertFalse("Remove", tag.getRemove());
+ Iterator attributes = tag.getAttributes().iterator();
+ while (attributes.hasNext())
+ {
+ Attribute attribute = (Attribute) attributes.next();
+ assertTrue("attribute is not ACTION", attribute.getId().equals("ACTION"));
+ assertEquals("attribute rule not equal", attribute.getRule().getId(), "merge");
+ }
+ }
+ else if (tag.getId().equalsIgnoreCase("INPUT"))
+ {
+ assertFalse("Remove", tag.getRemove());
+ Iterator attributes = tag.getAttributes().iterator();
+ while (attributes.hasNext())
+ {
+ Attribute attribute = (Attribute) attributes.next();
+ assertTrue("attribute is not SOURCE", attribute.getId().equals("SOURCE"));
+ assertEquals("attribute rule not equal", attribute.getRule().getId(), "test");
+ }
+
+ }
+ else if (tag.getId().equalsIgnoreCase("LINK"))
+ {
+ assertFalse("Remove", tag.getRemove());
+ Iterator attributes = tag.getAttributes().iterator();
+ while (attributes.hasNext())
+ {
+ Attribute attribute = (Attribute) attributes.next();
+ assertTrue("attribute is not HREF", attribute.getId().equals("HREF"));
+ assertEquals("attribute rule not equal", attribute.getRule().getId(), "merge");
+ }
+ }
+ else if (tag.getId().equalsIgnoreCase("HEAD"))
+ {
+ assertTrue("Remove", tag.getRemove());
+ }
+ else
+ {
+ assertTrue("tag name unexpected: " + tag.getId(), false);
+ }
+
+ }
+ assertNotNull("tags is null", tags);
+
+ //
+ // test rules
+ //
+ while (rules.hasNext())
+ {
+ Rule rule = (Rule) rules.next();
+ assertNotNull("rule is null", rule);
+ if (rule.getId().equals("merge"))
+ {
+ assertEquals("Rule id", rule.getId(), "merge");
+ assertTrue("Rule Use Base", rule.getUseBase());
+ assertFalse("Rule Popup", rule.getPopup());
+ assertEquals("Rule Suffix", rule.getSuffix(), "/web");
+ }
+ else if (rule.getId().equals("test"))
+ {
+ assertEquals("Rule id", rule.getId(), "test");
+ assertFalse("Rule Use Base", rule.getUseBase());
+ assertTrue("Rule Popup", rule.getPopup());
+ assertEquals("Rule Suffix", rule.getSuffix(), "/whatever&xxx=1");
+ }
+ else
+ {
+ assertTrue("rule name unexpected: " + rule.getId(), false);
+ }
+ }
+
+ }
+
+ public void testRewriting() throws Exception
+ {
+ RewriterController component = getController();
+ assertNotNull("template component is null", component);
+
+ assertNotNull("rewriter component is null", component);
+
+ FileReader reader = new FileReader(getBaseDir()+"src/test/rewriter/test-remove-rules.xml");
+
+ Ruleset ruleset = component.loadRuleset(reader);
+ reader.close();
+ assertNotNull("ruleset is null", ruleset);
+ RulesetRewriter rewriter = component.createRewriter(ruleset);
+ assertNotNull("ruleset rewriter is null", rewriter);
+ assertNotNull("ruleset is null", rewriter.getRuleset());
+
+ FileReader htmlReader = new FileReader(getBaseDir()+"src/test/rewriter/test-001.html");
+ FileWriter htmlWriter = getTestWriter("test-001-output.html");
+
+ ParserAdaptor adaptor = component.createParserAdaptor("text/html");
+ rewriter.setBaseUrl("http://www.rewriter.com");
+ rewriter.rewrite(adaptor, htmlReader, htmlWriter);
+ htmlWriter.close();
+ htmlReader.close();
+
+ // validate result
+ FileReader testReader = new FileReader(getBaseDir()+"target/test/rewriter/test-001-output.html");
+ UnitTestRewriter testRewriter = new UnitTestRewriter();
+ testRewriter.parse(component.createParserAdaptor("text/html"), testReader);
+ assertTrue("1st rewritten anchor: " + testRewriter.getAnchorValue("1"), testRewriter.getAnchorValue("1")
+ .equals("http://www.bluesunrise.com/suffix"));
+ assertTrue("2nd rewritten anchor: " + testRewriter.getAnchorValue("2"), testRewriter.getAnchorValue("2")
+ .equals("http://www.rewriter.com/stuff/junk/stuffedjunk.html/suffix"));
+ assertTrue("3rd rewritten anchor: " + testRewriter.getAnchorValue("3"), testRewriter.getAnchorValue("3")
+ .equals("http://www.rewriter.com/stuff/junk/stuffedjunk.html/suffix"));
+ assertTrue("4th rewritten anchor: " + testRewriter.getAnchorValue("4"), testRewriter.getAnchorValue("4")
+ .equals("javascript:whatever()"));
+ assertTrue("5th rewritten anchor: " + testRewriter.getAnchorValue("5"), testRewriter.getAnchorValue("5")
+ .equals("mailto:david@bluesunrise.com"));
+ assertTrue("6th rewritten anchor: " + testRewriter.getAnchorValue("6"), testRewriter.getAnchorValue("6")
+ .equals("#INTERNAL"));
+
+ assertTrue("Paragraph text: " + testRewriter.getParagraph(), testRewriter.getParagraph().equals(
+ "This is a test"));
+ }
+
+ /**
+ * Gets a writer for a given filename in the test directory.
+ *
+ * @return A file reader to the test rules file
+ * @throws IOException
+ */
+ private FileWriter getTestWriter(String filename) throws IOException
+ {
+ new File(getBaseDir()+"target/test/rewriter").mkdirs();
+ return new FileWriter(getBaseDir()+"target/test/rewriter/" + filename);
+ }
+
+
+ private RewriterController getController() throws Exception
+ {
+ Class[] rewriterClasses = new Class[]
+ { RulesetRewriterImpl.class, RulesetRewriterImpl.class};
+
+ //Class[] rewriterClasses = new Class[]
+ // { WebContentRewriter.class, WebContentRewriter.class};
+
+ Class[] adaptorClasses = new Class[]
+ { SwingParserAdaptor.class, SaxParserAdaptor.class};
+ return new MappingRewriterController(getBaseDir()+"src/test/webapp/WEB-INF/conf/rewriter-rules-mapping.xml", Arrays
+ .asList(rewriterClasses), Arrays.asList(adaptorClasses));
+ }
+
+ public void XXXtestExternalRewriting() throws Exception
+ {
+ RewriterController component = getController();
+ assertNotNull("template component is null", component);
+
+ assertNotNull("rewriter component is null", component);
+
+ Reader reader = new FileReader(getBaseDir()+"src/test/rewriter/default-rewriter-rules.xml");
+
+ Ruleset ruleset = component.loadRuleset(reader);
+ reader.close();
+ assertNotNull("ruleset is null", ruleset);
+ RulesetRewriter rewriter = component.createRewriter(ruleset);
+ assertNotNull("ruleset rewriter is null", rewriter);
+ assertNotNull("ruleset is null", rewriter.getRuleset());
+
+ String source = "http://jakarta.apache.org/tomcat/";
+ Reader htmlReader = getRemoteReader(source);
+ FileWriter htmlWriter = getTestWriter("test-002-output.html");
+
+ ParserAdaptor adaptor = component.createParserAdaptor("text/html");
+
+ URL baseURL = new URL(source);
+ String baseurl = baseURL.getProtocol() + "://" + baseURL.getHost();
+
+ rewriter.setBaseUrl(baseurl);
+ rewriter.rewrite(adaptor, htmlReader, htmlWriter);
+ htmlWriter.close();
+ htmlReader.close();
+ }
+
+ private Reader getRemoteReader(String uri) throws IOException
+ {
+ HttpClient client = new HttpClient();
+ GetMethod get = new GetMethod(uri);
+ client.executeMethod(get);
+ InputStream is = get.getResponseBodyAsStream();
+ return new InputStreamReader(is);
+ }
+
+}
Propchange: portals/applications/webcontent/trunk/webcontent-jar/src/test/java/org/apache/portals/applications/webcontent/rewriter/TestRewriterController.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: portals/applications/webcontent/trunk/webcontent-jar/src/test/java/org/apache/portals/applications/webcontent/rewriter/TestRewriterController.java
------------------------------------------------------------------------------
svn:keywords = Id
Added: portals/applications/webcontent/trunk/webcontent-jar/src/test/java/org/apache/portals/applications/webcontent/rewriter/UnitTestRewriter.java
URL: http://svn.apache.org/viewvc/portals/applications/webcontent/trunk/webcontent-jar/src/test/java/org/apache/portals/applications/webcontent/rewriter/UnitTestRewriter.java?rev=764612&view=auto
==============================================================================
--- portals/applications/webcontent/trunk/webcontent-jar/src/test/java/org/apache/portals/applications/webcontent/rewriter/UnitTestRewriter.java (added)
+++ portals/applications/webcontent/trunk/webcontent-jar/src/test/java/org/apache/portals/applications/webcontent/rewriter/UnitTestRewriter.java Mon Apr 13 21:17:59 2009
@@ -0,0 +1,73 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.portals.applications.webcontent.rewriter;
+
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * TestRewriter
+ *
+ * @author <a href="mailto:taylor@apache.org">David Sean Taylor</a>
+ * @version $Id$
+ */
+public class UnitTestRewriter extends BasicRewriter
+{
+ private Map anchors = new HashMap();
+ private String paragraph = null;
+ private boolean inParagraph = false;
+
+ public String getAnchorValue(String name)
+ {
+ return (String)anchors.get(name);
+ }
+
+ public String getParagraph()
+ {
+ return paragraph;
+ }
+
+ public boolean enterStartTagEvent(String tag, MutableAttributes attrs)
+ {
+ if (tag.equalsIgnoreCase("a"))
+ {
+ anchors.put(attrs.getValue("name"), attrs.getValue("href"));
+ }
+ if (tag.equalsIgnoreCase("p"))
+ {
+ inParagraph = true;
+ }
+ return true;
+ }
+
+ public boolean enterText(char[] values, int param)
+ {
+ if (inParagraph)
+ {
+ paragraph = new String(values);
+ }
+ return true;
+ }
+
+ public String exitEndTagEvent(String tag)
+ {
+ inParagraph = false;
+ return "";
+ }
+
+
+}
Propchange: portals/applications/webcontent/trunk/webcontent-jar/src/test/java/org/apache/portals/applications/webcontent/rewriter/UnitTestRewriter.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: portals/applications/webcontent/trunk/webcontent-jar/src/test/java/org/apache/portals/applications/webcontent/rewriter/UnitTestRewriter.java
------------------------------------------------------------------------------
svn:keywords = Id
Added: portals/applications/webcontent/trunk/webcontent-jar/src/test/rewriter/default-rewriter-rules.xml
URL: http://svn.apache.org/viewvc/portals/applications/webcontent/trunk/webcontent-jar/src/test/rewriter/default-rewriter-rules.xml?rev=764612&view=auto
==============================================================================
--- portals/applications/webcontent/trunk/webcontent-jar/src/test/rewriter/default-rewriter-rules.xml (added)
+++ portals/applications/webcontent/trunk/webcontent-jar/src/test/rewriter/default-rewriter-rules.xml Mon Apr 13 21:17:59 2009
@@ -0,0 +1,75 @@
+<?xml version='1.0' ?>
+<!--
+Licensed to the Apache Software Foundation (ASF) under one or more
+contributor license agreements. See the NOTICE file distributed with
+this work for additional information regarding copyright ownership.
+The ASF licenses this file to You 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.
+See the License for the specific language governing permissions and
+limitations under the License.
+-->
+<ruleset id='test-set-102' remove-comments='false'>
+
+<!-- standard rewriter link rules -->
+<rule id='base' use-base='true' ignore-prefixes='javascript:,mailto:,#'/>
+
+<!-- remove tags -->
+<tag id='html' remove='true'/>
+<tag id='frameset' remove='true'/>
+<tag id='frame' remove='true'/>
+<tag id='noframes' remove='true'/>
+<tag id='body' remove='true'/>
+
+<!-- strip tags -->
+<tag id='head' strip='true'/>
+
+<!-- rewritten tags -->
+<tag id='a'>
+ <attribute id='href' rule='base'/>
+</tag>
+<tag id='link'>
+ <attribute id='href' rule='base'/>
+</tag>
+<tag id='img'>
+ <attribute id='src' rule='base'/>
+</tag>
+<tag id='input'>
+ <attribute id='src' rule='base'/>
+</tag>
+<tag id='option'>
+ <attribute id='value' rule='base'/>
+</tag>
+<tag id='applet'>
+ <attribute id='codebase' rule='base'/>
+</tag>
+<tag id='frame'>
+ <attribute id='src' rule='base'/>
+</tag>
+<tag id='script'>
+ <attribute id='src' rule='base'/>
+</tag>
+<tag id='form'>
+ <attribute id='action' rule='base'/>
+</tag>
+<tag id='area'>
+ <attribute id='href' rule='base'/>
+</tag>
+<tag id='body'>
+ <attribute id='background' rule='base'/>
+</tag>
+<tag id='td'>
+ <attribute id='background' rule='base'/>
+</tag>
+
+<!-- sample rules -->
+<rule id='portal-popup' popup='true' use-base='true' suffix='/portal' ignore-prefixes='javascript:,mailto:'/>
+<rule id='test' use-base='false' suffix='/whatever&xxx=1' popup='1'/>
+
+</ruleset>
Propchange: portals/applications/webcontent/trunk/webcontent-jar/src/test/rewriter/default-rewriter-rules.xml
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: portals/applications/webcontent/trunk/webcontent-jar/src/test/rewriter/default-rewriter-rules.xml
------------------------------------------------------------------------------
svn:keywords = Id
Added: portals/applications/webcontent/trunk/webcontent-jar/src/test/rewriter/test-001.html
URL: http://svn.apache.org/viewvc/portals/applications/webcontent/trunk/webcontent-jar/src/test/rewriter/test-001.html?rev=764612&view=auto
==============================================================================
--- portals/applications/webcontent/trunk/webcontent-jar/src/test/rewriter/test-001.html (added)
+++ portals/applications/webcontent/trunk/webcontent-jar/src/test/rewriter/test-001.html Mon Apr 13 21:17:59 2009
@@ -0,0 +1,49 @@
+<!--
+Licensed to the Apache Software Foundation (ASF) under one or more
+contributor license agreements. See the NOTICE file distributed with
+this work for additional information regarding copyright ownership.
+The ASF licenses this file to You 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.
+See the License for the specific language governing permissions and
+limitations under the License.
+-->
+<HTML>
+<!--
+ comments
+ -->
+<HEaD>
+ <base href="http://localhost">
+ <link href="/css/which.css" type="text/css" rel="stylesheet">
+ <title>Administration Centre</title>
+<SCRIPT LANGUAGE="javascript">
+function CTF_launchPreview(URL)
+{
+ day = new Date();
+ id = day.getTime();
+ eval("page" + id + " = window.open(URL, '" + id+"','scrollbars=yes,width=500,height=500,resizable=yes');");
+}
+<!--
+function test(URL)
+{
+ day = new Date();
+}
+-->
+</SCRIPT>
+</heAd>
+<body>
+<p>This is a test</p>
+<a name='1' href="http://www.bluesunrise.com">keep this</a>
+<a name='2' href="/stuff/junk/stuffedjunk.html">junk</a>
+<a name='3' href="stuff/junk/stuffedjunk.html">junk2</a>
+<a name='4' href="javascript:whatever()">script</a>
+<a name='5' href="mailto:david@bluesunrise.com">script</a>
+<a name='6' href="#INTERNAL">internal</a>
+</body>
+</HTML>
\ No newline at end of file
Propchange: portals/applications/webcontent/trunk/webcontent-jar/src/test/rewriter/test-001.html
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: portals/applications/webcontent/trunk/webcontent-jar/src/test/rewriter/test-001.html
------------------------------------------------------------------------------
svn:keywords = Id
Added: portals/applications/webcontent/trunk/webcontent-jar/src/test/rewriter/test-remove-rules.xml
URL: http://svn.apache.org/viewvc/portals/applications/webcontent/trunk/webcontent-jar/src/test/rewriter/test-remove-rules.xml?rev=764612&view=auto
==============================================================================
--- portals/applications/webcontent/trunk/webcontent-jar/src/test/rewriter/test-remove-rules.xml (added)
+++ portals/applications/webcontent/trunk/webcontent-jar/src/test/rewriter/test-remove-rules.xml Mon Apr 13 21:17:59 2009
@@ -0,0 +1,27 @@
+<?xml version='1.0' ?>
+<!--
+Licensed to the Apache Software Foundation (ASF) under one or more
+contributor license agreements. See the NOTICE file distributed with
+this work for additional information regarding copyright ownership.
+The ASF licenses this file to You 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.
+See the License for the specific language governing permissions and
+limitations under the License.
+-->
+<ruleset id='test-set-102' remove-comments='true'>
+<rule id='base' popup='true' use-base='true' suffix='/suffix' ignore-prefixes='javascript:,mailto:,#'/>
+<tag id='HTML' remove='true'/>
+<tag id='body' remove='true'/>
+<tag id='head' strip='true'/>
+<tag id='a'>
+ <attribute id='href' rule='base'/>
+</tag>
+</ruleset>
+
Propchange: portals/applications/webcontent/trunk/webcontent-jar/src/test/rewriter/test-remove-rules.xml
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: portals/applications/webcontent/trunk/webcontent-jar/src/test/rewriter/test-remove-rules.xml
------------------------------------------------------------------------------
svn:keywords = Id
Added: portals/applications/webcontent/trunk/webcontent-jar/src/test/rewriter/test-rewriter-rules.xml
URL: http://svn.apache.org/viewvc/portals/applications/webcontent/trunk/webcontent-jar/src/test/rewriter/test-rewriter-rules.xml?rev=764612&view=auto
==============================================================================
--- portals/applications/webcontent/trunk/webcontent-jar/src/test/rewriter/test-rewriter-rules.xml (added)
+++ portals/applications/webcontent/trunk/webcontent-jar/src/test/rewriter/test-rewriter-rules.xml Mon Apr 13 21:17:59 2009
@@ -0,0 +1,31 @@
+<?xml version='1.0' ?>
+<!--
+Licensed to the Apache Software Foundation (ASF) under one or more
+contributor license agreements. See the NOTICE file distributed with
+this work for additional information regarding copyright ownership.
+The ASF licenses this file to You 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.
+See the License for the specific language governing permissions and
+limitations under the License.
+-->
+<ruleset id='test-set-101'>
+<rule id='merge' use-base='true' suffix='/web' popup='0' ignore-prefixes='javascript:,mailto:,#'/>
+<tag id='form'>
+ <attribute id='action' rule='merge'/>
+</tag>
+<tag id='input'>
+ <attribute id='source' rule='test'/>
+</tag>
+<tag id='link'>
+ <attribute id='href' rule='merge'/>
+</tag>
+<tag id='head' remove='true'/>
+<rule id='test' use-base='false' suffix='/whatever&xxx=1' popup='1'/>
+</ruleset>
Propchange: portals/applications/webcontent/trunk/webcontent-jar/src/test/rewriter/test-rewriter-rules.xml
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: portals/applications/webcontent/trunk/webcontent-jar/src/test/rewriter/test-rewriter-rules.xml
------------------------------------------------------------------------------
svn:keywords = Id
Added: portals/applications/webcontent/trunk/webcontent-jar/src/test/webapp/WEB-INF/conf/rewriter-rules-mapping.xml
URL: http://svn.apache.org/viewvc/portals/applications/webcontent/trunk/webcontent-jar/src/test/webapp/WEB-INF/conf/rewriter-rules-mapping.xml?rev=764612&view=auto
==============================================================================
--- portals/applications/webcontent/trunk/webcontent-jar/src/test/webapp/WEB-INF/conf/rewriter-rules-mapping.xml (added)
+++ portals/applications/webcontent/trunk/webcontent-jar/src/test/webapp/WEB-INF/conf/rewriter-rules-mapping.xml Mon Apr 13 21:17:59 2009
@@ -0,0 +1,105 @@
+<?xml version="1.0"?>
+<!--
+Licensed to the Apache Software Foundation (ASF) under one or more
+contributor license agreements. See the NOTICE file distributed with
+this work for additional information regarding copyright ownership.
+The ASF licenses this file to You 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.
+See the License for the specific language governing permissions and
+limitations under the License.
+-->
+<mapping>
+ <class name="org.apache.portals.applications.webcontent.rewriter.rules.impl.RulesetImpl">
+ <map-to xml="ruleset"/>
+
+ <field name="id" type="java.lang.String">
+ <bind-xml name="id" node="attribute"/>
+ </field>
+
+ <field name="removeComments" type="boolean">
+ <bind-xml name="remove-comments" node="attribute"/>
+ </field>
+
+ <field name="tags"
+ type="org.apache.portals.applications.webcontent.rewriter.rules.impl.TagImpl"
+ collection="collection">
+ <bind-xml name="tag"/>
+ </field>
+
+ <field name="rules"
+ type="org.apache.portals.applications.webcontent.rewriter.rules.impl.RuleImpl"
+ collection="collection">
+ <bind-xml name="rule"/>
+ </field>
+
+ </class>
+
+ <class name="org.apache.portals.applications.webcontent.rewriter.rules.impl.TagImpl">
+ <map-to xml="tag"/>
+
+ <field name="id" type="java.lang.String">
+ <bind-xml name="id" node="attribute"/>
+ </field>
+
+ <field name="strip" type="boolean">
+ <bind-xml name="strip" node="attribute"/>
+ </field>
+
+ <field name="remove" type="boolean">
+ <bind-xml name="remove" node="attribute"/>
+ </field>
+
+ <field name="attributes"
+ type="org.apache.portals.applications.webcontent.rewriter.rules.impl.AttributeImpl"
+ collection="collection">
+ <bind-xml name="attribute"/>
+ </field>
+
+ </class>
+
+ <class name="org.apache.portals.applications.webcontent.rewriter.rules.impl.RuleImpl">
+ <map-to xml="rule"/>
+
+ <field name="id" type="java.lang.String">
+ <bind-xml name="id" node="attribute"/>
+ </field>
+
+ <field name="suffix" type="java.lang.String">
+ <bind-xml name="suffix" node="attribute"/>
+ </field>
+
+ <field name="ignorePrefixes" type="java.lang.String">
+ <bind-xml name="ignore-prefixes" node="attribute"/>
+ </field>
+
+ <field name="useBase" type="boolean">
+ <bind-xml name="use-base" node="attribute"/>
+ </field>
+
+ <field name="popup" type="boolean">
+ <bind-xml name="popup" node="attribute"/>
+ </field>
+
+ </class>
+
+ <class name="org.apache.portals.applications.webcontent.rewriter.rules.impl.AttributeImpl">
+ <map-to xml="attribute"/>
+
+ <field name="id" type="java.lang.String">
+ <bind-xml name="id" node="attribute"/>
+ </field>
+
+ <field name="ruleId" type="java.lang.String">
+ <bind-xml name="rule" node="attribute"/>
+ </field>
+
+ </class>
+
+</mapping>
\ No newline at end of file
Propchange: portals/applications/webcontent/trunk/webcontent-jar/src/test/webapp/WEB-INF/conf/rewriter-rules-mapping.xml
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: portals/applications/webcontent/trunk/webcontent-jar/src/test/webapp/WEB-INF/conf/rewriter-rules-mapping.xml
------------------------------------------------------------------------------
svn:keywords = Id
Added: portals/applications/webcontent/trunk/webcontent-war/pom.xml
URL: http://svn.apache.org/viewvc/portals/applications/webcontent/trunk/webcontent-war/pom.xml?rev=764612&view=auto
==============================================================================
--- portals/applications/webcontent/trunk/webcontent-war/pom.xml (added)
+++ portals/applications/webcontent/trunk/webcontent-war/pom.xml Mon Apr 13 21:17:59 2009
@@ -0,0 +1,92 @@
+<?xml version="1.0" encoding="UTF-8"?>
+ <!--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You 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. See the License for
+ the specific language governing permissions and limitations under the
+ License. $Id$
+ -->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+
+ <modelVersion>4.0.0</modelVersion>
+ <prerequisites>
+ <maven>2.0.4</maven>
+ </prerequisites>
+
+ <!-- POM Identification -->
+ <artifactId>apa-webcontent-war</artifactId>
+ <parent>
+ <groupId>org.apache.portals.applications</groupId>
+ <artifactId>apa-webcontent</artifactId>
+ <version>1.0-SNAPSHOT</version>
+ </parent>
+ <packaging>war</packaging>
+ <name>Portals Web Content Application WAR</name>
+
+ <!-- Dependencies -->
+ <properties>
+ <velocity-tools.version>1.3</velocity-tools.version>
+ <commons-digester.version>1.8</commons-digester.version>
+ <commons-lang.version>2.1</commons-lang.version>
+ <commons-collections.version>3.2</commons-collections.version>
+ <log4j.version>1.2.14</log4j.version>
+ <oro.version>2.0.8</oro.version>
+ </properties>
+ <dependencies>
+
+ <!-- Runtime Dependencies -->
+
+ <dependency>
+ <groupId>${pom.groupId}</groupId>
+ <artifactId>apa-webcontent-jar</artifactId>
+ <version>${pom.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>log4j</groupId>
+ <artifactId>log4j</artifactId>
+ <version>${log4j.version}</version>
+ <scope>runtime</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.portals.applications</groupId>
+ <artifactId>apa-webapp-logging</artifactId>
+ <version>1.0-SNAPSHOT</version>
+ </dependency>
+ <dependency>
+ <groupId>xml-apis</groupId>
+ <artifactId>xml-apis</artifactId>
+ <version>${xml-apis.version}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>commons-logging</groupId>
+ <artifactId>commons-logging</artifactId>
+ <version>[1.1,)</version>
+ <exclusions>
+ <exclusion>
+ <groupId>logkit</groupId>
+ <artifactId>logkit</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>avalon-framework</groupId>
+ <artifactId>avalon-framework</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>javax.servlet</groupId>
+ <artifactId>servlet-api</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+
+ </dependencies>
+
+</project>
Propchange: portals/applications/webcontent/trunk/webcontent-war/pom.xml
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: portals/applications/webcontent/trunk/webcontent-war/pom.xml
------------------------------------------------------------------------------
svn:keywords = Id
Added: portals/applications/webcontent/trunk/webcontent-war/src/main/webapp/WEB-INF/log4j.properties
URL: http://svn.apache.org/viewvc/portals/applications/webcontent/trunk/webcontent-war/src/main/webapp/WEB-INF/log4j.properties?rev=764612&view=auto
==============================================================================
--- portals/applications/webcontent/trunk/webcontent-war/src/main/webapp/WEB-INF/log4j.properties (added)
+++ portals/applications/webcontent/trunk/webcontent-war/src/main/webapp/WEB-INF/log4j.properties Mon Apr 13 21:17:59 2009
@@ -0,0 +1,60 @@
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements. See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You 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.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+# ------------------------------------------------------------------------
+#
+# Logging Configuration
+#
+# $Id$
+#
+# ------------------------------------------------------------------------
+
+#
+# If we don't know the logging facility, put it into the pa.log
+#
+#
+log4j.rootLogger = ERROR, pa
+
+log4j.category.org.apache.portals = ERROR, pa
+log4j.additivity.org.apache.portals = false
+
+#
+# Velocity
+#
+log4j.category.velocity = ERROR, velocity
+log4j.additivity.velocity = false
+
+########################################################################
+#
+# Logfile definitions
+#
+########################################################################
+
+#
+# pa.log
+#
+log4j.appender.pa = org.apache.log4j.FileAppender
+log4j.appender.pa.file = ${webApplicationRoot}/logs/pa.log
+log4j.appender.pa.layout = org.apache.log4j.PatternLayout
+log4j.appender.pa.layout.conversionPattern = %d [%t] %-5p %c - %m%n
+log4j.appender.pa.append = false
+
+#
+# velocity.log
+#
+log4j.appender.velocity = org.apache.log4j.FileAppender
+log4j.appender.velocity.file = ${webApplicationRoot}/logs/velocity.log
+log4j.appender.velocity.layout = org.apache.log4j.PatternLayout
+log4j.appender.velocity.layout.conversionPattern = %d [%t] %-5p %c - %m%n
+log4j.appender.velocity.append = false
Propchange: portals/applications/webcontent/trunk/webcontent-war/src/main/webapp/WEB-INF/log4j.properties
------------------------------------------------------------------------------
svn:keywords = Id
Added: portals/applications/webcontent/trunk/webcontent-war/src/main/webapp/WEB-INF/portlet.xml
URL: http://svn.apache.org/viewvc/portals/applications/webcontent/trunk/webcontent-war/src/main/webapp/WEB-INF/portlet.xml?rev=764612&view=auto
==============================================================================
--- portals/applications/webcontent/trunk/webcontent-war/src/main/webapp/WEB-INF/portlet.xml (added)
+++ portals/applications/webcontent/trunk/webcontent-war/src/main/webapp/WEB-INF/portlet.xml Mon Apr 13 21:17:59 2009
@@ -0,0 +1,120 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+Licensed to the Apache Software Foundation (ASF) under one or more
+contributor license agreements. See the NOTICE file distributed with
+this work for additional information regarding copyright ownership.
+The ASF licenses this file to You 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.
+See the License for the specific language governing permissions and
+limitations under the License.
+-->
+<portlet-app id="webcontent"
+ xmlns="http://java.sun.com/xml/ns/portlet/portlet-app_1_0.xsd" version="1.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://java.sun.com/xml/ns/portlet/portlet-app_1_0.xsd http://java.sun.com/xml/ns/portlet/portlet-app_1_0.xsd">
+
+ <portlet id="tmtt-main">
+ <description>Places an HTML IFrame inside a portlet for easily hosting other web application within a portlet. Sizes of both normal and maximized modes are configurable in edit mode.</description>
+ <portlet-name>IFramePortlet</portlet-name>
+ <display-name>IFrame Portlet</display-name>
+ <portlet-class>org.apache.jetspeed.portlet.IFrameGenericPortlet</portlet-class>
+ <init-param>
+ <name>EditPage</name>
+ <value>/WEB-INF/view/edit-prefs.vm</value>
+ </init-param>
+ <init-param>
+ <name>HelpPage</name>
+ <value>/WEB-INF/view/iframe-help.html</value>
+ </init-param>
+ <init-param>
+ <name>portlet-icon</name>
+ <value>applications-internet.png</value>
+ </init-param>
+ <expiration-cache>300</expiration-cache>
+ <supports>
+ <mime-type>text/html</mime-type>
+ <portlet-mode>EDIT</portlet-mode>
+ <portlet-mode>VIEW</portlet-mode>
+ <portlet-mode>HELP</portlet-mode>
+ </supports>
+ <supported-locale>en</supported-locale>
+ <portlet-info>
+ <title>IFrame</title>
+ <short-title>IFrame</short-title>
+ <keywords>tool,iframe,web,frame,content,host</keywords>
+ </portlet-info>
+ <portlet-preferences>
+ <preference>
+ <name>SRC</name>
+ <value>http://portals.apache.org</value>
+ </preference>
+ <!-- Don't specify a HEIGHT if you want a normal filled out layout
+ because percentage values result in the content not to be displayed on IE6.
+ Specific values are ok though.
+ -->
+ <preference>
+ <name>HEIGHT</name>
+ <value>300</value>
+ </preference>
+ <preference>
+ <name>WIDTH</name>
+ <value>100%</value>
+ </preference>
+ <preference>
+ <name>MAX-HEIGHT</name>
+ <value>800</value>
+ </preference>
+ <preference>
+ <name>MAX-WIDTH</name>
+ <value>100%</value>
+ </preference>
+ <preference>
+ <name>SCROLLING</name>
+ <value>AUTO</value>
+ </preference>
+ </portlet-preferences>
+ </portlet>
+
+ <portlet id="web-cont-demo">
+ <description>Includes the content of another website inside the portal without using frames. All links are rewritten back to the portal to attempt to proxy all content through the portal.</description>
+ <portlet-name>WebContentPortlet</portlet-name>
+ <display-name>WebContent Portlet</display-name>
+ <portlet-class>org.apache.jetspeed.portlet.WebContentPortlet</portlet-class>
+ <init-param>
+ <name>EditPage</name>
+ <value>/WEB-INF/view/edit-wcprefs.vm</value>
+ </init-param>
+ <init-param>
+ <name>portlet-icon</name>
+ <value>preferences-system-network-proxy.png</value>
+ </init-param>
+ <expiration-cache>-1</expiration-cache>
+ <supports>
+ <mime-type>text/html</mime-type>
+ <portlet-mode>EDIT</portlet-mode>
+ <portlet-mode>VIEW</portlet-mode>
+ </supports>
+ <supported-locale>en</supported-locale>
+ <portlet-info>
+ <title>WebContent Prototype</title>
+ <short-title>WebContent</short-title>
+ <keywords>web,content,webnav,bridge,proxy,rewrite</keywords>
+ </portlet-info>
+ <portlet-preferences>
+ <preference>
+ <name>SRC</name>
+ <value>http://www.google.com</value>
+ </preference>
+ </portlet-preferences>
+ </portlet>
+
+
+</portlet-app>
+
Propchange: portals/applications/webcontent/trunk/webcontent-war/src/main/webapp/WEB-INF/portlet.xml
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: portals/applications/webcontent/trunk/webcontent-war/src/main/webapp/WEB-INF/portlet.xml
------------------------------------------------------------------------------
svn:keywords = Id
Added: portals/applications/webcontent/trunk/webcontent-war/src/main/webapp/WEB-INF/velocity/toolbox.xml
URL: http://svn.apache.org/viewvc/portals/applications/webcontent/trunk/webcontent-war/src/main/webapp/WEB-INF/velocity/toolbox.xml?rev=764612&view=auto
==============================================================================
--- portals/applications/webcontent/trunk/webcontent-war/src/main/webapp/WEB-INF/velocity/toolbox.xml (added)
+++ portals/applications/webcontent/trunk/webcontent-war/src/main/webapp/WEB-INF/velocity/toolbox.xml Mon Apr 13 21:17:59 2009
@@ -0,0 +1,19 @@
+<?xml version="1.0"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You 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.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<toolbox>
+</toolbox>
\ No newline at end of file
Propchange: portals/applications/webcontent/trunk/webcontent-war/src/main/webapp/WEB-INF/velocity/toolbox.xml
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: portals/applications/webcontent/trunk/webcontent-war/src/main/webapp/WEB-INF/velocity/toolbox.xml
------------------------------------------------------------------------------
svn:keywords = Id
Added: portals/applications/webcontent/trunk/webcontent-war/src/main/webapp/WEB-INF/velocity/velocity-macros.vm
URL: http://svn.apache.org/viewvc/portals/applications/webcontent/trunk/webcontent-war/src/main/webapp/WEB-INF/velocity/velocity-macros.vm?rev=764612&view=auto
==============================================================================
--- portals/applications/webcontent/trunk/webcontent-war/src/main/webapp/WEB-INF/velocity/velocity-macros.vm (added)
+++ portals/applications/webcontent/trunk/webcontent-war/src/main/webapp/WEB-INF/velocity/velocity-macros.vm Mon Apr 13 21:17:59 2009
@@ -0,0 +1,16 @@
+#*
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You 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.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+*#
Propchange: portals/applications/webcontent/trunk/webcontent-war/src/main/webapp/WEB-INF/velocity/velocity-macros.vm
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: portals/applications/webcontent/trunk/webcontent-war/src/main/webapp/WEB-INF/velocity/velocity-macros.vm
------------------------------------------------------------------------------
svn:keywords = Id
Added: portals/applications/webcontent/trunk/webcontent-war/src/main/webapp/WEB-INF/velocity/velocity.properties
URL: http://svn.apache.org/viewvc/portals/applications/webcontent/trunk/webcontent-war/src/main/webapp/WEB-INF/velocity/velocity.properties?rev=764612&view=auto
==============================================================================
--- portals/applications/webcontent/trunk/webcontent-war/src/main/webapp/WEB-INF/velocity/velocity.properties (added)
+++ portals/applications/webcontent/trunk/webcontent-war/src/main/webapp/WEB-INF/velocity/velocity.properties Mon Apr 13 21:17:59 2009
@@ -0,0 +1,115 @@
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements. See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You 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.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+#----------------------------------------------------------------------------
+# These are the default properties for the
+# Velocity Runtime. These values are used when
+# Runtime.init() is called, and when Runtime.init(properties)
+# fails to find the specificed properties file.
+#----------------------------------------------------------------------------
+
+#----------------------------------------------------------------------------
+# R U N T I M E L O G
+#----------------------------------------------------------------------------
+# This is the location of the Velocity Runtime log.
+#----------------------------------------------------------------------------
+
+runtime.log = velocity.log
+
+# use Commons Logging for routing Velocity message through our IsolatedLog4JLogger
+runtime.log.logsystem.class =org.apache.portals.applications.webapp.logging.velocity.CommonsLoggingLog4JLogSystem
+# Log4J Category used (default is "velocity")
+runtime.log.logsystem.log4j.category = velocity
+
+#----------------------------------------------------------------------------
+# T E M P L A T E E N C O D I N G
+#----------------------------------------------------------------------------
+
+template.encoding=8859_1
+
+#----------------------------------------------------------------------------
+# C O N T E N T T Y P E
+#----------------------------------------------------------------------------
+# This is the default content type for the VelocityServlet.
+#----------------------------------------------------------------------------
+
+default.contentType=text/html
+
+#----------------------------------------------------------------------------
+# F O R E A C H P R O P E R T I E S
+#----------------------------------------------------------------------------
+# These properties control how the counter is accessed in the #foreach
+# directive. By default the reference $velocityCount will be available
+# in the body of the #foreach directive. The default starting value
+# for this reference is 1.
+#----------------------------------------------------------------------------
+
+counter.name = velocityCount
+counter.initial.value = 1
+
+#----------------------------------------------------------------------------
+# I N C L U D E P R O P E R T I E S
+#----------------------------------------------------------------------------
+# These are the properties that governed the way #include'd content
+# is governed.
+#----------------------------------------------------------------------------
+
+include.path=.
+include.cache = false
+include.output.errormsg.start = <!-- include error :
+include.output.errormsg.end = see error log -->
+
+#----------------------------------------------------------------------------
+# P A R S E P R O P E R T I E S
+#----------------------------------------------------------------------------
+
+parse_directive.maxdepth = 10
+
+#----------------------------------------------------------------------------
+# T E M P L A T E L O A D E R S
+#----------------------------------------------------------------------------
+#
+#
+#----------------------------------------------------------------------------
+
+template.loader.1.public.name = File
+template.loader.1.description = Velocity File Template Loader
+template.loader.1.class = org.apache.velocity.runtime.loader.FileTemplateLoader
+template.loader.1.template.path = .
+template.loader.1.cache = false
+template.loader.1.modificationCheckInterval = 2
+
+velocimacro.library.autoreload = true
+velocimacro.permissions.allow.inline.to.replace.global = true
+velocimacro.library = /WEB-INF/velocity/velocity-macros.vm
+
+#template.loader.2.public.name = URL
+#template.loader.2.description = Velocity URL Template Loader
+#template.loader.2.class = org.apache.velocity.runtime.loader.URLTemplateLoader
+#template.loader.2.template.path = http://localhost/templates/
+#template.loader.2.cache = false
+
+#----------------------------------------------------------------------------
+# E X T E R N A L S E R V I C E I N I T I A L I Z A T I O N
+#----------------------------------------------------------------------------
+# If this property is set to true then an external service will
+# set certain system properties and initialize the Velocity
+# Runtime. This method is used by Turbine to initialize the
+# Velocity Runtime for the TurbineVelocityService.
+#----------------------------------------------------------------------------
+
+external.init = false
+
+
Propchange: portals/applications/webcontent/trunk/webcontent-war/src/main/webapp/WEB-INF/velocity/velocity.properties
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: portals/applications/webcontent/trunk/webcontent-war/src/main/webapp/WEB-INF/velocity/velocity.properties
------------------------------------------------------------------------------
svn:keywords = Id
Added: portals/applications/webcontent/trunk/webcontent-war/src/main/webapp/WEB-INF/web.xml
URL: http://svn.apache.org/viewvc/portals/applications/webcontent/trunk/webcontent-war/src/main/webapp/WEB-INF/web.xml?rev=764612&view=auto
==============================================================================
--- portals/applications/webcontent/trunk/webcontent-war/src/main/webapp/WEB-INF/web.xml (added)
+++ portals/applications/webcontent/trunk/webcontent-war/src/main/webapp/WEB-INF/web.xml Mon Apr 13 21:17:59 2009
@@ -0,0 +1,72 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+Licensed to the Apache Software Foundation (ASF) under one or more
+contributor license agreements. See the NOTICE file distributed with
+this work for additional information regarding copyright ownership.
+The ASF licenses this file to You 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.
+See the License for the specific language governing permissions and
+limitations under the License.
+-->
+<!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
+ "http://java.sun.com/dtd/web-app_2_3.dtd">
+<web-app>
+ <display-name>Webcontent Portlet Application</display-name>
+ <description>Apache Portals Applications: Webcontent PA</description>
+
+ <listener>
+ <listener-class>org.apache.jetspeed.webapp.logging.Log4JConfigurator</listener-class>
+ </listener>
+
+ <servlet>
+ <servlet-name>JetspeedContainer</servlet-name>
+ <display-name>Jetspeed Container</display-name>
+ <description>MVC Servlet for Jetspeed Portlet Applications</description>
+ <servlet-class>org.apache.jetspeed.container.JetspeedContainerServlet</servlet-class>
+ <init-param>
+ <param-name>contextName</param-name>
+ <param-value>webcontent</param-value>
+ </init-param>
+ <load-on-startup>100</load-on-startup>
+ </servlet>
+
+ <!-- Define Velocity Servlet -->
+ <servlet>
+ <servlet-name>velocity</servlet-name>
+ <servlet-class>org.apache.portals.bridges.velocity.BridgesVelocityViewServlet</servlet-class>
+ <init-param>
+ <param-name>org.apache.velocity.toolbox</param-name>
+ <param-value>/WEB-INF/velocity/toolbox.xml</param-value>
+ </init-param>
+ <init-param>
+ <param-name>org.apache.velocity.properties</param-name>
+ <param-value>/WEB-INF/velocity/velocity.properties</param-value>
+ </init-param>
+ <load-on-startup>10</load-on-startup>
+ </servlet>
+
+
+ <!-- Map *.vm files to Velocity -->
+ <servlet-mapping>
+ <servlet-name>velocity</servlet-name>
+ <url-pattern>*.vm</url-pattern>
+ </servlet-mapping>
+
+ <servlet-mapping>
+ <servlet-name>
+ JetspeedContainer
+ </servlet-name>
+ <url-pattern>
+ /container/*
+ </url-pattern>
+ </servlet-mapping>
+
+
+</web-app>