Author: jvazquez
Date: Sun Feb 22 20:48:08 2009
New Revision: 746815
URL: http://svn.apache.org/viewvc?rev=746815&view=rev
Log: (empty)
Added:
incubator/sling/whiteboard/jvazquez/org.apache.sling.scripting.xproc/src/main/java/org/apache/sling/cocoon/generator/
incubator/sling/whiteboard/jvazquez/org.apache.sling.scripting.xproc/src/main/java/org/apache/sling/cocoon/generator/SlingGenerator.java
(contents, props changed)
- copied, changed from r746535,
incubator/sling/whiteboard/jvazquez/org.apache.sling.scripting.xproc/src/main/java/org/apache/sling/cocoon/SlingGenerator.java
incubator/sling/whiteboard/jvazquez/org.apache.sling.scripting.xproc/src/main/java/org/apache/sling/cocoon/generator/SlingGeneratorServletOutputStream.java
incubator/sling/whiteboard/jvazquez/org.apache.sling.scripting.xproc/src/main/java/org/apache/sling/cocoon/generator/SlingGeneratorServletResponse.java
incubator/sling/whiteboard/jvazquez/org.apache.sling.scripting.xproc/src/main/resources/SLING-INF/content/apps/sling/xpl/html.xpl
incubator/sling/whiteboard/jvazquez/org.apache.sling.scripting.xproc/src/main/resources/SLING-INF/content/apps/sling/xpl/sample/sample.esp
Removed:
incubator/sling/whiteboard/jvazquez/org.apache.sling.scripting.xproc/src/main/java/org/apache/sling/cocoon/SlingGenerator.java
incubator/sling/whiteboard/jvazquez/org.apache.sling.scripting.xproc/src/main/resources/SLING-INF/content/apps/sling/xpl/sample/data/
incubator/sling/whiteboard/jvazquez/org.apache.sling.scripting.xproc/src/main/resources/SLING-INF/content/apps/sling/xpl/sample/sample.xpl
incubator/sling/whiteboard/jvazquez/org.apache.sling.scripting.xproc/src/main/resources/SLING-INF/content/xpl-sample/test.xml
Modified:
incubator/sling/whiteboard/jvazquez/org.apache.sling.scripting.xproc/pom.xml
incubator/sling/whiteboard/jvazquez/org.apache.sling.scripting.xproc/src/main/java/org/apache/sling/scripting/xproc/XProcScriptEngine.java
incubator/sling/whiteboard/jvazquez/org.apache.sling.scripting.xproc/src/main/resources/SLING-INF/content/xpl-sample/pipelines.json
Modified:
incubator/sling/whiteboard/jvazquez/org.apache.sling.scripting.xproc/pom.xml
URL:
http://svn.apache.org/viewvc/incubator/sling/whiteboard/jvazquez/org.apache.sling.scripting.xproc/pom.xml?rev=746815&r1=746814&r2=746815&view=diff
==============================================================================
---
incubator/sling/whiteboard/jvazquez/org.apache.sling.scripting.xproc/pom.xml
(original)
+++
incubator/sling/whiteboard/jvazquez/org.apache.sling.scripting.xproc/pom.xml
Sun Feb 22 20:48:08 2009
@@ -51,6 +51,7 @@
<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
+ <version>1.4.3</version>
<extensions>true</extensions>
<configuration>
<instructions>
Copied:
incubator/sling/whiteboard/jvazquez/org.apache.sling.scripting.xproc/src/main/java/org/apache/sling/cocoon/generator/SlingGenerator.java
(from r746535,
incubator/sling/whiteboard/jvazquez/org.apache.sling.scripting.xproc/src/main/java/org/apache/sling/cocoon/SlingGenerator.java)
URL:
http://svn.apache.org/viewvc/incubator/sling/whiteboard/jvazquez/org.apache.sling.scripting.xproc/src/main/java/org/apache/sling/cocoon/generator/SlingGenerator.java?p2=incubator/sling/whiteboard/jvazquez/org.apache.sling.scripting.xproc/src/main/java/org/apache/sling/cocoon/generator/SlingGenerator.java&p1=incubator/sling/whiteboard/jvazquez/org.apache.sling.scripting.xproc/src/main/java/org/apache/sling/cocoon/SlingGenerator.java&r1=746535&r2=746815&rev=746815&view=diff
==============================================================================
---
incubator/sling/whiteboard/jvazquez/org.apache.sling.scripting.xproc/src/main/java/org/apache/sling/cocoon/SlingGenerator.java
(original)
+++
incubator/sling/whiteboard/jvazquez/org.apache.sling.scripting.xproc/src/main/java/org/apache/sling/cocoon/generator/SlingGenerator.java
Sun Feb 22 20:48:08 2009
@@ -16,24 +16,13 @@
* specific language governing permissions and limitations
* under the License.
*/
-package org.apache.sling.cocoon;
+package org.apache.sling.cocoon.generator;
import java.io.ByteArrayInputStream;
-import java.io.ByteArrayOutputStream;
-import java.io.IOException;
import java.io.InputStream;
-import java.io.OutputStreamWriter;
-import java.io.PrintWriter;
-import java.io.UnsupportedEncodingException;
-import java.util.Map;
import javax.servlet.RequestDispatcher;
-import javax.servlet.ServletOutputStream;
import javax.servlet.ServletResponse;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletRequestWrapper;
-import javax.servlet.http.HttpServletResponse;
-import javax.servlet.http.HttpServletResponseWrapper;
import org.apache.cocoon.pipeline.component.sax.AbstractGenerator;
import org.apache.cocoon.pipeline.util.XMLUtils;
@@ -41,8 +30,6 @@
import org.apache.sling.api.SlingHttpServletResponse;
import org.apache.sling.api.request.RequestDispatcherOptions;
import org.apache.sling.api.resource.Resource;
-import org.apache.sling.api.resource.SyntheticResource;
-import org.apache.sling.api.wrappers.SlingHttpServletResponseWrapper;
public class SlingGenerator extends AbstractGenerator {
@@ -56,16 +43,17 @@
public void execute() {
try {
- XMLUtils.toSax(genXml(), this.getXMLConsumer());
+ XMLUtils.toSax(genXmlSource(), this.getXMLConsumer());
} catch (Exception e) {
e.printStackTrace();
}
}
- @SuppressWarnings("unchecked")
- private InputStream genXml() throws Exception {
+ private InputStream genXmlSource() throws Exception {
+ System.out.println("pasa por gen xml source");
+ Resource resource = request.getResource();
RequestDispatcherOptions options = new
RequestDispatcherOptions();
- options.setForceResourceType("sling/xpl/sample/data");
+ options.setForceResourceType(resource.getResourceType());
RequestDispatcher dispatcher =
request.getRequestDispatcher(request.getResource(), options);
SlingGeneratorServletOutputStream output = new
SlingGeneratorServletOutputStream();
ServletResponse newResponse = new
SlingGeneratorServletResponse(response, output);
@@ -73,71 +61,5 @@
byte[] bytes = output.toByteArray();
return new ByteArrayInputStream(bytes);
}
-
- protected class SlingGeneratorServletResponse
- extends
SlingHttpServletResponseWrapper implements SlingHttpServletResponse {
-
- private SlingGeneratorServletOutputStream output;
-
- private boolean hasWriter = false;
- private boolean hasOutputStream = false;
-
- public SlingGeneratorServletResponse(SlingHttpServletResponse
wrappedResponse,
-
SlingGeneratorServletOutputStream output) {
- super(wrappedResponse);
- this.output = output;
- }
-
- @Override
- public PrintWriter getWriter() throws IOException {
- if (this.hasOutputStream) {
- throw new
IllegalStateException("getOutputStream was already called.");
- }
- this.hasWriter = true;
- return this.output.getWriter();
- }
-
- @Override
- public ServletOutputStream getOutputStream() throws IOException
{
- if (this.hasWriter) {
- throw new IllegalStateException("getWriter was
already called.");
- }
- this.hasOutputStream = true;
- return this.output;
- }
-
- @Override
- public int getBufferSize() {
- return 1024;
- }
-
- }
-
- protected class SlingGeneratorServletOutputStream extends
ServletOutputStream {
-
- private final ByteArrayOutputStream output;
- private final PrintWriter writer;
-
- public SlingGeneratorServletOutputStream() throws
UnsupportedEncodingException {
- this.output = new ByteArrayOutputStream();
- this.writer = new PrintWriter(new
OutputStreamWriter(output, "UTF-8"));
- }
-
- final PrintWriter getWriter() {
- return this.writer;
- }
-
- @Override
- public void write(int b) throws IOException {
- this.output.write(b);
- }
-
- final byte[] toByteArray() {
- this.writer.flush();
- byte[] bytes = output.toByteArray();
- return bytes;
- }
-
- }
}
Propchange:
incubator/sling/whiteboard/jvazquez/org.apache.sling.scripting.xproc/src/main/java/org/apache/sling/cocoon/generator/SlingGenerator.java
------------------------------------------------------------------------------
svn:mergeinfo =
Added:
incubator/sling/whiteboard/jvazquez/org.apache.sling.scripting.xproc/src/main/java/org/apache/sling/cocoon/generator/SlingGeneratorServletOutputStream.java
URL:
http://svn.apache.org/viewvc/incubator/sling/whiteboard/jvazquez/org.apache.sling.scripting.xproc/src/main/java/org/apache/sling/cocoon/generator/SlingGeneratorServletOutputStream.java?rev=746815&view=auto
==============================================================================
---
incubator/sling/whiteboard/jvazquez/org.apache.sling.scripting.xproc/src/main/java/org/apache/sling/cocoon/generator/SlingGeneratorServletOutputStream.java
(added)
+++
incubator/sling/whiteboard/jvazquez/org.apache.sling.scripting.xproc/src/main/java/org/apache/sling/cocoon/generator/SlingGeneratorServletOutputStream.java
Sun Feb 22 20:48:08 2009
@@ -0,0 +1,36 @@
+package org.apache.sling.cocoon.generator;
+
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.io.OutputStreamWriter;
+import java.io.PrintWriter;
+import java.io.UnsupportedEncodingException;
+
+import javax.servlet.ServletOutputStream;
+
+public class SlingGeneratorServletOutputStream extends ServletOutputStream {
+
+ private final ByteArrayOutputStream output;
+ private final PrintWriter writer;
+
+ public SlingGeneratorServletOutputStream() throws
UnsupportedEncodingException {
+ this.output = new ByteArrayOutputStream();
+ this.writer = new PrintWriter(new OutputStreamWriter(output,
"UTF-8"));
+ }
+
+ final PrintWriter getWriter() {
+ return this.writer;
+ }
+
+ @Override
+ public void write(int b) throws IOException {
+ this.output.write(b);
+ }
+
+ final byte[] toByteArray() {
+ this.writer.flush();
+ byte[] bytes = output.toByteArray();
+ return bytes;
+ }
+
+}
\ No newline at end of file
Added:
incubator/sling/whiteboard/jvazquez/org.apache.sling.scripting.xproc/src/main/java/org/apache/sling/cocoon/generator/SlingGeneratorServletResponse.java
URL:
http://svn.apache.org/viewvc/incubator/sling/whiteboard/jvazquez/org.apache.sling.scripting.xproc/src/main/java/org/apache/sling/cocoon/generator/SlingGeneratorServletResponse.java?rev=746815&view=auto
==============================================================================
---
incubator/sling/whiteboard/jvazquez/org.apache.sling.scripting.xproc/src/main/java/org/apache/sling/cocoon/generator/SlingGeneratorServletResponse.java
(added)
+++
incubator/sling/whiteboard/jvazquez/org.apache.sling.scripting.xproc/src/main/java/org/apache/sling/cocoon/generator/SlingGeneratorServletResponse.java
Sun Feb 22 20:48:08 2009
@@ -0,0 +1,66 @@
+/*
+ * 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.sling.cocoon.generator;
+
+import java.io.IOException;
+import java.io.PrintWriter;
+
+import javax.servlet.ServletOutputStream;
+
+import org.apache.sling.api.SlingHttpServletResponse;
+import org.apache.sling.api.wrappers.SlingHttpServletResponseWrapper;
+
+public class SlingGeneratorServletResponse extends
SlingHttpServletResponseWrapper
+
implements SlingHttpServletResponse {
+
+ private SlingGeneratorServletOutputStream output;
+
+ private boolean hasWriter = false;
+ private boolean hasOutputStream = false;
+
+ public SlingGeneratorServletResponse(SlingHttpServletResponse
wrappedResponse,
+ SlingGeneratorServletOutputStream output) {
+ super(wrappedResponse);
+ this.output = output;
+ }
+
+ @Override
+ public PrintWriter getWriter() throws IOException {
+ if (this.hasOutputStream) {
+ throw new IllegalStateException("getOutputStream was
already called.");
+ }
+ this.hasWriter = true;
+ return this.output.getWriter();
+ }
+
+ @Override
+ public ServletOutputStream getOutputStream() throws IOException {
+ if (this.hasWriter) {
+ throw new IllegalStateException("getWriter was already
called.");
+ }
+ this.hasOutputStream = true;
+ return this.output;
+ }
+
+ @Override
+ public int getBufferSize() {
+ return 1024;
+ }
+
+}
Modified:
incubator/sling/whiteboard/jvazquez/org.apache.sling.scripting.xproc/src/main/java/org/apache/sling/scripting/xproc/XProcScriptEngine.java
URL:
http://svn.apache.org/viewvc/incubator/sling/whiteboard/jvazquez/org.apache.sling.scripting.xproc/src/main/java/org/apache/sling/scripting/xproc/XProcScriptEngine.java?rev=746815&r1=746814&r2=746815&view=diff
==============================================================================
---
incubator/sling/whiteboard/jvazquez/org.apache.sling.scripting.xproc/src/main/java/org/apache/sling/scripting/xproc/XProcScriptEngine.java
(original)
+++
incubator/sling/whiteboard/jvazquez/org.apache.sling.scripting.xproc/src/main/java/org/apache/sling/scripting/xproc/XProcScriptEngine.java
Sun Feb 22 20:48:08 2009
@@ -27,7 +27,7 @@
import org.apache.sling.api.scripting.SlingBindings;
import org.apache.sling.api.scripting.SlingScriptHelper;
-import org.apache.sling.cocoon.SlingGenerator;
+import org.apache.sling.cocoon.generator.SlingGenerator;
import org.apache.sling.scripting.api.AbstractSlingScriptEngine;
import org.apache.sling.xproc.XplBuilder;
import org.apache.sling.xproc.api.Pipeline;
Added:
incubator/sling/whiteboard/jvazquez/org.apache.sling.scripting.xproc/src/main/resources/SLING-INF/content/apps/sling/xpl/html.xpl
URL:
http://svn.apache.org/viewvc/incubator/sling/whiteboard/jvazquez/org.apache.sling.scripting.xproc/src/main/resources/SLING-INF/content/apps/sling/xpl/html.xpl?rev=746815&view=auto
==============================================================================
---
incubator/sling/whiteboard/jvazquez/org.apache.sling.scripting.xproc/src/main/resources/SLING-INF/content/apps/sling/xpl/html.xpl
(added)
+++
incubator/sling/whiteboard/jvazquez/org.apache.sling.scripting.xproc/src/main/resources/SLING-INF/content/apps/sling/xpl/html.xpl
Sun Feb 22 20:48:08 2009
@@ -0,0 +1,26 @@
+<?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.
+-->
+<p:pipeline xmlns:p="http://www.w3.org/ns/xproc">
+
+ <p:xslt>
+ <p:input port="stylesheet">
+ <p:document
href="http://localhost:8888/xpl-sample/xsl/test-content.xslt"/>
+ </p:input>
+ </p:xslt>
+
+</p:pipeline>
Added:
incubator/sling/whiteboard/jvazquez/org.apache.sling.scripting.xproc/src/main/resources/SLING-INF/content/apps/sling/xpl/sample/sample.esp
URL:
http://svn.apache.org/viewvc/incubator/sling/whiteboard/jvazquez/org.apache.sling.scripting.xproc/src/main/resources/SLING-INF/content/apps/sling/xpl/sample/sample.esp?rev=746815&view=auto
==============================================================================
---
incubator/sling/whiteboard/jvazquez/org.apache.sling.scripting.xproc/src/main/resources/SLING-INF/content/apps/sling/xpl/sample/sample.esp
(added)
+++
incubator/sling/whiteboard/jvazquez/org.apache.sling.scripting.xproc/src/main/resources/SLING-INF/content/apps/sling/xpl/sample/sample.esp
Sun Feb 22 20:48:08 2009
@@ -0,0 +1,23 @@
+<?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.
+-->
+<test>
+ <content>
+ xpl-sample: content
+ </content>
+</test>
+
Modified:
incubator/sling/whiteboard/jvazquez/org.apache.sling.scripting.xproc/src/main/resources/SLING-INF/content/xpl-sample/pipelines.json
URL:
http://svn.apache.org/viewvc/incubator/sling/whiteboard/jvazquez/org.apache.sling.scripting.xproc/src/main/resources/SLING-INF/content/xpl-sample/pipelines.json?rev=746815&r1=746814&r2=746815&view=diff
==============================================================================
---
incubator/sling/whiteboard/jvazquez/org.apache.sling.scripting.xproc/src/main/resources/SLING-INF/content/xpl-sample/pipelines.json
(original)
+++
incubator/sling/whiteboard/jvazquez/org.apache.sling.scripting.xproc/src/main/resources/SLING-INF/content/xpl-sample/pipelines.json
Sun Feb 22 20:48:08 2009
@@ -4,5 +4,6 @@
"test_pipeline": {
"title": "test_pipeline",
"sling:resourceType": "sling/xpl/sample",
+ "sling:resourceSuperType": "sling/xpl"
}
}
\ No newline at end of file