Fixed some identifiers which illegal for Oracle DBs in ExternalLink.pdl
git-svn-id: https://svn.libreccm.org/ccm/trunk@3716 8810af33-2d31-482b-a856-94f89814c4dfmaster
parent
a4bb0eb959
commit
0f75a5b17a
|
|
@ -21,10 +21,10 @@ model com.arsdigita.cms.contenttypes;
|
||||||
import com.arsdigita.cms.ContentPage;
|
import com.arsdigita.cms.ContentPage;
|
||||||
|
|
||||||
object type ExternalLink extends ContentPage {
|
object type ExternalLink extends ContentPage {
|
||||||
String [0..1] url = ct_extLinks.url VARCHAR(2000);
|
String [0..1] url = ct_extlinks.url VARCHAR(2000);
|
||||||
String [0..1] comment = ct_extLinks.comment VARCHAR(4000);
|
String [0..1] comment = ct_extlinks.link_comment VARCHAR(4000);
|
||||||
Boolean [0..1] showComment = ct_extLinks.show_comment;
|
Boolean [0..1] showComment = ct_extlinks.show_comment;
|
||||||
Boolean [0..1] targetNewWindow = ct_extLinks.target_new_window;
|
Boolean [0..1] targetNewWindow = ct_extlinks.target_new_window;
|
||||||
|
|
||||||
reference key (ct_extLinks.extLink_id);
|
reference key (ct_extlinks.extlink_id);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -61,14 +61,14 @@ import org.apache.log4j.Logger;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A class for managing and obtaining a Stylesheet based on the current
|
* A class for managing and obtaining a Stylesheet based on the current
|
||||||
* request's location in the site map.
|
* request's location in the site map. First, we try to find a stylesheet
|
||||||
* First, we try to find a stylesheet specific to this site node. If we can't
|
* specific to this site node. If we can't find one, then we walk up the site
|
||||||
* find one, then we walk up the site map until we find a parent of this site
|
* map until we find a parent of this site node that has a stylesheet associated
|
||||||
* node that has a stylesheet associated with it.
|
* with it.
|
||||||
*
|
*
|
||||||
* If we haven't found one by the time we reach the root, then we'll
|
* If we haven't found one by the time we reach the root, then we'll do the same
|
||||||
* do the same tree walk except we'll look for the stylesheet
|
* tree walk except we'll look for the stylesheet associated with the
|
||||||
* associated with the <em>package</em> mounted on each site node.
|
* <em>package</em> mounted on each site node.
|
||||||
*
|
*
|
||||||
* @author Bill Schneider
|
* @author Bill Schneider
|
||||||
* @version $Id: PageTransformer.java 2071 2010-01-28 18:24:06Z pboy $
|
* @version $Id: PageTransformer.java 2071 2010-01-28 18:24:06Z pboy $
|
||||||
|
|
@ -86,166 +86,217 @@ public class PageTransformer implements PresentationManager {
|
||||||
|
|
||||||
registerXSLParameterGenerator("contextPath",
|
registerXSLParameterGenerator("contextPath",
|
||||||
new XSLParameterGenerator() {
|
new XSLParameterGenerator() {
|
||||||
@Override
|
|
||||||
public String generateValue(HttpServletRequest request) {
|
|
||||||
return request.getContextPath();
|
|
||||||
}
|
|
||||||
|
|
||||||
});
|
@Override
|
||||||
|
public String generateValue(
|
||||||
|
HttpServletRequest request) {
|
||||||
|
return request
|
||||||
|
.getContextPath();
|
||||||
|
}
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
registerXSLParameterGenerator("root-context-prefix",
|
registerXSLParameterGenerator("root-context-prefix",
|
||||||
new XSLParameterGenerator() {
|
new XSLParameterGenerator() {
|
||||||
@Override
|
|
||||||
public String generateValue(HttpServletRequest request) {
|
|
||||||
return Web.getConfig().getDispatcherContextPath();
|
|
||||||
}
|
|
||||||
|
|
||||||
});
|
@Override
|
||||||
|
public String generateValue(
|
||||||
|
HttpServletRequest request) {
|
||||||
|
return Web.getConfig()
|
||||||
|
.getDispatcherContextPath();
|
||||||
|
}
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
registerXSLParameterGenerator("context-prefix",
|
registerXSLParameterGenerator("context-prefix",
|
||||||
new XSLParameterGenerator() {
|
new XSLParameterGenerator() {
|
||||||
@Override
|
|
||||||
public String generateValue(HttpServletRequest request) {
|
|
||||||
return Web.getWebContext().getRequestURL().getContextPath();
|
|
||||||
}
|
|
||||||
|
|
||||||
});
|
@Override
|
||||||
|
public String generateValue(
|
||||||
|
HttpServletRequest request) {
|
||||||
|
return Web.getWebContext()
|
||||||
|
.getRequestURL()
|
||||||
|
.getContextPath();
|
||||||
|
}
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
registerXSLParameterGenerator("internal-theme",
|
registerXSLParameterGenerator("internal-theme",
|
||||||
new XSLParameterGenerator() {
|
new XSLParameterGenerator() {
|
||||||
@Override
|
|
||||||
public String generateValue(HttpServletRequest request) {
|
|
||||||
return Web.getWebContext().getRequestURL().getContextPath()
|
|
||||||
+ com.arsdigita.web.URL.INTERNAL_THEME_DIR;
|
|
||||||
}
|
|
||||||
|
|
||||||
});
|
@Override
|
||||||
|
public String generateValue(
|
||||||
|
HttpServletRequest request) {
|
||||||
|
return Web.getWebContext()
|
||||||
|
.getRequestURL()
|
||||||
|
.getContextPath()
|
||||||
|
+ com.arsdigita.web.URL.INTERNAL_THEME_DIR;
|
||||||
|
}
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
registerXSLParameterGenerator("dispatcher-prefix",
|
registerXSLParameterGenerator("dispatcher-prefix",
|
||||||
new XSLParameterGenerator() {
|
new XSLParameterGenerator() {
|
||||||
@Override
|
|
||||||
public String generateValue(HttpServletRequest request) {
|
|
||||||
return com.arsdigita.web.URL.getDispatcherPath();
|
|
||||||
}
|
|
||||||
|
|
||||||
});
|
@Override
|
||||||
|
public String generateValue(
|
||||||
|
HttpServletRequest request) {
|
||||||
|
return com.arsdigita.web.URL
|
||||||
|
.getDispatcherPath();
|
||||||
|
}
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
registerXSLParameterGenerator("dcp-on-buttons",
|
registerXSLParameterGenerator("dcp-on-buttons",
|
||||||
new XSLParameterGenerator() {
|
new XSLParameterGenerator() {
|
||||||
@Override
|
|
||||||
public String generateValue(HttpServletRequest request) {
|
|
||||||
if (Bebop.getConfig().doubleClickProtectionOnButtons()) {
|
|
||||||
return "true";
|
|
||||||
} else {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
@Override
|
||||||
|
public String generateValue(
|
||||||
|
HttpServletRequest request) {
|
||||||
|
if (Bebop.getConfig()
|
||||||
|
.doubleClickProtectionOnButtons()) {
|
||||||
|
return "true";
|
||||||
|
} else {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
});
|
}
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
registerXSLParameterGenerator("dcp-on-links",
|
registerXSLParameterGenerator("dcp-on-links",
|
||||||
new XSLParameterGenerator() {
|
new XSLParameterGenerator() {
|
||||||
@Override
|
|
||||||
public String generateValue(HttpServletRequest request) {
|
|
||||||
if (Bebop.getConfig().doubleClickProtectionOnLinks()) {
|
|
||||||
return "true";
|
|
||||||
} else {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String generateValue(
|
||||||
|
HttpServletRequest request) {
|
||||||
|
if (Bebop.getConfig()
|
||||||
|
.doubleClickProtectionOnLinks()) {
|
||||||
|
return "true";
|
||||||
|
} else {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
registerXSLParameterGenerator("user-agent",
|
registerXSLParameterGenerator("user-agent",
|
||||||
new XSLParameterGenerator() {
|
new XSLParameterGenerator() {
|
||||||
@Override
|
|
||||||
public String generateValue(HttpServletRequest request) {
|
|
||||||
return request.getHeader("User-Agent");
|
|
||||||
}
|
|
||||||
|
|
||||||
});
|
@Override
|
||||||
|
public String generateValue(
|
||||||
|
HttpServletRequest request) {
|
||||||
|
return request.getHeader(
|
||||||
|
"User-Agent");
|
||||||
|
}
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
registerXSLParameterGenerator("negotiated-language",
|
registerXSLParameterGenerator("negotiated-language",
|
||||||
new XSLParameterGenerator() {
|
new XSLParameterGenerator() {
|
||||||
@Override
|
|
||||||
public String generateValue(HttpServletRequest request) {
|
|
||||||
return GlobalizationHelper.getNegotiatedLocale().getLanguage();
|
|
||||||
}
|
|
||||||
|
|
||||||
});
|
@Override
|
||||||
|
public String generateValue(
|
||||||
|
HttpServletRequest request) {
|
||||||
|
return GlobalizationHelper
|
||||||
|
.getNegotiatedLocale()
|
||||||
|
.getLanguage();
|
||||||
|
}
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
registerXSLParameterGenerator("selected-language",
|
registerXSLParameterGenerator("selected-language",
|
||||||
new XSLParameterGenerator() {
|
new XSLParameterGenerator() {
|
||||||
@Override
|
|
||||||
public String generateValue(HttpServletRequest request) {
|
|
||||||
Locale selectedLocale = com.arsdigita.globalization.GlobalizationHelper.getSelectedLocale(request);
|
|
||||||
return (selectedLocale != null) ? selectedLocale.toString() : "";
|
|
||||||
}
|
|
||||||
|
|
||||||
});
|
@Override
|
||||||
|
public String generateValue(
|
||||||
|
HttpServletRequest request) {
|
||||||
|
Locale selectedLocale
|
||||||
|
= com.arsdigita.globalization.GlobalizationHelper
|
||||||
|
.getSelectedLocale(request);
|
||||||
|
return (selectedLocale != null)
|
||||||
|
? selectedLocale
|
||||||
|
.toString() : "";
|
||||||
|
}
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
registerXSLParameterGenerator("request-scheme",
|
registerXSLParameterGenerator("request-scheme",
|
||||||
new XSLParameterGenerator() {
|
new XSLParameterGenerator() {
|
||||||
@Override
|
|
||||||
public String generateValue(HttpServletRequest request) {
|
|
||||||
return request.getScheme();
|
|
||||||
}
|
|
||||||
|
|
||||||
});
|
@Override
|
||||||
|
public String generateValue(
|
||||||
|
HttpServletRequest request) {
|
||||||
|
return request.getScheme();
|
||||||
|
}
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
registerXSLParameterGenerator("server-name",
|
registerXSLParameterGenerator("server-name",
|
||||||
new XSLParameterGenerator() {
|
new XSLParameterGenerator() {
|
||||||
@Override
|
|
||||||
public String generateValue(HttpServletRequest request) {
|
|
||||||
return request.getServerName();
|
|
||||||
}
|
|
||||||
|
|
||||||
});
|
@Override
|
||||||
|
public String generateValue(
|
||||||
|
HttpServletRequest request) {
|
||||||
|
return request.getServerName();
|
||||||
|
}
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
registerXSLParameterGenerator("server-port",
|
registerXSLParameterGenerator("server-port",
|
||||||
new XSLParameterGenerator() {
|
new XSLParameterGenerator() {
|
||||||
@Override
|
|
||||||
public String generateValue(HttpServletRequest request) {
|
|
||||||
return Integer.toString(request.getServerPort());
|
|
||||||
}
|
|
||||||
|
|
||||||
});
|
@Override
|
||||||
|
public String generateValue(
|
||||||
|
HttpServletRequest request) {
|
||||||
|
return Integer.toString(
|
||||||
|
request.getServerPort());
|
||||||
|
}
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
registerXSLParameterGenerator("host",
|
registerXSLParameterGenerator("host",
|
||||||
new XSLParameterGenerator() {
|
new XSLParameterGenerator() {
|
||||||
@Override
|
|
||||||
public String generateValue(HttpServletRequest request) {
|
|
||||||
if (request.getServerPort() == 80) {
|
|
||||||
return String.format("%s://%s", request.getScheme(), request.getServerName());
|
|
||||||
} else {
|
|
||||||
return String.format("%s://%s:%d",
|
|
||||||
request.getScheme(),
|
|
||||||
request.getServerName(),
|
|
||||||
request.getServerPort());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
});
|
@Override
|
||||||
|
public String generateValue(
|
||||||
|
HttpServletRequest request) {
|
||||||
|
if (request.getServerPort()
|
||||||
|
== 80) {
|
||||||
|
return String.format(
|
||||||
|
"%s://%s", request
|
||||||
|
.getScheme(), request
|
||||||
|
.getServerName());
|
||||||
|
} else {
|
||||||
|
return String.format(
|
||||||
|
"%s://%s:%d",
|
||||||
|
request.getScheme(),
|
||||||
|
request
|
||||||
|
.getServerName(),
|
||||||
|
request
|
||||||
|
.getServerPort());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
s_log.debug("Static initalizer finished.");
|
s_log.debug("Static initalizer finished.");
|
||||||
}
|
}
|
||||||
// XXX These need to move somewhere else.
|
// XXX These need to move somewhere else.
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This is used to indicate that all xsl templates used should
|
* This is used to indicate that all xsl templates used should be pulled
|
||||||
* be pulled from the disk and not from the cache. If this
|
* from the disk and not from the cache. If this is in the request with a
|
||||||
* is in the request with a value of Boolean.TRUE then
|
* value of Boolean.TRUE then all XSL Stylesheets are pulled from the disk,
|
||||||
* all XSL Stylesheets are pulled from the disk, not the cache
|
* not the cache
|
||||||
*/
|
*/
|
||||||
public static final String CACHE_XSL_NONE = "cacheXSLNone";
|
public static final String CACHE_XSL_NONE = "cacheXSLNone";
|
||||||
/**
|
/**
|
||||||
* This is used to indicate that the "fancy errors" should be
|
* This is used to indicate that the "fancy errors" should be used and that
|
||||||
* used and that the errors should be placed in the request
|
* the errors should be placed in the request for later use. To use this,
|
||||||
* for later use. To use this, have the code place an attribute
|
* have the code place an attribute with this name in the request with the
|
||||||
* with this name in the request with the value of Boolean.TRUE
|
* value of Boolean.TRUE
|
||||||
*/
|
*/
|
||||||
public static final String FANCY_ERRORS = "fancyErrors";
|
public static final String FANCY_ERRORS = "fancyErrors";
|
||||||
/**
|
/**
|
||||||
|
|
@ -295,7 +346,7 @@ public class PageTransformer implements PresentationManager {
|
||||||
|
|
||||||
try {
|
try {
|
||||||
return new PrintWriter(new OutputStreamWriter(resp.
|
return new PrintWriter(new OutputStreamWriter(resp.
|
||||||
getOutputStream(),
|
getOutputStream(),
|
||||||
charset));
|
charset));
|
||||||
} catch (IOException ex) {
|
} catch (IOException ex) {
|
||||||
throw new UncheckedWrapperException(ex);
|
throw new UncheckedWrapperException(ex);
|
||||||
|
|
@ -318,17 +369,17 @@ public class PageTransformer implements PresentationManager {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Serves an XML Document, getting and applying the appropriate XSLT.
|
* Serves an XML Document, getting and applying the appropriate XSLT. Also
|
||||||
* Also allows for parameters to be set for the transformer. These will
|
* allows for parameters to be set for the transformer. These will become
|
||||||
* become top-level xsl:params in the stylesheet.
|
* top-level xsl:params in the stylesheet. The "contextPath" parameter will
|
||||||
* The "contextPath" parameter will always be passed to XSLT, which is the
|
* always be passed to XSLT, which is the value of
|
||||||
* value of <code>req.getWebContextPath()</code>.
|
* <code>req.getWebContextPath()</code>.
|
||||||
*
|
*
|
||||||
* @param doc the Bebop page to serve
|
* @param doc the Bebop page to serve
|
||||||
* @param req the servlet request
|
* @param req the servlet request
|
||||||
* @param resp the servlet response
|
* @param resp the servlet response
|
||||||
* @param params a set of name-value pairs to pass as parameters
|
* @param params a set of name-value pairs to pass as parameters to the
|
||||||
* to the Transformer
|
* Transformer
|
||||||
*/
|
*/
|
||||||
public void servePage(final Document doc,
|
public void servePage(final Document doc,
|
||||||
final HttpServletRequest req,
|
final HttpServletRequest req,
|
||||||
|
|
@ -343,11 +394,10 @@ public class PageTransformer implements PresentationManager {
|
||||||
Assert.exists(resp, HttpServletResponse.class);
|
Assert.exists(resp, HttpServletResponse.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Profiler.startOp("XSLT");
|
Profiler.startOp("XSLT");
|
||||||
try {
|
try {
|
||||||
final String charset = Globalization.getDefaultCharset(
|
final String charset = Globalization.getDefaultCharset(
|
||||||
Kernel.getContext().getLocale());
|
Kernel.getContext().getLocale());
|
||||||
|
|
||||||
final String output = req.getParameter("output");
|
final String output = req.getParameter("output");
|
||||||
s_log.info("output=" + output);
|
s_log.info("output=" + output);
|
||||||
|
|
@ -356,15 +406,16 @@ public class PageTransformer implements PresentationManager {
|
||||||
DeveloperSupport.startStage("PresMgr get stylesheet");
|
DeveloperSupport.startStage("PresMgr get stylesheet");
|
||||||
|
|
||||||
boolean fancyErrors = Bebop.getConfig().wantFancyXSLErrors()
|
boolean fancyErrors = Bebop.getConfig().wantFancyXSLErrors()
|
||||||
|| Boolean.TRUE.equals(req.getAttribute(
|
|| Boolean.TRUE.equals(req
|
||||||
FANCY_ERRORS));
|
.getAttribute(
|
||||||
|
FANCY_ERRORS));
|
||||||
|
|
||||||
// Get the stylesheet transformer object corresponding to the
|
// Get the stylesheet transformer object corresponding to the
|
||||||
// current request.
|
// current request.
|
||||||
final XSLTemplate template = Templating.getTemplate(
|
final XSLTemplate template = Templating.getTemplate(
|
||||||
req,
|
req,
|
||||||
fancyErrors,
|
fancyErrors,
|
||||||
!Boolean.TRUE.equals(req.getAttribute(CACHE_XSL_NONE)));
|
!Boolean.TRUE.equals(req.getAttribute(CACHE_XSL_NONE)));
|
||||||
|
|
||||||
DeveloperSupport.endStage("PresMgr get stylesheet");
|
DeveloperSupport.endStage("PresMgr get stylesheet");
|
||||||
|
|
||||||
|
|
@ -414,7 +465,7 @@ public class PageTransformer implements PresentationManager {
|
||||||
new StreamResult(writer));
|
new StreamResult(writer));
|
||||||
} catch (TransformerException ex) {
|
} catch (TransformerException ex) {
|
||||||
throw new UncheckedWrapperException(
|
throw new UncheckedWrapperException(
|
||||||
"cannot transform document", ex);
|
"cannot transform document", ex);
|
||||||
}
|
}
|
||||||
|
|
||||||
DeveloperSupport.endStage("PresMgr transform");
|
DeveloperSupport.endStage("PresMgr transform");
|
||||||
|
|
@ -422,9 +473,9 @@ public class PageTransformer implements PresentationManager {
|
||||||
// copy and paste from BasePresentationManager
|
// copy and paste from BasePresentationManager
|
||||||
if (Kernel.getConfig().isDebugEnabled()) {
|
if (Kernel.getConfig().isDebugEnabled()) {
|
||||||
Document origDoc = (Document) req.getAttribute(
|
Document origDoc = (Document) req.getAttribute(
|
||||||
"com.arsdigita.xml.Document");
|
"com.arsdigita.xml.Document");
|
||||||
Debugger.addDebugger(new TransformationDebugger(template.
|
Debugger.addDebugger(new TransformationDebugger(template.
|
||||||
getSource(), template.getDependents()));
|
getSource(), template.getDependents()));
|
||||||
writer.print(Debugger.getDebugging(req));
|
writer.print(Debugger.getDebugging(req));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -435,7 +486,10 @@ public class PageTransformer implements PresentationManager {
|
||||||
|
|
||||||
DispatcherHelper.forceCacheDisable(resp);
|
DispatcherHelper.forceCacheDisable(resp);
|
||||||
|
|
||||||
|
final long start = System.currentTimeMillis();
|
||||||
writer.println(doc.toString(true));
|
writer.println(doc.toString(true));
|
||||||
|
s_log.debug(String.format("Generated XML output in %d ms.",
|
||||||
|
System.currentTimeMillis() - start));
|
||||||
} else if (output.equals("xsl")) {
|
} else if (output.equals("xsl")) {
|
||||||
DeveloperSupport.startStage("PresMgr get stylesheet");
|
DeveloperSupport.startStage("PresMgr get stylesheet");
|
||||||
|
|
||||||
|
|
@ -445,11 +499,11 @@ public class PageTransformer implements PresentationManager {
|
||||||
// the
|
// the
|
||||||
// current request.
|
// current request.
|
||||||
template = Templating.getTemplate(
|
template = Templating.getTemplate(
|
||||||
req,
|
req,
|
||||||
Boolean.TRUE.equals(req.getAttribute(
|
Boolean.TRUE.equals(req.getAttribute(
|
||||||
PageTransformer.FANCY_ERRORS)),
|
PageTransformer.FANCY_ERRORS)),
|
||||||
!Boolean.TRUE.equals(req.getAttribute(
|
!Boolean.TRUE.equals(req.getAttribute(
|
||||||
PageTransformer.CACHE_XSL_NONE)));
|
PageTransformer.CACHE_XSL_NONE)));
|
||||||
endTransaction(req);
|
endTransaction(req);
|
||||||
} finally {
|
} finally {
|
||||||
DeveloperSupport.endStage("PresMgr get stylesheet");
|
DeveloperSupport.endStage("PresMgr get stylesheet");
|
||||||
|
|
@ -460,7 +514,7 @@ public class PageTransformer implements PresentationManager {
|
||||||
try {
|
try {
|
||||||
Date now = new Date();
|
Date now = new Date();
|
||||||
SimpleDateFormat fmt = new SimpleDateFormat(
|
SimpleDateFormat fmt = new SimpleDateFormat(
|
||||||
"yyyy-MM-dd-HH-mm");
|
"yyyy-MM-dd-HH-mm");
|
||||||
String prefix = "waf-xsl-" + fmt.format(now);
|
String prefix = "waf-xsl-" + fmt.format(now);
|
||||||
|
|
||||||
final OutputStream os = resp.getOutputStream();
|
final OutputStream os = resp.getOutputStream();
|
||||||
|
|
@ -480,7 +534,7 @@ public class PageTransformer implements PresentationManager {
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
throw new IllegalStateException(output
|
throw new IllegalStateException(output
|
||||||
+ " is an unknown output");
|
+ " is an unknown output");
|
||||||
}
|
}
|
||||||
} finally {
|
} finally {
|
||||||
Profiler.stopOp("XSLT");
|
Profiler.stopOp("XSLT");
|
||||||
|
|
@ -488,8 +542,8 @@ public class PageTransformer implements PresentationManager {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Ends the current transaction. Is a performance optimization to end
|
* Ends the current transaction. Is a performance optimization to end ASAP
|
||||||
* ASAP before serving the page.
|
* before serving the page.
|
||||||
*
|
*
|
||||||
* @param req HTTP request.
|
* @param req HTTP request.
|
||||||
*/
|
*/
|
||||||
|
|
@ -504,9 +558,10 @@ public class PageTransformer implements PresentationManager {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This adds a generator to the list of parameters available to
|
* This adds a generator to the list of parameters available to
|
||||||
* XSLStylesheets. If this is called a second time with the same
|
* XSLStylesheets. If this is called a second time with the same parameter
|
||||||
* parameter name then all previous calls are overwritten and
|
* name then all previous calls are overwritten and only the last registered
|
||||||
* only the last registered generator is used.
|
* generator is used.
|
||||||
|
*
|
||||||
* @param parameterName
|
* @param parameterName
|
||||||
* @param parameterGenerator
|
* @param parameterGenerator
|
||||||
*/
|
*/
|
||||||
|
|
@ -516,8 +571,9 @@ public class PageTransformer implements PresentationManager {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This removes the parameter from the list of parameters that
|
* This removes the parameter from the list of parameters that will be added
|
||||||
* will be added to stylesheets
|
* to stylesheets
|
||||||
|
*
|
||||||
* @param parameterName
|
* @param parameterName
|
||||||
*/
|
*/
|
||||||
public static void removeXSLParameterGenerator(String parameterName) {
|
public static void removeXSLParameterGenerator(String parameterName) {
|
||||||
|
|
@ -525,25 +581,29 @@ public class PageTransformer implements PresentationManager {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This is a Collection of all names of XSL Parameters that have been
|
* This is a Collection of all names of XSL Parameters that have been
|
||||||
* registered
|
* registered
|
||||||
* @return
|
*
|
||||||
|
* @return
|
||||||
*/
|
*/
|
||||||
public static Collection getXSLParameterNames() {
|
public static Collection getXSLParameterNames() {
|
||||||
return s_XSLParameters.keySet();
|
return s_XSLParameters.keySet();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This takes a name and request and returns the value that should
|
* This takes a name and request and returns the value that should be used
|
||||||
* be used in the XSL for the given name
|
* in the XSL for the given name
|
||||||
|
*
|
||||||
* @param name
|
* @param name
|
||||||
* @param request
|
* @param request
|
||||||
* @return
|
*
|
||||||
|
* @return
|
||||||
*/
|
*/
|
||||||
public static String getXSLParameterValue(String name,
|
public static String getXSLParameterValue(String name,
|
||||||
HttpServletRequest request) {
|
HttpServletRequest request) {
|
||||||
XSLParameterGenerator generator =
|
XSLParameterGenerator generator
|
||||||
(XSLParameterGenerator) s_XSLParameters.get(name);
|
= (XSLParameterGenerator) s_XSLParameters
|
||||||
|
.get(name);
|
||||||
if (generator != null) {
|
if (generator != null) {
|
||||||
return generator.generateValue(request);
|
return generator.generateValue(request);
|
||||||
} else {
|
} else {
|
||||||
|
|
@ -552,8 +612,9 @@ public class PageTransformer implements PresentationManager {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This takes in a transformer and adds all of the registered
|
* This takes in a transformer and adds all of the registered xsl
|
||||||
* xsl paraemters.
|
* paraemters.
|
||||||
|
*
|
||||||
* @param transformer
|
* @param transformer
|
||||||
* @param request
|
* @param request
|
||||||
*/
|
*/
|
||||||
|
|
@ -565,7 +626,7 @@ public class PageTransformer implements PresentationManager {
|
||||||
final Map.Entry entry = (Map.Entry) entries.next();
|
final Map.Entry entry = (Map.Entry) entries.next();
|
||||||
|
|
||||||
String value = ((XSLParameterGenerator) entry.getValue()).
|
String value = ((XSLParameterGenerator) entry.getValue()).
|
||||||
generateValue(request);
|
generateValue(request);
|
||||||
if (value == null) {
|
if (value == null) {
|
||||||
// XSL does not like nulls
|
// XSL does not like nulls
|
||||||
value = "";
|
value = "";
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue