Page MenuHomeHEPForge

XhtmlMarkupWriterFactoryImpl.java
No OneTemporary

XhtmlMarkupWriterFactoryImpl.java

package cedar.hepdata.webapp.services.impl;
import java.util.Arrays;
import java.util.HashSet;
import java.util.Set;
import org.apache.tapestry5.ContentType;
import org.apache.tapestry5.MarkupWriter;
import org.apache.tapestry5.dom.DefaultMarkupModel;
import org.apache.tapestry5.dom.EndTagStyle;
import org.apache.tapestry5.dom.MarkupModel;
import org.apache.tapestry5.internal.services.MarkupWriterImpl;
import org.apache.tapestry5.services.MarkupWriterFactory;
public class XhtmlMarkupWriterFactoryImpl implements MarkupWriterFactory {
private final String applicationCharset;
private final MarkupModel xmlModel = new DefaultMarkupModel() {
private final Set<String> DONT_ABRV =
new HashSet<String>(Arrays.asList("script", "div", "span", "p","textarea", "select"));
@Override
public EndTagStyle getEndTagStyle(String element) {
boolean isDontAbr = DONT_ABRV.contains(element);
return isDontAbr ? EndTagStyle.REQUIRE : EndTagStyle.ABBREVIATE;
}
@Override
public boolean isXML() {
return true;
}
};
public XhtmlMarkupWriterFactoryImpl(String applicationCharset) {
this.applicationCharset = applicationCharset;
}
public MarkupWriter newMarkupWriter(ContentType contentType) {
return new MarkupWriterImpl(xmlModel, contentType.getParameter("charset"));
}
public MarkupWriter newMarkupWriter(String pageName) {
return new MarkupWriterImpl(xmlModel, applicationCharset);
}
public MarkupWriter newPartialMarkupWriter(ContentType contentType) {
return this.newMarkupWriter(contentType);
}
public MarkupWriter newPartialMarkupWriter(String pageName) {
return this.newMarkupWriter(pageName);
}
}

File Metadata

Mime Type
text/plain
Expires
Sat, Dec 21, 6:33 PM (1 h, 25 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
4023826
Default Alt Text
XhtmlMarkupWriterFactoryImpl.java (1 KB)

Event Timeline