Remove the webapppath information from XID.
This commit is contained in:
parent
5456caece2
commit
58ffaea88d
8 changed files with 32 additions and 155 deletions
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
@ -22,7 +22,6 @@ public class DomPresenter extends Presenter
|
|||
}
|
||||
|
||||
|
||||
protected String webappPath;
|
||||
protected Document doc;
|
||||
|
||||
/*
|
||||
|
@ -30,7 +29,6 @@ public class DomPresenter extends Presenter
|
|||
*/
|
||||
public DomPresenter ()
|
||||
{
|
||||
this.webappPath = Presenter.staticRootPath;
|
||||
this.doc = null;
|
||||
}
|
||||
|
||||
|
@ -40,53 +38,11 @@ public class DomPresenter extends Presenter
|
|||
*/
|
||||
public DomPresenter (Document doc)
|
||||
{
|
||||
this.webappPath = Presenter.staticRootPath;
|
||||
this.doc = doc;
|
||||
DomPresenter.addMetaTag (this.doc, "generator", "XID 0.0");
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
public DomPresenter (String webappPath, Document doc)
|
||||
{
|
||||
if ((webappPath == null) || (webappPath.equals ("")))
|
||||
{
|
||||
this.webappPath = Presenter.staticRootPath;
|
||||
}
|
||||
else
|
||||
{
|
||||
this.webappPath = webappPath;
|
||||
}
|
||||
|
||||
this.doc = doc;
|
||||
DomPresenter.addMetaTag (this.doc, "generator", "XID 0.0");
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
public String getWebappPath ()
|
||||
{
|
||||
String result;
|
||||
|
||||
result = this.webappPath;
|
||||
|
||||
//
|
||||
return (result);
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
public void setWebappPath (String path)
|
||||
{
|
||||
this.webappPath = path;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
|
@ -160,7 +116,7 @@ public class DomPresenter extends Presenter
|
|||
else
|
||||
{
|
||||
// Build the web page.
|
||||
result = Presenter.doXid (this.doc, datas, this.webappPath, errorOutput);
|
||||
result = Presenter.doXid (this.doc, datas, errorOutput);
|
||||
}
|
||||
|
||||
//
|
||||
|
|
|
@ -15,7 +15,7 @@ public class FilePresenter extends DomPresenter
|
|||
logger = org.apache.log4j.Logger.getLogger (FilePresenter.class);
|
||||
}
|
||||
|
||||
protected String sourceFileName;
|
||||
protected String sourceFilePathname;
|
||||
protected long sourceFileTime;
|
||||
|
||||
/*
|
||||
|
@ -23,8 +23,7 @@ public class FilePresenter extends DomPresenter
|
|||
*/
|
||||
public FilePresenter ()
|
||||
{
|
||||
this.webappPath = Presenter.staticRootPath;
|
||||
this.sourceFileName = null;
|
||||
this.sourceFilePathname = null;
|
||||
this.sourceFileTime = 0;
|
||||
this.doc = null;
|
||||
}
|
||||
|
@ -33,10 +32,9 @@ public class FilePresenter extends DomPresenter
|
|||
/*
|
||||
*
|
||||
*/
|
||||
public FilePresenter (String fileName)
|
||||
public FilePresenter (String filePathname)
|
||||
{
|
||||
this.webappPath = Presenter.staticRootPath;
|
||||
this.sourceFileName = fileName;
|
||||
this.sourceFilePathname = filePathname;
|
||||
this.sourceFileTime = 0;
|
||||
this.doc = null;
|
||||
}
|
||||
|
@ -45,28 +43,9 @@ public class FilePresenter extends DomPresenter
|
|||
/*
|
||||
*
|
||||
*/
|
||||
public FilePresenter (String webappPath, String fileName)
|
||||
public void setSource (String filePathname)
|
||||
{
|
||||
if ((webappPath == null) || (webappPath.equals ("")))
|
||||
{
|
||||
this.webappPath = Presenter.staticRootPath;
|
||||
}
|
||||
else
|
||||
{
|
||||
this.webappPath = webappPath;
|
||||
}
|
||||
this.sourceFileName = fileName;
|
||||
this.sourceFileTime = 0;
|
||||
this.doc = null;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
public void setSource (String fileName)
|
||||
{
|
||||
this.sourceFileName = fileName;
|
||||
this.sourceFilePathname = filePathname;
|
||||
this.sourceFileTime = 0;
|
||||
this.doc = null;
|
||||
}
|
||||
|
@ -79,7 +58,7 @@ public class FilePresenter extends DomPresenter
|
|||
{
|
||||
String result;
|
||||
|
||||
result = this.sourceFileName;
|
||||
result = this.sourceFilePathname;
|
||||
|
||||
//
|
||||
return (result);
|
||||
|
@ -102,7 +81,7 @@ public class FilePresenter extends DomPresenter
|
|||
{
|
||||
StringBuffer result;
|
||||
|
||||
String sourceFilePath = this.webappPath + File.separator + this.sourceFileName;
|
||||
String sourceFilePath = this.sourceFilePathname;
|
||||
|
||||
// Get the good tree.
|
||||
File source = new File (sourceFilePath);
|
||||
|
@ -134,7 +113,7 @@ public class FilePresenter extends DomPresenter
|
|||
}
|
||||
|
||||
// Build the web page.
|
||||
result = Presenter.doXid (doc, datas, this.webappPath, errorOutput);
|
||||
result = Presenter.doXid (doc, datas, errorOutput);
|
||||
|
||||
//
|
||||
return (result);
|
||||
|
@ -144,7 +123,7 @@ public class FilePresenter extends DomPresenter
|
|||
/*
|
||||
* Xid a file without data.
|
||||
*/
|
||||
static public StringBuffer doXid (String fileName, String webappPath, StringBuffer errorOutput)
|
||||
static public StringBuffer doXid (String fileName, StringBuffer errorOutput)
|
||||
{
|
||||
StringBuffer result;
|
||||
|
||||
|
@ -158,7 +137,7 @@ public class FilePresenter extends DomPresenter
|
|||
{
|
||||
Presenter.addMetaTag (doc, "generator", "XID 0.0");
|
||||
|
||||
result = Presenter.doXid (doc, null, webappPath, errorOutput);
|
||||
result = Presenter.doXid (doc, null, errorOutput);
|
||||
}
|
||||
|
||||
//
|
||||
|
|
|
@ -21,43 +21,15 @@ public class Presenter
|
|||
logger = org.apache.log4j.Logger.getLogger (Presenter.class);
|
||||
}
|
||||
|
||||
static protected String staticRootPath;
|
||||
static
|
||||
{
|
||||
staticRootPath = null;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
static public void setStaticRootPath (String path)
|
||||
{
|
||||
Presenter.staticRootPath = path;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
static public String getStaticRootPath ()
|
||||
{
|
||||
String result;
|
||||
|
||||
result = Presenter.staticRootPath;
|
||||
|
||||
//
|
||||
return (result);
|
||||
}
|
||||
|
||||
/*
|
||||
* Xid a file with data.
|
||||
*/
|
||||
static public StringBuffer doXid (Document doc, IdsDataById datas, String webappPath, StringBuffer errorOutput)
|
||||
static public StringBuffer doXid (Document doc, IdsDataById datas, StringBuffer errorOutput)
|
||||
{
|
||||
StringBuffer result;
|
||||
|
||||
result = Presenter.process (doc, datas, webappPath, errorOutput);
|
||||
result = Presenter.process (doc, datas, errorOutput);
|
||||
|
||||
//
|
||||
return (result);
|
||||
|
@ -219,12 +191,12 @@ public class Presenter
|
|||
lineCounter += 1;
|
||||
if (lineCounter == 1)
|
||||
{
|
||||
result.append (process (children.item (childIndex), datas, webappPath, suffix, errorOutput));
|
||||
result.append (process (children.item (childIndex), datas, suffix, errorOutput));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
result.append (process (children.item (childIndex), datas, webappPath, suffix, errorOutput));
|
||||
result.append (process (children.item (childIndex), datas, suffix, errorOutput));
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
@ -239,12 +211,12 @@ public class Presenter
|
|||
|
||||
if ((lineCounter == 1) || (lineCounter == 2))
|
||||
{
|
||||
result.append (process (children.item (childIndex), datas, webappPath, suffix, errorOutput));
|
||||
result.append (process (children.item (childIndex), datas, suffix, errorOutput));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
result.append (process (children.item (childIndex), datas, webappPath, suffix, errorOutput));
|
||||
result.append (process (children.item (childIndex), datas, suffix, errorOutput));
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
@ -259,12 +231,12 @@ public class Presenter
|
|||
if ((attrs2 != null) &&
|
||||
(attrs2.getNamedItem ("id") != null))
|
||||
{
|
||||
result.append (process (children.item (childIndex), datas, webappPath, suffix, errorOutput));
|
||||
result.append (process (children.item (childIndex), datas, suffix, errorOutput));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
result.append (process (children.item (childIndex), datas, webappPath, suffix, errorOutput));
|
||||
result.append (process (children.item (childIndex), datas, suffix, errorOutput));
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
@ -278,12 +250,12 @@ public class Presenter
|
|||
if ((attrs2 == null) ||
|
||||
(attrs2.getNamedItem ("id") == null))
|
||||
{
|
||||
result.append (process (children.item(childIndex), datas, webappPath, suffix, errorOutput));
|
||||
result.append (process (children.item(childIndex), datas, suffix, errorOutput));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
result.append (process (children.item (childIndex), datas, webappPath, suffix, errorOutput));
|
||||
result.append (process (children.item (childIndex), datas, suffix, errorOutput));
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
@ -291,7 +263,7 @@ public class Presenter
|
|||
case ALL_ROWS:
|
||||
for (int childIndex = 0; childIndex < childrenCount; childIndex++)
|
||||
{
|
||||
result.append (process (children.item(childIndex), datas, webappPath, suffix, errorOutput));
|
||||
result.append (process (children.item(childIndex), datas, suffix, errorOutput));
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
@ -489,11 +461,11 @@ public class Presenter
|
|||
/**
|
||||
*
|
||||
*/
|
||||
static protected StringBuffer process (Node node, IdsDataById datas, String webappPath, StringBuffer errorOutput)
|
||||
static protected StringBuffer process (Node node, IdsDataById datas, StringBuffer errorOutput)
|
||||
{
|
||||
StringBuffer result;
|
||||
|
||||
result = Presenter.process (node, datas, webappPath, "", errorOutput);
|
||||
result = Presenter.process (node, datas, "", errorOutput);
|
||||
|
||||
//
|
||||
return (result);
|
||||
|
@ -504,7 +476,7 @@ public class Presenter
|
|||
* Recursive method that processes a node and any child nodes.
|
||||
*
|
||||
*/
|
||||
static protected StringBuffer process (Node node, IdsDataById datas, String webappPath, String suffix, StringBuffer errorOutput)
|
||||
static protected StringBuffer process (Node node, IdsDataById datas, String suffix, StringBuffer errorOutput)
|
||||
{
|
||||
logger.debug ("Enter");
|
||||
String TRANSITIONAL_DTD = "xhtml1-transitional.dtd";
|
||||
|
@ -548,7 +520,7 @@ public class Presenter
|
|||
// Log.write(Log.TRACE,"systemId = " + systemId);
|
||||
}
|
||||
|
||||
result.append (Presenter.process (((Document) node).getDocumentElement(), datas, webappPath, suffix, errorOutput));
|
||||
result.append (Presenter.process (((Document) node).getDocumentElement(), datas, suffix, errorOutput));
|
||||
|
||||
break;
|
||||
}
|
||||
|
@ -566,13 +538,12 @@ public class Presenter
|
|||
attrs,
|
||||
idAttr,
|
||||
datas,
|
||||
webappPath,
|
||||
suffix,
|
||||
errorOutput));
|
||||
}
|
||||
else
|
||||
{
|
||||
result.append (Presenter.processElementBasically (node, datas, webappPath, suffix, errorOutput));
|
||||
result.append (Presenter.processElementBasically (node, datas, suffix, errorOutput));
|
||||
}
|
||||
|
||||
break;
|
||||
|
|
|
@ -23,7 +23,6 @@ public class StringPresenter extends DomPresenter
|
|||
public StringPresenter ()
|
||||
{
|
||||
super ();
|
||||
this.webappPath = Presenter.staticRootPath;
|
||||
this.doc = null;
|
||||
this.html = null;
|
||||
}
|
||||
|
@ -34,25 +33,6 @@ public class StringPresenter extends DomPresenter
|
|||
*/
|
||||
public StringPresenter (String html)
|
||||
{
|
||||
this.webappPath = Presenter.staticRootPath;
|
||||
this.doc = null;
|
||||
this.html = html;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
public StringPresenter (String webappPath, String html)
|
||||
{
|
||||
if ((webappPath == null) || (webappPath.equals ("")))
|
||||
{
|
||||
this.webappPath = Presenter.staticRootPath;
|
||||
}
|
||||
else
|
||||
{
|
||||
this.webappPath = webappPath;
|
||||
}
|
||||
this.doc = null;
|
||||
this.html = html;
|
||||
}
|
||||
|
@ -119,7 +99,7 @@ public class StringPresenter extends DomPresenter
|
|||
}
|
||||
|
||||
StringBuffer htmlTarget;
|
||||
htmlTarget = Presenter.doXid (doc, datas, this.webappPath, errorOutput);
|
||||
htmlTarget = Presenter.doXid (doc, datas, errorOutput);
|
||||
|
||||
if (htmlTarget == null)
|
||||
{
|
||||
|
@ -156,27 +136,18 @@ public class StringPresenter extends DomPresenter
|
|||
*/
|
||||
static public StringBuffer doXid (String html, Data datas, StringBuffer errorOutput)
|
||||
{
|
||||
return (doXid (html, datas.getIdsDataById (), "", errorOutput));
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
static public StringBuffer doXid (String html, Data datas, String webappPath, StringBuffer errorOutput)
|
||||
{
|
||||
return (doXid (html, datas.getIdsDataById (), webappPath, errorOutput));
|
||||
return (doXid (html, datas.getIdsDataById (), errorOutput));
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Xid a string with html in.
|
||||
*/
|
||||
static public StringBuffer doXid (String html, IdsDataById datas, String webappPath, StringBuffer errorOutput)
|
||||
static public StringBuffer doXid (String html, IdsDataById datas, StringBuffer errorOutput)
|
||||
{
|
||||
StringBuffer result;
|
||||
|
||||
StringPresenter presenter = new StringPresenter (webappPath, html);
|
||||
StringPresenter presenter = new StringPresenter (html);
|
||||
|
||||
result = presenter.doXid (datas, errorOutput);
|
||||
|
||||
|
|
Loading…
Reference in a new issue