In this section

Site navigation below

The Code Style site has evolved by gradual refinement and accumulation of features and content. This review is part of a fully backdated site log and archive that sheds light on when, why and how particular features were implemented.

This log is sometimes updated several times per week, sometimes with a long overdue backlog of items. Many log entries refer to the Code Style Java package that delivers the servlet services and utilities used to manage this site.

Subscribe to the news feed for this log: RSS news feed

Reverse chronology

23rd October 2004

Added a minimal test case document to the RSS test pages to correct a problem with the XHTMLtoRSS XSL transformation in TOC mode. When standard definition lists were present with TOC lists, they were processed as if they qualified and resulted in un-bounded text content in the RSS output. The solution required a minor enhancement to the select statement for TOC mode items to match only dl elements with the class attribute TOC.

<xsl:apply-templates
  select="..//xhtml:dl[@class='TOC']/xhtml:dt"
  mode="items">
  ...
</xsl:apply-templates>
      

22nd October 2004

Added a case to the JDBC DriverUtilities class for handling the new MockDriver class. Also created DriverUtilitiesTest and MockDriverTest suites and completed code coverage for both, except the static initialiser for MockDriver. There seems no way to provoke an SQLException when registering the driver with DriverManager.

static {

  try {

    DriverManager.registerDriver(new MockDriver());
  }
  catch (SQLException sqle) {

    throw new RuntimeException(
                "Could not register MockDriver. " +
                sqle.getMessage());
  }
}
      

21th October 2004

Removed an instance of MockServlet20Context from the AbstractMockServletConfig class to avoid AbstractMethodException with later versions of the servlet API, and added a setServletContext method to explicitly add a compatible type. Also removed the setServletInfo method, which must now be supplied by, or applied to, the ServletContext that is used. Updated all unit test clients to explicitly set a MockServlet20Context.

Created a first draft set of mock objects to implement key java.sql interfaces:

16th October 2004

Completed the upgrade of PostgreSQL to version 7.4.5, with some modifications to the Cygwin environment. Installed cygserver to handle IPC and successfully restored a backup copy of the Code Style fonts database. Had to correct the SQL restoration script with a case-specific user name and fix the data by stripping out line breaks in browser user agent strings.

15th October 2004

Incremented the Code Style Java project version number to 0.4.2 to release the new parse servlet ResultLog implementation.

14th October 2004

Overhauled the AbstractParseServlet class to complete handling of ResultLog instances through the doGet and getLastModified methods. The doGet method gets a new, fully configured ResultLog from the ResultProxy handleRequest method. The getLastModified method instantiates a ResultLog and passes it to the ResultProxy getCacheValue method. Both methods may generate a new result cache entry, but the getLastModified method sets the bytes responded value to zero; only the doGet method issues a servlet response, which is particularly significant with conditional GET requests.

Removed the HTTP status field, accessor and mutator from the ResultLog class, since this cannot definitively be deduced by the servlet doGet and getLastModified methods independently. Although the getLastModified method may generate a fresh cache value, it does not actually return the content, so cannot know the response that is issued. Calls to this method may be conditional GET requests, which may or may not be followed by content.

Declared abstract the processLog method of AbstractParseServlet and added empty implementations to all subclasses. Added test cases for the new behaviour and included the MockParseServlet class in coverage tests for AbstractParseServlet. This required new tests for the mock object's processLog and getCustomConfig and getCacheKey methods.

12th October 2004

Changed the return type of the main handleResponse method of ResultProxy to issue a ResultLog. A ResultLog instance is created and configured via a new overloaded version of the getCacheValue method. The getCacheValue method calls the log's setFresh method according to the availability of a fresh, cached result, and adds the byte length of the result to the log.

Added a draft processLog(ResultLog) method to AbstractParseServlet to allow for permanent storage of log entries. Also added an overloaded getTimestamp(SimpleDateFormat) method to ResultLog and added tests for appropriate formatting.

Added a makeRequestURL method to ServletUtilities to re-construct the absolute URL of a servlet request with query string. Added test cases for the new method.

Added a setScheme method to the AbstractMockServletRequest class and amended getQueryString to return null with POST requests. Updated a number of test cases to set the servlet request method explicitly. Also corrected the getParameterNames method, which had been issuing an Enumeration of parameter values, not names.

10th October 2004

Completed initial code coverage tests for the draft ResultLog class, ready for extension of the ResultProxy scheme.

9th October 2004

Split the metadata processing XSL scripts for the ParseRSS and ParseRDF servlets into two sets to address the more limited scope of the RSS 1.0 Dublin Core module and proposed RSS 1.0 Qualified Dublin Core module. The metadata transformation scripts are now distinct DCElementsRDF and DCElementsRSS, DCEncodeRDF and DCEncodeRSS components so they can be adjusted independently.

While testing the latest output, some discrepancies with the Feed Validator came to light, so restricted the metadata to validate for now. It appears the validator checks Dublin Core date metadata that use the "rich" RDF content model, but not in the case of dcterms:modified. Temporarily suppressed this rich data structure for a simple literal value.

Also corrected some genuine errors in the transformation:

8th October 2004

Added a JavaDoc note on the Content-Type issued by the JavascriptType class; application/x-javascript.

6th October 2004

Corrected the RSS namespace URI in the XHTMLtoRSS XSL, which was missing the trailing slash. Still several issues to correct in this version, which includes the full template-DCElements transformation used for the XHTMLtoRDF template.

4th October 2004

Made the Hashtable of values (attributes) in the AbstractMockHttpSession class protected so that it is accessible in subclasses. Also made the StringBuffer log field in the AbstractMockServletContext class protected to access in subclasses.

2nd October 2004

Added getTidy and setTidy methods to the SourceBroker interface to introduce generic handling of arbitrary HTML documents. Created an AbstractSourceBroker with a base implementation of the new methods and adapted all SourceBroker types to extend this superclass.

Split the openInputStream method of UntrustedHttpBroker to call a new openTidyInputStream method when the getTidy method returns true. The new method also checks any character encoding specified in the HTTP Content-Type header and sets TidyDriver to handle as UTF-8 as necessary. Also introduced a new constructor to control the JTidy setting, which is active in this class by default.

Added convenience methods setUTF8 and setLatin1 to the TidyDriver class to specify the source character encoding.

Added request headers to the HttpRequest class to limit the accepted character set, content types, transfer encoding and content language. Temporarily removed the getContentEncoding and isValidContentEncoding method pending review. Also removed the getContentEncoding method from UntrustedHttpRequest, which is composed of an HttpRequest.

Changed the constructor of the StringBroker, TrustedHttpBroker and UntrustedHttpBroker to throw IllegalArgumentException with null parameters, not SourceException.

1st October 2004

Encountered multiple AbstractMethodException cases subclassing the Code Style mock object set in the unit tests of another project using the Java Servlets 2.3 API. These exceptions only seem to occur using dynamic classloading on the Linux production host where the superclasses compiled under the 2.0 API are instantiated through their subclasses.

Re-cast all mock servlet API classes as abstract implementations to avoid instantiation in subclasses and created a set of concrete subclasses to replace the originals, named MockServlet20Request, MockServlet20Response etc. All core functionality can be acquired by extending the abstract superclasses, named AbstractMockServletRequest, AbstactMockServletResponse, etc.

Altered exclusion and inclusion file name patterns on the compile, deploy and dist.mock targets of the Ant build file to allow for abstract mock objects whose class names begin "AbstractMock".

Added a doPost method to the ParseRDF servlet and updated the Dublin Core RDF test cases page to include a form for demonstration purposes.

Re-structured the getInputStream method of UntrustedHttpBroker , which was throwing an exception when no Content-Length header was returned. Abandoned this unnecessarily strict case and deferred to the LimitedInputStream, which controls the length of the stream.

Added more informative exception messages to the HttpRequest class.

Previously on Code Style

These backdated pages record detailed changes to the Code Style Web site since July 2000, when development first got underway. Some pages may refer to documents or features that have since changed or are no longer part of the site, but the archive is checked to ensure there are no dead links.

Add this page to your chosen social bookmarking service

Style warning - please read

Home · CSS · Java · Javascript · HTML · Help · Log