Skip to content

Commit

Permalink
add simple logger implementation, tweak build, and servler request lo…
Browse files Browse the repository at this point in the history
…gging
  • Loading branch information
Conal-Tuohy committed Aug 24, 2023
1 parent 412a445 commit b364795
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 9 deletions.
16 changes: 9 additions & 7 deletions build.xml
Original file line number Diff line number Diff line change
Expand Up @@ -68,9 +68,16 @@
<unzip src="build/calabash.zip" dest="build/lib">
<patternset>
<include name="**/*.jar"/>
<exclude name="**/javax.servlet-api-3.1.0.jar"/>
</patternset>
<mapper type="flatten"/>
</unzip>
<copy todir="build/lib">
<fileset dir="lib">
<include name="**/*.jar"/>
<exclude name="**/servlet-api.jar"/>
</fileset>
</copy>
</target>

<target name="compile" depends="init">
Expand All @@ -87,7 +94,7 @@
</javac>
</target>

<target name="copy" depends="compile">
<target name="copy" depends="compile, update-version-string">
<echo>Copying files ...</echo>
<copy todir="build/webapp/xproc">
<fileset dir="xproc"/>
Expand All @@ -101,13 +108,8 @@
<copy todir="build/webapp/WEB-INF/lib">
<fileset dir="build/lib">
<include name="**/*.jar"/>
<exclude name="**/servlet-api.jar"/>
</fileset>
<!--
<fileset dir="../xmlcalabash1">
<include name="calabash.jar"/>
<exclude name="**/javax.servlet-api-3.1.0.jar"/>
</fileset>
-->
</copy>
</target>

Expand Down
Binary file added lib/slf4j-simple-1.7.36.jar
Binary file not shown.
5 changes: 3 additions & 2 deletions src/com/conaltuohy/xprocz/XProcZServlet.java
Original file line number Diff line number Diff line change
Expand Up @@ -307,6 +307,7 @@ private String purifyForXML(String text) {

public void init() throws ServletException {
getServletContext().log("XProc-Z initializing ...");
getServletContext().log("Main pipeline is " + getMainPipelineFilename());
try {
factory.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING, true);
builder = factory.newDocumentBuilder();
Expand Down Expand Up @@ -444,7 +445,8 @@ private XdmNode getRequestDocument(XProcRuntime runtime, HttpServletRequest req)
String partContentType = part.getContentType();
// The http client may legitimately not send part headers, but for politeness we
// supply the XProc pipeline with an explicit Content-Type, because
// rfc1341 says that absent headers imply "plain US-ASCII text"
// rfc1341 says that absent headers imply "plain US-ASCII text" and XProc-Z
// will provide a default of "utf-8" which will be correct if the text is US-ASCII.
// https://www.w3.org/Protocols/rfc1341/7_2_Multipart.html
if (partContentType == null) {
partContentType = defaultContentType;
Expand Down Expand Up @@ -775,7 +777,6 @@ private Input getMainPipelineInput() throws SecurityException, FileNotFoundExcep
private Input getPipelineInput(String filename) throws SecurityException, FileNotFoundException {
File file = new File(filename);
if (file.isFile() && file.canRead()) {
getServletContext().log("Loading pipeline from " + file);
return new Input(filename);
} else {
throw new FileNotFoundException("Pipeline " + file + " not found");
Expand Down

0 comments on commit b364795

Please sign in to comment.