You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cocoon.apache.org by Carsten Ziegeler <cz...@sundn.de> on 2000/08/03 12:06:05 UTC
C2: Setting mime-type for the Serializer
Hello,
looking through the sitemap-draft and the serializer sources I found, that there are currently two possibilites for defining the mime-type for the serializer:
1.) Setting the mime-type attribute in the map:serialize node
This is currently ignored (see my bug email), but would be handled by the ResourcePipeline
2.) Setting the contentType parameter inside the map:serialize node
This works, but is done by every serializer itself
I assume that the first one is the correct one and the other is a relict.
Is this correct?
Regards
Carsten Ziegeler
Open Source Group sunShine - Lighting up e:Business
================================================================
Carsten Ziegeler, S&N AG, Klingenderstrasse 5, D-33100 Paderborn
www.sundn.de mailto:cziegeler@sundn.de
================================================================
------------------------------------------------------------------------------------------
...this mail was scanned for viruses by mailserver...
AW: C2: Setting mime-type for the Serializer
Posted by Carsten Ziegeler <cz...@sundn.de>.
Hello
sorry, its just me again. Reading the sitemap draft again, I found a third possibility for setting the mime-type. So the list looks like this:
1.) Setting the mime-type attribute in the map:serialize node
This is currently ignored (see my bug email), but would be
handled by the ResourcePipeline
2.) Setting the contentType parameter inside the map:serialize node
This works, but is done by every serializer itself
3.) Settign the mime-type attribute in the map:serializer node
This is not implemented yet
So my new assumption is that the first and the third one are legal and correct and the second is a relict.
Going further with my thoughts, I think the first has precedence over the third.
If this all is true, here is a diff for the ResourcePipeline.java which together with my extension to the sitemap (see my other email) enables exactly this setting scheme of the mime-type:
Index: ResourcePipeline.java
===================================================================
RCS file: /home/cvspublic/xml-cocoon/src/org/apache/cocoon/sitemap/Attic/ResourcePipeline.java,v
retrieving revision 1.1.2.11
diff -r1.1.2.11 ResourcePipeline.java
110a111,114
> if (mimeType == null && conf != null) {
> mimeType = conf.getAttribute("mime-type", null);
> }
> this.serializerMimeType = mimeType;
The last line includes the bug fix I posted earlier this day.
Regards
Carsten Ziegeler
Open Source Group sunShine - Lighting up e:Business
================================================================
Carsten Ziegeler, S&N AG, Klingenderstrasse 5, D-33100 Paderborn
www.sundn.de mailto:cziegeler@sundn.de
================================================================
------------------------------------------------------------------------------------------
...this mail was scanned for viruses by mailserver...
C2: Bug in ResourcePipeline.java - Serializer mimeType setting
Posted by Carsten Ziegeler <cz...@sundn.de>.
Hello,
the process() method of the ResourcePipeline class has a bug regarding the mimeType handling of the serializer.
Here is the diff:
Index: ResourcePipeline.java
===================================================================
RCS file: /home/cvspublic/xml-cocoon/src/org/apache/cocoon/sitemap/Attic/ResourcePipeline.java,v
retrieving revision 1.1.2.11
diff -r1.1.2.11 ResourcePipeline.java
155,156c159,161
< if (serializerMimeType != null)
< environment.setContentType (readerMimeType);
---
> if (serializerMimeType != null) {
> environment.setContentType (serializerMimeType);
> }
Together with my other patch from today, the mimeType handling of the serializer works according to the sitemap draft (if I understood it right....)
Regards
Carsten Ziegeler
Open Source Group sunShine - Lighting up e:Business
================================================================
Carsten Ziegeler, S&N AG, Klingenderstrasse 5, D-33100 Paderborn
www.sundn.de mailto:cziegeler@sundn.de
================================================================
------------------------------------------------------------------------------------------
...this mail was scanned for viruses by mailserver...
C2: Sitemap-extension: New configuration scheme for components
Posted by Carsten Ziegeler <cz...@sundn.de>.
Hello,
according to the sitemap draft, the following configuration possibility is desired:
<map:serializer name="wap" mime-type="text/vnd.wap.wml" src="org.apache.cocoon.serialization.XMLSerializer">
<doctype-public>-//WAPFORUM//DTD WML 1.1//EN</doctype-public>
<doctype-system>http://www.wapforum.org/DTD/wml_1.1.xml</doctype-system>
<encoding>UTF-8</encoding>
</map:serializer>
The current sitemap creates an org.apache.avalon.Configuration object which gets a value of the first node inside the map:serializer node, in this example doctype-public. The other nodes are not reachable.
I changed the sitemap.xsl so that an org.apache.avalon.Configuration object is created which is constructed similar to the Configuration objects of the general components of the cocoon.xconf:
A root Configuration object is created which gets all attributes of the map:serializer node.
For each child of map:serializer a new sub-configuration object is created.
If this is an acceptable solution, here is the diff:
Index: sitemap.xsl
===================================================================
RCS file: /home/cvspublic/xml-cocoon/src/org/apache/cocoon/components/language/markup/sitemap/java/Attic/sitemap.xsl,v
retrieving revision 1.1.2.18
diff -r1.1.2.18 sitemap.xsl
475a496,513
>
> <xsl:if test="$ns">
> confBuilder.startPrefixMapping("","<xsl:value-of select="namespace-uri(.)"/>");
> </xsl:if>
> <!-- Create root configuration -->
> attr.clear();
> <xsl:for-each select="attribute::*[name(.)!=$qname]">
> attr.addAttribute ("",
> "<xsl:value-of select="local-name(.)"/>",
> "<xsl:value-of select="name(.)"/>",
> "CDATA",
> "<xsl:value-of select="."/>");
> </xsl:for-each>
>
> confBuilder.startElement ("",
> "<xsl:value-of select="translate(@name, '- ', '__')"/>",
> "<xsl:value-of select="translate(@name, '- ', '__')"/>", attr);
>
483a522,528
> <!-- end root configuration -->
> confBuilder.endElement ("",
> "<xsl:value-of select="translate(@name, '- ', '__')"/>",
> "<xsl:value-of select="translate(@name, '- ', '__')"/>");
> <xsl:if test="$ns">
> confBuilder.endPrefixMapping("");
> </xsl:if>
Regards
Carsten Ziegeler
Open Source Group sunShine - Lighting up e:Business
================================================================
Carsten Ziegeler, S&N AG, Klingenderstrasse 5, D-33100 Paderborn
www.sundn.de mailto:cziegeler@sundn.de
================================================================
------------------------------------------------------------------------------------------
...this mail was scanned for viruses by mailserver...