- From: Thomas Gambet via cvs-syncmail <cvsmail@w3.org>
- Date: Fri, 09 Oct 2009 06:46:42 +0000
- To: www-validator-cvs@w3.org
Update of /sources/public/2006/unicorn/src/org/w3c/unicorn/output In directory hutz:/tmp/cvs-serv26942/src/org/w3c/unicorn/output Modified Files: OutputFactory.java OutputFormater.java XMLOutputFormater.java SimpleOutputFormater.java Log Message: added the mime-type to outputformaters constructors Index: XMLOutputFormater.java =================================================================== RCS file: /sources/public/2006/unicorn/src/org/w3c/unicorn/output/XMLOutputFormater.java,v retrieving revision 1.7 retrieving revision 1.8 diff -u -d -r1.7 -r1.8 --- XMLOutputFormater.java 29 Sep 2009 16:05:58 -0000 1.7 +++ XMLOutputFormater.java 9 Oct 2009 06:46:40 -0000 1.8 @@ -15,8 +15,8 @@ public class XMLOutputFormater extends SimpleOutputFormater { - public XMLOutputFormater(final String format, final String lang) { - super(format, lang); + public XMLOutputFormater(final String format, final String lang, String mimeType) { + super(format, lang, mimeType); // Replace tag objects (A, Img, ...) with their XHTML representation final EventCartridge aEventCartridge = new EventCartridge(); Index: OutputFormater.java =================================================================== RCS file: /sources/public/2006/unicorn/src/org/w3c/unicorn/output/OutputFormater.java,v retrieving revision 1.7 retrieving revision 1.8 diff -u -d -r1.7 -r1.8 --- OutputFormater.java 29 Sep 2009 16:03:31 -0000 1.7 +++ OutputFormater.java 9 Oct 2009 06:46:40 -0000 1.8 @@ -9,7 +9,6 @@ import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; -import org.w3c.unicorn.util.Property; /** * SimpleOutputFormater<br /> @@ -25,12 +24,12 @@ protected String lang; - public OutputFormater(String format, String lang) { + public OutputFormater(String format, String lang, String mimeType) { logger.trace("Constructor"); logger.debug("Output format : " + format + "."); logger.debug("Output language : " + lang + "."); - this.mimeType = Property.getProps("output.properties").getProperty(format + ".mimetype"); + this.mimeType = mimeType; this.format = format; this.lang = lang; } Index: SimpleOutputFormater.java =================================================================== RCS file: /sources/public/2006/unicorn/src/org/w3c/unicorn/output/SimpleOutputFormater.java,v retrieving revision 1.9 retrieving revision 1.10 diff -u -d -r1.9 -r1.10 --- SimpleOutputFormater.java 7 Oct 2009 15:52:20 -0000 1.9 +++ SimpleOutputFormater.java 9 Oct 2009 06:46:40 -0000 1.10 @@ -23,11 +23,11 @@ protected VelocityContext aVelocityContext; public SimpleOutputFormater() { - this(Property.get("DEFAULT_FORMAT"), Property.get("DEFAULT_LANGUAGE")); + this(Property.get("DEFAULT_FORMAT"), Property.get("DEFAULT_LANGUAGE"), Property.getProps("output.properties").getProperty(Property.get("DEFAULT_FORMAT") + ".mimetype")); } - public SimpleOutputFormater(final String format, final String lang) { - super(format, lang); + public SimpleOutputFormater(final String format, final String lang, String mimeType) { + super(format, lang, mimeType); if (Framework.getLanguageContexts().get(lang) != null) { aVelocityContext = new VelocityContext(Framework.getLanguageContexts().get(lang)); Index: OutputFactory.java =================================================================== RCS file: /sources/public/2006/unicorn/src/org/w3c/unicorn/output/OutputFactory.java,v retrieving revision 1.9 retrieving revision 1.10 diff -u -d -r1.9 -r1.10 --- OutputFactory.java 29 Sep 2009 16:09:04 -0000 1.9 +++ OutputFactory.java 9 Oct 2009 06:46:40 -0000 1.10 @@ -77,20 +77,26 @@ OutputFormater aOutputFormater; String sFormaterName = Property.getProps("output.properties").getProperty(sOutputFormat + ".formater"); + String mimeType = Property.getProps("output.properties").getProperty(sOutputFormat + ".mimetype"); + + if (sFormaterName == null) + sFormaterName = "SimpleOutputFormater"; + if (mimeType == null) + mimeType = "text/plain"; if (null != sFormaterName) { try { final Class<?> aFormaterClass = Class.forName("org.w3c.unicorn.output." + sFormaterName); - final Class<?>[] tClassParamType = { String.class, String.class }; - final Object[] tObjectParamValue = { sOutputFormat, sLang }; + final Class<?>[] tClassParamType = { String.class, String.class, String.class }; + final Object[] tObjectParamValue = { sOutputFormat, sLang, mimeType }; aOutputFormater = (OutputFormater) aFormaterClass.getConstructor(tClassParamType).newInstance(tObjectParamValue); } catch (Exception e) { logger.error("Error instanciating outputFormater: " + sFormaterName + ". Using SimpleOutputFormater instead.", e); - aOutputFormater = new SimpleOutputFormater(sOutputFormat, sLang); + aOutputFormater = new SimpleOutputFormater(sOutputFormat, sLang, mimeType); } } else { - aOutputFormater = new SimpleOutputFormater(sOutputFormat, sLang); + aOutputFormater = new SimpleOutputFormater(sOutputFormat, sLang, mimeType); } return aOutputFormater;
Received on Friday, 9 October 2009 06:46:46 UTC