fi.iki.hsivonen.verifierservlet
Class VerifierServletTransaction

java.lang.Object
  extended by fi.iki.hsivonen.verifierservlet.VerifierServletTransaction
All Implemented Interfaces:
DoctypeHandler
Direct Known Subclasses:
Html5ConformanceCheckerTransaction

 class VerifierServletTransaction
extends Object
implements DoctypeHandler

Version:
$Id: VerifierServletTransaction.java,v 1.10 2005/07/24 07:32:48 hsivonen Exp $
Author:
hsivonen

Field Summary
private static String[] ALL_CHECKERS
           
private static String[] ALL_CHECKERS_HTML4
           
private  AttributesImpl attrs
           
private static int AUTOMATIC_PARSER
           
private  BufferingRootNamespaceSniffer bufferingRootNamespaceSniffer
           
private  boolean checkNormalization
           
protected  ContentHandler contentHandler
           
private  String contentType
           
protected  String document
           
protected  TypedInputSource documentInput
           
protected  XhtmlSaxEmitter emitter
           
protected  LocalCacheEntityResolver entityResolver
           
protected  XhtmlEmittingErrorHandler errorHandler
           
private static int EXTERNAL_ENTITIES_NO_VALIDATION
           
private static char[] FAILURE
           
private static int HTML_PARSER
           
private static int HTML_PARSER_4_STRICT
           
private static int HTML_PARSER_4_TRANSITIONAL
           
private static int HTML_PARSER_5
           
protected  HtmlParser htmlParser
           
protected  PrudentHttpEntityResolver httpRes
           
private  com.hp.hpl.jena.iri.IRIFactory iriFactory
           
private  PropertyMap jingPropertyMap
           
private static String[] KNOWN_CONTENT_TYPES
           
private static long lastModified
           
private  boolean laxType
           
private  Set loadedValidatorUrls
           
private static org.apache.log4j.Logger log4j
           
private static String[] NAMESPACES_FOR_KNOWN_CONTENT_TYPES
           
private static int NO_EXTERNAL_ENTITIES
           
private  OutputStream out
           
private  int parser
           
private static Map pathMap
           
private static Schema[] preloadedSchemas
           
private static String[] preloadedSchemaUrls
           
private static int[] presetDoctypes
           
private static String[] presetLabels
           
private static String[] presetNamespaces
           
private static String[] presetUrls
           
protected  XMLReader reader
           
private  HttpServletRequest request
           
private  HttpServletResponse response
           
private static char[] RESULTS_TITLE
           
private  boolean rootNamespaceSeen
           
private  String schemaUrls
           
private static char[] SERVICE_TITLE
           
private static Pattern SPACE
           
private  long start
           
private static char[] SUCCESS
           
private static char[] TWO_POINT_OH_BETA
           
protected  Validator validator
           
protected static int XHTML5_SCHEMA
           
 
Fields inherited from interface fi.iki.hsivonen.htmlparser.DoctypeHandler
ANY_DOCTYPE, DOCTYPE_HTML401_STRICT, DOCTYPE_HTML401_TRANSITIONAL, DOCTYPE_HTML5
 
Constructor Summary
VerifierServletTransaction(HttpServletRequest request, HttpServletResponse response)
           
 
Method Summary
private  Validator combineValidatorByUrl(Validator validator, String url)
           
 void doctype(int doctype)
           
(package private)  void doGet()
           
(package private)  void emitDocDuration()
           
(package private)  void emitDocField()
           
protected  void emitFailure()
           
(package private)  void emitForm()
           
protected  void emitFormContent()
           
(package private)  void emitLaxTypeField()
           
(package private)  void emitParserOptions()
           
(package private)  void emitPresetOptions()
           
(package private)  void emitSchemaDuration()
           
(package private)  void emitSchemaField()
           
protected  void emitSuccess()
           
(package private)  void emitTitle(boolean markupAllowed)
           
(package private)  void emitTotalDuration()
           
private static boolean isCheckerUrl(String url)
           
private  boolean isHtmlUnsafePreset()
           
protected  void loadDocAndSetupParser()
           
(package private)  void rootNamespace(String namespace, Locator locator)
           
private  Schema schemaByUrl(String url)
           
private static Schema schemaByUrl(String url, EntityResolver resolver, PropertyMap pMap)
           
private  String schemaLabelFromDoctype(int doctype)
           
protected static String scrub(String s)
           
private  String scrubUrl(String urlStr)
           
protected  void setup()
           
protected  XMLReader setupXmlParser()
           
protected  void tryToSetupValidator()
           
(package private)  void validate()
           
protected  Validator validatorByDoctype(int doctype)
           
private  Validator validatorByUrl(String url)
           
private  Validator validatorByUrls(String schemaList)
           
protected  boolean willValidate()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

log4j

private static final org.apache.log4j.Logger log4j

SPACE

private static final Pattern SPACE

NO_EXTERNAL_ENTITIES

private static final int NO_EXTERNAL_ENTITIES
See Also:
Constant Field Values

EXTERNAL_ENTITIES_NO_VALIDATION

private static final int EXTERNAL_ENTITIES_NO_VALIDATION
See Also:
Constant Field Values

HTML_PARSER

private static final int HTML_PARSER
See Also:
Constant Field Values

HTML_PARSER_5

private static final int HTML_PARSER_5
See Also:
Constant Field Values

HTML_PARSER_4_STRICT

private static final int HTML_PARSER_4_STRICT
See Also:
Constant Field Values

HTML_PARSER_4_TRANSITIONAL

private static final int HTML_PARSER_4_TRANSITIONAL
See Also:
Constant Field Values

AUTOMATIC_PARSER

private static final int AUTOMATIC_PARSER
See Also:
Constant Field Values

XHTML5_SCHEMA

protected static final int XHTML5_SCHEMA
See Also:
Constant Field Values

SERVICE_TITLE

private static final char[] SERVICE_TITLE

TWO_POINT_OH_BETA

private static final char[] TWO_POINT_OH_BETA

RESULTS_TITLE

private static final char[] RESULTS_TITLE

SUCCESS

private static final char[] SUCCESS

FAILURE

private static final char[] FAILURE

pathMap

private static final Map pathMap

presetDoctypes

private static int[] presetDoctypes

presetLabels

private static String[] presetLabels

presetUrls

private static String[] presetUrls

presetNamespaces

private static String[] presetNamespaces

KNOWN_CONTENT_TYPES

private static final String[] KNOWN_CONTENT_TYPES

NAMESPACES_FOR_KNOWN_CONTENT_TYPES

private static final String[] NAMESPACES_FOR_KNOWN_CONTENT_TYPES

ALL_CHECKERS

private static final String[] ALL_CHECKERS

ALL_CHECKERS_HTML4

private static final String[] ALL_CHECKERS_HTML4

start

private long start

request

private HttpServletRequest request

response

private HttpServletResponse response

iriFactory

private com.hp.hpl.jena.iri.IRIFactory iriFactory

document

protected String document

parser

private int parser

laxType

private boolean laxType

contentHandler

protected ContentHandler contentHandler

emitter

protected XhtmlSaxEmitter emitter

errorHandler

protected XhtmlEmittingErrorHandler errorHandler

attrs

private AttributesImpl attrs

out

private OutputStream out

jingPropertyMap

private PropertyMap jingPropertyMap

entityResolver

protected LocalCacheEntityResolver entityResolver

lastModified

private static long lastModified

preloadedSchemaUrls

private static String[] preloadedSchemaUrls

preloadedSchemas

private static Schema[] preloadedSchemas

schemaUrls

private String schemaUrls

validator

protected Validator validator

bufferingRootNamespaceSniffer

private BufferingRootNamespaceSniffer bufferingRootNamespaceSniffer

contentType

private String contentType

htmlParser

protected HtmlParser htmlParser

reader

protected XMLReader reader

documentInput

protected TypedInputSource documentInput

httpRes

protected PrudentHttpEntityResolver httpRes

loadedValidatorUrls

private Set loadedValidatorUrls

checkNormalization

private boolean checkNormalization

rootNamespaceSeen

private boolean rootNamespaceSeen
Constructor Detail

VerifierServletTransaction

VerifierServletTransaction(HttpServletRequest request,
                           HttpServletResponse response)
Parameters:
request -
response -
Method Detail

scrub

protected static String scrub(String s)

isCheckerUrl

private static boolean isCheckerUrl(String url)

willValidate

protected boolean willValidate()

doGet

void doGet()
     throws ServletException,
            IOException
Throws:
ServletException
IOException

setup

protected void setup()
              throws ServletException
Throws:
ServletException

isHtmlUnsafePreset

private boolean isHtmlUnsafePreset()

validate

void validate()
        throws SAXException
Throws:
SAXException

emitSuccess

protected void emitSuccess()
                    throws SAXException
Throws:
SAXException

emitFailure

protected void emitFailure()
                    throws SAXException
Throws:
SAXException

tryToSetupValidator

protected void tryToSetupValidator()
                            throws SAXException,
                                   IOException,
                                   IncorrectSchemaException
Throws:
SAXException
IOException
IncorrectSchemaException

loadDocAndSetupParser

protected void loadDocAndSetupParser()
                              throws SAXException,
                                     IOException,
                                     IncorrectSchemaException,
                                     SAXNotRecognizedException,
                                     SAXNotSupportedException
Throws:
SAXException
IOException
IncorrectSchemaException
SAXNotRecognizedException
SAXNotSupportedException

validatorByDoctype

protected Validator validatorByDoctype(int doctype)
                                throws SAXException,
                                       IOException,
                                       IncorrectSchemaException
Throws:
SAXException
IOException
IncorrectSchemaException

setupXmlParser

protected XMLReader setupXmlParser()
                            throws SAXNotRecognizedException,
                                   SAXNotSupportedException
Parameters:
entityResolver2 -
Returns:
Throws:
SAXNotRecognizedException
SAXNotSupportedException

validatorByUrls

private Validator validatorByUrls(String schemaList)
                           throws SAXException,
                                  IOException,
                                  IncorrectSchemaException
Parameters:
validator -
Returns:
Throws:
SAXException
IOException
IncorrectSchemaException

combineValidatorByUrl

private Validator combineValidatorByUrl(Validator validator,
                                        String url)
                                 throws SAXException,
                                        IOException,
                                        IncorrectSchemaException
Parameters:
validator -
url -
Returns:
Throws:
SAXException
IOException
IncorrectSchemaException

validatorByUrl

private Validator validatorByUrl(String url)
                          throws SAXException,
                                 IOException,
                                 IncorrectSchemaException
Parameters:
url -
Returns:
Throws:
SAXException
IOException
IncorrectSchemaException

schemaByUrl

private Schema schemaByUrl(String url)
                    throws SAXException,
                           IOException,
                           IncorrectSchemaException
Parameters:
url -
Returns:
Throws:
SAXException
IOException
IncorrectSchemaException

schemaByUrl

private static Schema schemaByUrl(String url,
                                  EntityResolver resolver,
                                  PropertyMap pMap)
                           throws SAXException,
                                  IOException,
                                  IncorrectSchemaException
Parameters:
url -
Returns:
Throws:
SAXException
IOException
IncorrectSchemaException

emitTitle

void emitTitle(boolean markupAllowed)
         throws SAXException
Throws:
SAXException

emitForm

void emitForm()
        throws SAXException
Throws:
SAXException

emitFormContent

protected void emitFormContent()
                        throws SAXException
Throws:
SAXException

emitSchemaField

void emitSchemaField()
               throws SAXException
Throws:
SAXException

emitDocField

void emitDocField()
            throws SAXException
Throws:
SAXException

scrubUrl

private String scrubUrl(String urlStr)

emitSchemaDuration

void emitSchemaDuration()
                  throws SAXException
Throws:
SAXException

emitDocDuration

void emitDocDuration()
               throws SAXException
Throws:
SAXException

emitTotalDuration

void emitTotalDuration()
                 throws SAXException
Throws:
SAXException

emitPresetOptions

void emitPresetOptions()
                 throws SAXException
Throws:
SAXException

emitParserOptions

void emitParserOptions()
                 throws SAXException
Throws:
SAXException

emitLaxTypeField

void emitLaxTypeField()
                throws SAXException
Throws:
SAXException

rootNamespace

void rootNamespace(String namespace,
                   Locator locator)
             throws SAXException
Throws:
SAXException

doctype

public void doctype(int doctype)
             throws SAXException
Specified by:
doctype in interface DoctypeHandler
Throws:
SAXException

schemaLabelFromDoctype

private String schemaLabelFromDoctype(int doctype)