Author: jonesde
Date: Wed Apr 2 14:53:06 2008 New Revision: 644081 URL: http://svn.apache.org/viewvc?rev=644081&view=rev Log: Removed xml header from fo wrapper, it is now added by the view handler if not there already; fixes problem with widget.verbose=true; fixes problem with widget.verbose=true; various cleanups too Modified: ofbiz/trunk/framework/common/webcommon/includes/reportTemplate.fo.ftl ofbiz/trunk/framework/common/webcommon/includes/simple.fo.ftl ofbiz/trunk/framework/widget/config/widget.properties ofbiz/trunk/framework/widget/src/org/ofbiz/widget/html/HtmlWidgetRenderer.java ofbiz/trunk/framework/widget/src/org/ofbiz/widget/screen/HtmlWidget.java ofbiz/trunk/framework/widget/src/org/ofbiz/widget/screen/ModelScreen.java ofbiz/trunk/framework/widget/src/org/ofbiz/widget/screen/ScreenFopViewHandler.java Modified: ofbiz/trunk/framework/common/webcommon/includes/reportTemplate.fo.ftl URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/common/webcommon/includes/reportTemplate.fo.ftl?rev=644081&r1=644080&r2=644081&view=diff ============================================================================== --- ofbiz/trunk/framework/common/webcommon/includes/reportTemplate.fo.ftl (original) +++ ofbiz/trunk/framework/common/webcommon/includes/reportTemplate.fo.ftl Wed Apr 2 14:53:06 2008 @@ -1,4 +1,3 @@ -<?xml version="1.0" encoding="UTF-8"?> <#-- Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file Modified: ofbiz/trunk/framework/common/webcommon/includes/simple.fo.ftl URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/common/webcommon/includes/simple.fo.ftl?rev=644081&r1=644080&r2=644081&view=diff ============================================================================== --- ofbiz/trunk/framework/common/webcommon/includes/simple.fo.ftl (original) +++ ofbiz/trunk/framework/common/webcommon/includes/simple.fo.ftl Wed Apr 2 14:53:06 2008 @@ -1,4 +1,3 @@ -<?xml version="1.0" encoding="UTF-8"?> <#-- Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file Modified: ofbiz/trunk/framework/widget/config/widget.properties URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/widget/config/widget.properties?rev=644081&r1=644080&r2=644081&view=diff ============================================================================== --- ofbiz/trunk/framework/widget/config/widget.properties (original) +++ ofbiz/trunk/framework/widget/config/widget.properties Wed Apr 2 14:53:06 2008 @@ -22,3 +22,4 @@ # Enable screen widget boundary comments widget.verbose=true + Modified: ofbiz/trunk/framework/widget/src/org/ofbiz/widget/html/HtmlWidgetRenderer.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/widget/src/org/ofbiz/widget/html/HtmlWidgetRenderer.java?rev=644081&r1=644080&r2=644081&view=diff ============================================================================== --- ofbiz/trunk/framework/widget/src/org/ofbiz/widget/html/HtmlWidgetRenderer.java (original) +++ ofbiz/trunk/framework/widget/src/org/ofbiz/widget/html/HtmlWidgetRenderer.java Wed Apr 2 14:53:06 2008 @@ -20,6 +20,8 @@ import java.io.IOException; import java.io.Writer; + +import org.ofbiz.base.util.Debug; import org.ofbiz.widget.ModelWidget; /** @@ -27,6 +29,7 @@ * is a base class that is extended by other widget HTML rendering classes. */ public class HtmlWidgetRenderer { + public static final String module = HtmlWidgetRenderer.class.getName(); /** * Characters that are appended to the end of each rendered element. Currently set to @@ -38,7 +41,7 @@ * Helper method used to append whitespace characters to the end of each rendered element. * @param writer The writer to write to */ - public static void appendWhitespace(Writer writer) throws IOException { + public void appendWhitespace(Writer writer) throws IOException { writer.write(whiteSpace); } @@ -46,7 +49,7 @@ * Helper method used to append whitespace characters to the end of each rendered element. * @param buffer The buffer to write to */ - public static void appendWhitespace(StringBuffer buffer) { + public void appendWhitespace(StringBuffer buffer) { buffer.append(whiteSpace); } @@ -56,7 +59,11 @@ * @param widgetType The widget type: "Screen Widget", "Form Widget", etc. * @param widgetName The widget name */ - public static String buildBoundaryComment(String boundaryType, String widgetType, String widgetName) { + public String buildBoundaryComment(String boundaryType, String widgetType, String widgetName) { + return formatBoundaryComment(boundaryType, widgetType, widgetName); + } + + public static String formatBoundaryComment(String boundaryType, String widgetType, String widgetName) { return "<!-- " + boundaryType + " " + widgetType + " " + widgetName + " -->" + whiteSpace; } @@ -68,7 +75,7 @@ */ public void renderBeginningBoundaryComment(StringBuffer buffer, String widgetType, ModelWidget modelWidget) { if (modelWidget.boundaryCommentsEnabled()) { - buffer.append(buildBoundaryComment("Begin", widgetType, modelWidget.getBoundaryCommentName())); + buffer.append(this.buildBoundaryComment("Begin", widgetType, modelWidget.getBoundaryCommentName())); } } @@ -80,7 +87,7 @@ */ public void renderBeginningBoundaryComment(Writer writer, String widgetType, ModelWidget modelWidget) throws IOException { if (modelWidget.boundaryCommentsEnabled()) { - writer.write(buildBoundaryComment("Begin", widgetType, modelWidget.getBoundaryCommentName())); + writer.write(this.buildBoundaryComment("Begin", widgetType, modelWidget.getBoundaryCommentName())); } } @@ -92,7 +99,7 @@ */ public void renderEndingBoundaryComment(Writer writer, String widgetType, ModelWidget modelWidget) throws IOException { if (modelWidget.boundaryCommentsEnabled()) { - writer.write(buildBoundaryComment("End", widgetType, modelWidget.getBoundaryCommentName())); + writer.write(this.buildBoundaryComment("End", widgetType, modelWidget.getBoundaryCommentName())); } } @@ -104,8 +111,7 @@ */ public void renderEndingBoundaryComment(StringBuffer buffer, String widgetType, ModelWidget modelWidget) { if (modelWidget.boundaryCommentsEnabled()) { - buffer.append(buildBoundaryComment("End", widgetType, modelWidget.getBoundaryCommentName())); + buffer.append(this.buildBoundaryComment("End", widgetType, modelWidget.getBoundaryCommentName())); } } - } Modified: ofbiz/trunk/framework/widget/src/org/ofbiz/widget/screen/HtmlWidget.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/widget/src/org/ofbiz/widget/screen/HtmlWidget.java?rev=644081&r1=644080&r2=644081&view=diff ============================================================================== --- ofbiz/trunk/framework/widget/src/org/ofbiz/widget/screen/HtmlWidget.java (original) +++ ofbiz/trunk/framework/widget/src/org/ofbiz/widget/screen/HtmlWidget.java Wed Apr 2 14:53:06 2008 @@ -91,11 +91,11 @@ Map parameters = (Map) context.get("parameters"); boolean insertWidgetBoundaryComments = ModelWidget.widgetBoundaryCommentsEnabled(parameters); if (insertWidgetBoundaryComments) { - writer.write(HtmlWidgetRenderer.buildBoundaryComment("Begin", "Template", location)); + writer.write(HtmlWidgetRenderer.formatBoundaryComment("Begin", "Template", location)); } FreeMarkerWorker.renderTemplateAtLocation(location, context, writer); if (insertWidgetBoundaryComments) { - writer.write(HtmlWidgetRenderer.buildBoundaryComment("End", "Template", location)); + writer.write(HtmlWidgetRenderer.formatBoundaryComment("End", "Template", location)); } } catch (IllegalArgumentException e) { String errMsg = "Error rendering included template at location [" + location + "]: " + e.toString(); @@ -209,4 +209,3 @@ } } } - Modified: ofbiz/trunk/framework/widget/src/org/ofbiz/widget/screen/ModelScreen.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/widget/src/org/ofbiz/widget/screen/ModelScreen.java?rev=644081&r1=644080&r2=644081&view=diff ============================================================================== --- ofbiz/trunk/framework/widget/src/org/ofbiz/widget/screen/ModelScreen.java (original) +++ ofbiz/trunk/framework/widget/src/org/ofbiz/widget/screen/ModelScreen.java Wed Apr 2 14:53:06 2008 @@ -34,6 +34,7 @@ import org.ofbiz.base.util.Debug; import org.ofbiz.base.util.FileUtil; import org.ofbiz.base.util.GeneralException; +import org.ofbiz.base.util.UtilHttp; import org.ofbiz.base.util.UtilValidate; import org.ofbiz.base.util.UtilXml; import org.ofbiz.base.util.string.FlexibleStringExpander; @@ -290,38 +291,15 @@ if ("intra-app".equals(link.getUrlMode())) { // look through all controller.xml files and find those with the request-uri referred to by the target - int endOfRequestUri = target.length(); - if (target.indexOf('?') > 0) { - endOfRequestUri = target.indexOf('?'); - } - String requestUri = target.substring(0, endOfRequestUri); - Debug.logInfo("In findRequestNamesLinkedtoInWidget have intra-app link with requestUri [" + requestUri + "]", module); + String requestUri = UtilHttp.getRequestUriFromTarget(target); Set<String> controllerLocAndRequestSet = ConfigXMLReader.findControllerFilesWithRequest(requestUri, null); allRequestNamesIncluded.addAll(controllerLocAndRequestSet); // if (controllerLocAndRequestSet.size() > 0) Debug.logInfo("============== In findRequestNamesLinkedtoInWidget, controllerLocAndRequestSet: " + controllerLocAndRequestSet, module); } else if ("inter-app".equals(link.getUrlMode())) { - int firstChar = 0; - if (target.charAt(0) == '/') firstChar = 1; - int pathSep = target.indexOf('/', 1); - String webappMountPoint = null; - if (pathSep > 0) { - // if not then no good, supposed to be a inter-app, but there is no path sep! will do general search with null and treat like an intra-app - webappMountPoint = target.substring(firstChar, pathSep) + "/WEB-INF"; - } - - int endOfRequestUri = target.length(); - if (target.indexOf('?') > 0) { - endOfRequestUri = target.indexOf('?'); - } - int slashBeforeRequestUri = target.lastIndexOf('/', endOfRequestUri); - String requestUri = null; - if (slashBeforeRequestUri < 0) { - requestUri = target.substring(0, endOfRequestUri); - } else { - requestUri = target.substring(slashBeforeRequestUri, endOfRequestUri); - } - Debug.logInfo("In findRequestNamesLinkedtoInWidget have inter-app link with requestUri [" + requestUri + "]", module); + String webappMountPoint = UtilHttp.getWebappMountPointFromTarget(target); + if (webappMountPoint != null) webappMountPoint += "/WEB-INF"; + String requestUri = UtilHttp.getRequestUriFromTarget(target); Set<String> controllerLocAndRequestSet = ConfigXMLReader.findControllerFilesWithRequest(requestUri, webappMountPoint); allRequestNamesIncluded.addAll(controllerLocAndRequestSet); Modified: ofbiz/trunk/framework/widget/src/org/ofbiz/widget/screen/ScreenFopViewHandler.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/widget/src/org/ofbiz/widget/screen/ScreenFopViewHandler.java?rev=644081&r1=644080&r2=644081&view=diff ============================================================================== --- ofbiz/trunk/framework/widget/src/org/ofbiz/widget/screen/ScreenFopViewHandler.java (original) +++ ofbiz/trunk/framework/widget/src/org/ofbiz/widget/screen/ScreenFopViewHandler.java Wed Apr 2 14:53:06 2008 @@ -73,14 +73,15 @@ } // set the input source (XSL-FO) and generate the output stream of contentType - Reader reader = new StringReader(writer.toString()); - StreamSource src = new StreamSource(reader); - if (Debug.verboseOn()) { - Debug.logVerbose("Transforming the following xsl-fo template: " + writer.toString(), module); + String screenOutString = writer.toString(); + if (!screenOutString.startsWith("<?xml")) { + screenOutString = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" + screenOutString; } + if (Debug.verboseOn()) Debug.logVerbose("XSL:FO Screen Output: " + screenOutString, module); + Reader reader = new StringReader(screenOutString); + StreamSource src = new StreamSource(reader); ByteArrayOutputStream out = new ByteArrayOutputStream(); - try { Fop fop = ApacheFopWorker.createFopInstance(out, contentType); ApacheFopWorker.transform(src, null, fop); @@ -117,5 +118,4 @@ throw new ViewHandlerException("Multiple errors rendering FOP", x); } } - } |
With this update the compiler gives the following error:
[javac] Compiling 4 source files to /home/hans/ofbiz/svn/framework/widget/build/classes [javac] /home/hans/ofbiz/svn/framework/widget/src/org/ofbiz/widget/screen/ModelScreen.java:294: cannot find symbol [javac] symbol : method getRequestUriFromTarget(java.lang.String) [javac] location: class org.ofbiz.base.util.UtilHttp [javac] String requestUri = UtilHttp.getRequestUriFromTarget(target); [javac] ^ [javac] /home/hans/ofbiz/svn/framework/widget/src/org/ofbiz/widget/screen/ModelScreen.java:300: cannot find symbol [javac] symbol : method getWebappMountPointFromTarget(java.lang.String) [javac] location: class org.ofbiz.base.util.UtilHttp [javac] String webappMountPoint = UtilHttp.getWebappMountPointFromTarget(target); [javac] ^ [javac] /home/hans/ofbiz/svn/framework/widget/src/org/ofbiz/widget/screen/ModelScreen.java:302: cannot find symbol [javac] symbol : method getRequestUriFromTarget(java.lang.String) [javac] location: class org.ofbiz.base.util.UtilHttp [javac] String requestUri = UtilHttp.getRequestUriFromTarget(target); [javac] ^ [javac] Note: Some input files use unchecked or unsafe operations. [javac] Note: Recompile with -Xlint:unchecked for details. [javac] 3 errors On Wed, 2008-04-02 at 21:53 +0000, [hidden email] wrote: > Author: jonesde > Date: Wed Apr 2 14:53:06 2008 > New Revision: 644081 > > URL: http://svn.apache.org/viewvc?rev=644081&view=rev > Log: > Removed xml header from fo wrapper, it is now added by the view handler if not there already; fixes problem with widget.verbose=true; fixes problem with widget.verbose=true; various cleanups too > > Modified: > ofbiz/trunk/framework/common/webcommon/includes/reportTemplate.fo.ftl > ofbiz/trunk/framework/common/webcommon/includes/simple.fo.ftl > ofbiz/trunk/framework/widget/config/widget.properties > ofbiz/trunk/framework/widget/src/org/ofbiz/widget/html/HtmlWidgetRenderer.java > ofbiz/trunk/framework/widget/src/org/ofbiz/widget/screen/HtmlWidget.java > ofbiz/trunk/framework/widget/src/org/ofbiz/widget/screen/ModelScreen.java > ofbiz/trunk/framework/widget/src/org/ofbiz/widget/screen/ScreenFopViewHandler.java > > Modified: ofbiz/trunk/framework/common/webcommon/includes/reportTemplate.fo.ftl > URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/common/webcommon/includes/reportTemplate.fo.ftl?rev=644081&r1=644080&r2=644081&view=diff > ============================================================================== > --- ofbiz/trunk/framework/common/webcommon/includes/reportTemplate.fo.ftl (original) > +++ ofbiz/trunk/framework/common/webcommon/includes/reportTemplate.fo.ftl Wed Apr 2 14:53:06 2008 > @@ -1,4 +1,3 @@ > -<?xml version="1.0" encoding="UTF-8"?> > <#-- > Licensed to the Apache Software Foundation (ASF) under one > or more contributor license agreements. See the NOTICE file > > Modified: ofbiz/trunk/framework/common/webcommon/includes/simple.fo.ftl > URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/common/webcommon/includes/simple.fo.ftl?rev=644081&r1=644080&r2=644081&view=diff > ============================================================================== > --- ofbiz/trunk/framework/common/webcommon/includes/simple.fo.ftl (original) > +++ ofbiz/trunk/framework/common/webcommon/includes/simple.fo.ftl Wed Apr 2 14:53:06 2008 > @@ -1,4 +1,3 @@ > -<?xml version="1.0" encoding="UTF-8"?> > <#-- > Licensed to the Apache Software Foundation (ASF) under one > or more contributor license agreements. See the NOTICE file > > Modified: ofbiz/trunk/framework/widget/config/widget.properties > URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/widget/config/widget.properties?rev=644081&r1=644080&r2=644081&view=diff > ============================================================================== > --- ofbiz/trunk/framework/widget/config/widget.properties (original) > +++ ofbiz/trunk/framework/widget/config/widget.properties Wed Apr 2 14:53:06 2008 > @@ -22,3 +22,4 @@ > > # Enable screen widget boundary comments > widget.verbose=true > + > > Modified: ofbiz/trunk/framework/widget/src/org/ofbiz/widget/html/HtmlWidgetRenderer.java > URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/widget/src/org/ofbiz/widget/html/HtmlWidgetRenderer.java?rev=644081&r1=644080&r2=644081&view=diff > ============================================================================== > --- ofbiz/trunk/framework/widget/src/org/ofbiz/widget/html/HtmlWidgetRenderer.java (original) > +++ ofbiz/trunk/framework/widget/src/org/ofbiz/widget/html/HtmlWidgetRenderer.java Wed Apr 2 14:53:06 2008 > @@ -20,6 +20,8 @@ > > import java.io.IOException; > import java.io.Writer; > + > +import org.ofbiz.base.util.Debug; > import org.ofbiz.widget.ModelWidget; > > /** > @@ -27,6 +29,7 @@ > * is a base class that is extended by other widget HTML rendering classes. > */ > public class HtmlWidgetRenderer { > + public static final String module = HtmlWidgetRenderer.class.getName(); > > /** > * Characters that are appended to the end of each rendered element. Currently set to > @@ -38,7 +41,7 @@ > * Helper method used to append whitespace characters to the end of each rendered element. > * @param writer The writer to write to > */ > - public static void appendWhitespace(Writer writer) throws IOException { > + public void appendWhitespace(Writer writer) throws IOException { > writer.write(whiteSpace); > } > > @@ -46,7 +49,7 @@ > * Helper method used to append whitespace characters to the end of each rendered element. > * @param buffer The buffer to write to > */ > - public static void appendWhitespace(StringBuffer buffer) { > + public void appendWhitespace(StringBuffer buffer) { > buffer.append(whiteSpace); > } > > @@ -56,7 +59,11 @@ > * @param widgetType The widget type: "Screen Widget", "Form Widget", etc. > * @param widgetName The widget name > */ > - public static String buildBoundaryComment(String boundaryType, String widgetType, String widgetName) { > + public String buildBoundaryComment(String boundaryType, String widgetType, String widgetName) { > + return formatBoundaryComment(boundaryType, widgetType, widgetName); > + } > + > + public static String formatBoundaryComment(String boundaryType, String widgetType, String widgetName) { > return "<!-- " + boundaryType + " " + widgetType + " " + widgetName + " -->" + whiteSpace; > } > > @@ -68,7 +75,7 @@ > */ > public void renderBeginningBoundaryComment(StringBuffer buffer, String widgetType, ModelWidget modelWidget) { > if (modelWidget.boundaryCommentsEnabled()) { > - buffer.append(buildBoundaryComment("Begin", widgetType, modelWidget.getBoundaryCommentName())); > + buffer.append(this.buildBoundaryComment("Begin", widgetType, modelWidget.getBoundaryCommentName())); > } > } > > @@ -80,7 +87,7 @@ > */ > public void renderBeginningBoundaryComment(Writer writer, String widgetType, ModelWidget modelWidget) throws IOException { > if (modelWidget.boundaryCommentsEnabled()) { > - writer.write(buildBoundaryComment("Begin", widgetType, modelWidget.getBoundaryCommentName())); > + writer.write(this.buildBoundaryComment("Begin", widgetType, modelWidget.getBoundaryCommentName())); > } > } > > @@ -92,7 +99,7 @@ > */ > public void renderEndingBoundaryComment(Writer writer, String widgetType, ModelWidget modelWidget) throws IOException { > if (modelWidget.boundaryCommentsEnabled()) { > - writer.write(buildBoundaryComment("End", widgetType, modelWidget.getBoundaryCommentName())); > + writer.write(this.buildBoundaryComment("End", widgetType, modelWidget.getBoundaryCommentName())); > } > } > > @@ -104,8 +111,7 @@ > */ > public void renderEndingBoundaryComment(StringBuffer buffer, String widgetType, ModelWidget modelWidget) { > if (modelWidget.boundaryCommentsEnabled()) { > - buffer.append(buildBoundaryComment("End", widgetType, modelWidget.getBoundaryCommentName())); > + buffer.append(this.buildBoundaryComment("End", widgetType, modelWidget.getBoundaryCommentName())); > } > } > - > } > > Modified: ofbiz/trunk/framework/widget/src/org/ofbiz/widget/screen/HtmlWidget.java > URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/widget/src/org/ofbiz/widget/screen/HtmlWidget.java?rev=644081&r1=644080&r2=644081&view=diff > ============================================================================== > --- ofbiz/trunk/framework/widget/src/org/ofbiz/widget/screen/HtmlWidget.java (original) > +++ ofbiz/trunk/framework/widget/src/org/ofbiz/widget/screen/HtmlWidget.java Wed Apr 2 14:53:06 2008 > @@ -91,11 +91,11 @@ > Map parameters = (Map) context.get("parameters"); > boolean insertWidgetBoundaryComments = ModelWidget.widgetBoundaryCommentsEnabled(parameters); > if (insertWidgetBoundaryComments) { > - writer.write(HtmlWidgetRenderer.buildBoundaryComment("Begin", "Template", location)); > + writer.write(HtmlWidgetRenderer.formatBoundaryComment("Begin", "Template", location)); > } > FreeMarkerWorker.renderTemplateAtLocation(location, context, writer); > if (insertWidgetBoundaryComments) { > - writer.write(HtmlWidgetRenderer.buildBoundaryComment("End", "Template", location)); > + writer.write(HtmlWidgetRenderer.formatBoundaryComment("End", "Template", location)); > } > } catch (IllegalArgumentException e) { > String errMsg = "Error rendering included template at location [" + location + "]: " + e.toString(); > @@ -209,4 +209,3 @@ > } > } > } > - > > Modified: ofbiz/trunk/framework/widget/src/org/ofbiz/widget/screen/ModelScreen.java > URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/widget/src/org/ofbiz/widget/screen/ModelScreen.java?rev=644081&r1=644080&r2=644081&view=diff > ============================================================================== > --- ofbiz/trunk/framework/widget/src/org/ofbiz/widget/screen/ModelScreen.java (original) > +++ ofbiz/trunk/framework/widget/src/org/ofbiz/widget/screen/ModelScreen.java Wed Apr 2 14:53:06 2008 > @@ -34,6 +34,7 @@ > import org.ofbiz.base.util.Debug; > import org.ofbiz.base.util.FileUtil; > import org.ofbiz.base.util.GeneralException; > +import org.ofbiz.base.util.UtilHttp; > import org.ofbiz.base.util.UtilValidate; > import org.ofbiz.base.util.UtilXml; > import org.ofbiz.base.util.string.FlexibleStringExpander; > @@ -290,38 +291,15 @@ > > if ("intra-app".equals(link.getUrlMode())) { > // look through all controller.xml files and find those with the request-uri referred to by the target > - int endOfRequestUri = target.length(); > - if (target.indexOf('?') > 0) { > - endOfRequestUri = target.indexOf('?'); > - } > - String requestUri = target.substring(0, endOfRequestUri); > - Debug.logInfo("In findRequestNamesLinkedtoInWidget have intra-app link with requestUri [" + requestUri + "]", module); > + String requestUri = UtilHttp.getRequestUriFromTarget(target); > > Set<String> controllerLocAndRequestSet = ConfigXMLReader.findControllerFilesWithRequest(requestUri, null); > allRequestNamesIncluded.addAll(controllerLocAndRequestSet); > // if (controllerLocAndRequestSet.size() > 0) Debug.logInfo("============== In findRequestNamesLinkedtoInWidget, controllerLocAndRequestSet: " + controllerLocAndRequestSet, module); > } else if ("inter-app".equals(link.getUrlMode())) { > - int firstChar = 0; > - if (target.charAt(0) == '/') firstChar = 1; > - int pathSep = target.indexOf('/', 1); > - String webappMountPoint = null; > - if (pathSep > 0) { > - // if not then no good, supposed to be a inter-app, but there is no path sep! will do general search with null and treat like an intra-app > - webappMountPoint = target.substring(firstChar, pathSep) + "/WEB-INF"; > - } > - > - int endOfRequestUri = target.length(); > - if (target.indexOf('?') > 0) { > - endOfRequestUri = target.indexOf('?'); > - } > - int slashBeforeRequestUri = target.lastIndexOf('/', endOfRequestUri); > - String requestUri = null; > - if (slashBeforeRequestUri < 0) { > - requestUri = target.substring(0, endOfRequestUri); > - } else { > - requestUri = target.substring(slashBeforeRequestUri, endOfRequestUri); > - } > - Debug.logInfo("In findRequestNamesLinkedtoInWidget have inter-app link with requestUri [" + requestUri + "]", module); > + String webappMountPoint = UtilHttp.getWebappMountPointFromTarget(target); > + if (webappMountPoint != null) webappMountPoint += "/WEB-INF"; > + String requestUri = UtilHttp.getRequestUriFromTarget(target); > > Set<String> controllerLocAndRequestSet = ConfigXMLReader.findControllerFilesWithRequest(requestUri, webappMountPoint); > allRequestNamesIncluded.addAll(controllerLocAndRequestSet); > > Modified: ofbiz/trunk/framework/widget/src/org/ofbiz/widget/screen/ScreenFopViewHandler.java > URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/widget/src/org/ofbiz/widget/screen/ScreenFopViewHandler.java?rev=644081&r1=644080&r2=644081&view=diff > ============================================================================== > --- ofbiz/trunk/framework/widget/src/org/ofbiz/widget/screen/ScreenFopViewHandler.java (original) > +++ ofbiz/trunk/framework/widget/src/org/ofbiz/widget/screen/ScreenFopViewHandler.java Wed Apr 2 14:53:06 2008 > @@ -73,14 +73,15 @@ > } > > // set the input source (XSL-FO) and generate the output stream of contentType > - Reader reader = new StringReader(writer.toString()); > - StreamSource src = new StreamSource(reader); > - if (Debug.verboseOn()) { > - Debug.logVerbose("Transforming the following xsl-fo template: " + writer.toString(), module); > + String screenOutString = writer.toString(); > + if (!screenOutString.startsWith("<?xml")) { > + screenOutString = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" + screenOutString; > } > + if (Debug.verboseOn()) Debug.logVerbose("XSL:FO Screen Output: " + screenOutString, module); > > + Reader reader = new StringReader(screenOutString); > + StreamSource src = new StreamSource(reader); > ByteArrayOutputStream out = new ByteArrayOutputStream(); > - > try { > Fop fop = ApacheFopWorker.createFopInstance(out, contentType); > ApacheFopWorker.transform(src, null, fop); > @@ -117,5 +118,4 @@ > throw new ViewHandlerException("Multiple errors rendering FOP", x); > } > } > - > } > > > AntWebsystems.com: Quality OFBiz services for competitive rates..... |
Sorry about that. I've had some partial work on extending the Artifact Info stuff in my sandbox for a few days and it got mixed in (or part of it anyway!) with the fixes to the screen rendering for XSL:FO files when the boundary comments are on. I've just committed the missing methods in rev 644149. -David On Apr 2, 2008, at 9:29 PM, Hans Bakker wrote: > With this update the compiler gives the following error: > > > [javac] Compiling 4 source files > to /home/hans/ofbiz/svn/framework/widget/build/classes > > [javac] /home/hans/ofbiz/svn/framework/widget/src/org/ofbiz/widget/ > screen/ModelScreen.java:294: cannot find symbol > [javac] symbol : method getRequestUriFromTarget(java.lang.String) > [javac] location: class org.ofbiz.base.util.UtilHttp > [javac] String requestUri = > UtilHttp.getRequestUriFromTarget(target); > [javac] ^ > > [javac] /home/hans/ofbiz/svn/framework/widget/src/org/ofbiz/widget/ > screen/ModelScreen.java:300: cannot find symbol > [javac] symbol : method > getWebappMountPointFromTarget(java.lang.String) > [javac] location: class org.ofbiz.base.util.UtilHttp > [javac] String webappMountPoint = > UtilHttp.getWebappMountPointFromTarget(target); > [javac] ^ > > [javac] /home/hans/ofbiz/svn/framework/widget/src/org/ofbiz/widget/ > screen/ModelScreen.java:302: cannot find symbol > [javac] symbol : method getRequestUriFromTarget(java.lang.String) > [javac] location: class org.ofbiz.base.util.UtilHttp > [javac] String requestUri = > UtilHttp.getRequestUriFromTarget(target); > [javac] ^ > [javac] Note: Some input files use unchecked or unsafe operations. > [javac] Note: Recompile with -Xlint:unchecked for details. > [javac] 3 errors > > > > > On Wed, 2008-04-02 at 21:53 +0000, [hidden email] wrote: >> Author: jonesde >> Date: Wed Apr 2 14:53:06 2008 >> New Revision: 644081 >> >> URL: http://svn.apache.org/viewvc?rev=644081&view=rev >> Log: >> Removed xml header from fo wrapper, it is now added by the view >> handler if not there already; fixes problem with >> widget.verbose=true; fixes problem with widget.verbose=true; >> various cleanups too >> >> Modified: >> ofbiz/trunk/framework/common/webcommon/includes/ >> reportTemplate.fo.ftl >> ofbiz/trunk/framework/common/webcommon/includes/simple.fo.ftl >> ofbiz/trunk/framework/widget/config/widget.properties >> ofbiz/trunk/framework/widget/src/org/ofbiz/widget/html/ >> HtmlWidgetRenderer.java >> ofbiz/trunk/framework/widget/src/org/ofbiz/widget/screen/ >> HtmlWidget.java >> ofbiz/trunk/framework/widget/src/org/ofbiz/widget/screen/ >> ModelScreen.java >> ofbiz/trunk/framework/widget/src/org/ofbiz/widget/screen/ >> ScreenFopViewHandler.java >> >> Modified: ofbiz/trunk/framework/common/webcommon/includes/ >> reportTemplate.fo.ftl >> URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/common/webcommon/includes/reportTemplate.fo.ftl?rev=644081&r1=644080&r2=644081&view=diff >> = >> = >> = >> = >> = >> = >> = >> = >> = >> ===================================================================== >> --- ofbiz/trunk/framework/common/webcommon/includes/ >> reportTemplate.fo.ftl (original) >> +++ ofbiz/trunk/framework/common/webcommon/includes/ >> reportTemplate.fo.ftl Wed Apr 2 14:53:06 2008 >> @@ -1,4 +1,3 @@ >> -<?xml version="1.0" encoding="UTF-8"?> >> <#-- >> Licensed to the Apache Software Foundation (ASF) under one >> or more contributor license agreements. See the NOTICE file >> >> Modified: ofbiz/trunk/framework/common/webcommon/includes/ >> simple.fo.ftl >> URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/common/webcommon/includes/simple.fo.ftl?rev=644081&r1=644080&r2=644081&view=diff >> = >> = >> = >> = >> = >> = >> = >> = >> = >> ===================================================================== >> --- ofbiz/trunk/framework/common/webcommon/includes/simple.fo.ftl >> (original) >> +++ ofbiz/trunk/framework/common/webcommon/includes/simple.fo.ftl >> Wed Apr 2 14:53:06 2008 >> @@ -1,4 +1,3 @@ >> -<?xml version="1.0" encoding="UTF-8"?> >> <#-- >> Licensed to the Apache Software Foundation (ASF) under one >> or more contributor license agreements. See the NOTICE file >> >> Modified: ofbiz/trunk/framework/widget/config/widget.properties >> URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/widget/config/widget.properties?rev=644081&r1=644080&r2=644081&view=diff >> = >> = >> = >> = >> = >> = >> = >> = >> = >> ===================================================================== >> --- ofbiz/trunk/framework/widget/config/widget.properties (original) >> +++ ofbiz/trunk/framework/widget/config/widget.properties Wed Apr >> 2 14:53:06 2008 >> @@ -22,3 +22,4 @@ >> >> # Enable screen widget boundary comments >> widget.verbose=true >> + >> >> Modified: ofbiz/trunk/framework/widget/src/org/ofbiz/widget/html/ >> HtmlWidgetRenderer.java >> URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/widget/src/org/ofbiz/widget/html/HtmlWidgetRenderer.java?rev=644081&r1=644080&r2=644081&view=diff >> = >> = >> = >> = >> = >> = >> = >> = >> = >> ===================================================================== >> --- ofbiz/trunk/framework/widget/src/org/ofbiz/widget/html/ >> HtmlWidgetRenderer.java (original) >> +++ ofbiz/trunk/framework/widget/src/org/ofbiz/widget/html/ >> HtmlWidgetRenderer.java Wed Apr 2 14:53:06 2008 >> @@ -20,6 +20,8 @@ >> >> import java.io.IOException; >> import java.io.Writer; >> + >> +import org.ofbiz.base.util.Debug; >> import org.ofbiz.widget.ModelWidget; >> >> /** >> @@ -27,6 +29,7 @@ >> * is a base class that is extended by other widget HTML rendering >> classes. >> */ >> public class HtmlWidgetRenderer { >> + public static final String module = >> HtmlWidgetRenderer.class.getName(); >> >> /** >> * Characters that are appended to the end of each rendered >> element. Currently set to >> @@ -38,7 +41,7 @@ >> * Helper method used to append whitespace characters to the >> end of each rendered element. >> * @param writer The writer to write to >> */ >> - public static void appendWhitespace(Writer writer) throws >> IOException { >> + public void appendWhitespace(Writer writer) throws IOException { >> writer.write(whiteSpace); >> } >> >> @@ -46,7 +49,7 @@ >> * Helper method used to append whitespace characters to the >> end of each rendered element. >> * @param buffer The buffer to write to >> */ >> - public static void appendWhitespace(StringBuffer buffer) { >> + public void appendWhitespace(StringBuffer buffer) { >> buffer.append(whiteSpace); >> } >> >> @@ -56,7 +59,11 @@ >> * @param widgetType The widget type: "Screen Widget", "Form >> Widget", etc. >> * @param widgetName The widget name >> */ >> - public static String buildBoundaryComment(String boundaryType, >> String widgetType, String widgetName) { >> + public String buildBoundaryComment(String boundaryType, String >> widgetType, String widgetName) { >> + return formatBoundaryComment(boundaryType, widgetType, >> widgetName); >> + } >> + >> + public static String formatBoundaryComment(String >> boundaryType, String widgetType, String widgetName) { >> return "<!-- " + boundaryType + " " + widgetType + " " + >> widgetName + " -->" + whiteSpace; >> } >> >> @@ -68,7 +75,7 @@ >> */ >> public void renderBeginningBoundaryComment(StringBuffer buffer, >> String widgetType, ModelWidget modelWidget) { >> if (modelWidget.boundaryCommentsEnabled()) { >> - buffer.append(buildBoundaryComment("Begin", >> widgetType, modelWidget.getBoundaryCommentName())); >> + buffer.append(this.buildBoundaryComment("Begin", >> widgetType, modelWidget.getBoundaryCommentName())); >> } >> } >> >> @@ -80,7 +87,7 @@ >> */ >> public void renderBeginningBoundaryComment(Writer writer, >> String widgetType, ModelWidget modelWidget) throws IOException { >> if (modelWidget.boundaryCommentsEnabled()) { >> - writer.write(buildBoundaryComment("Begin", widgetType, >> modelWidget.getBoundaryCommentName())); >> + writer.write(this.buildBoundaryComment("Begin", >> widgetType, modelWidget.getBoundaryCommentName())); >> } >> } >> >> @@ -92,7 +99,7 @@ >> */ >> public void renderEndingBoundaryComment(Writer writer, String >> widgetType, ModelWidget modelWidget) throws IOException { >> if (modelWidget.boundaryCommentsEnabled()) { >> - writer.write(buildBoundaryComment("End", widgetType, >> modelWidget.getBoundaryCommentName())); >> + writer.write(this.buildBoundaryComment("End", >> widgetType, modelWidget.getBoundaryCommentName())); >> } >> } >> >> @@ -104,8 +111,7 @@ >> */ >> public void renderEndingBoundaryComment(StringBuffer buffer, >> String widgetType, ModelWidget modelWidget) { >> if (modelWidget.boundaryCommentsEnabled()) { >> - buffer.append(buildBoundaryComment("End", widgetType, >> modelWidget.getBoundaryCommentName())); >> + buffer.append(this.buildBoundaryComment("End", >> widgetType, modelWidget.getBoundaryCommentName())); >> } >> } >> - >> } >> >> Modified: ofbiz/trunk/framework/widget/src/org/ofbiz/widget/screen/ >> HtmlWidget.java >> URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/widget/src/org/ofbiz/widget/screen/HtmlWidget.java?rev=644081&r1=644080&r2=644081&view=diff >> = >> = >> = >> = >> = >> = >> = >> = >> = >> ===================================================================== >> --- ofbiz/trunk/framework/widget/src/org/ofbiz/widget/screen/ >> HtmlWidget.java (original) >> +++ ofbiz/trunk/framework/widget/src/org/ofbiz/widget/screen/ >> HtmlWidget.java Wed Apr 2 14:53:06 2008 >> @@ -91,11 +91,11 @@ >> Map parameters = (Map) context.get("parameters"); >> boolean insertWidgetBoundaryComments = >> ModelWidget.widgetBoundaryCommentsEnabled(parameters); >> if (insertWidgetBoundaryComments) { >> - >> writer.write(HtmlWidgetRenderer.buildBoundaryComment("Begin", >> "Template", location)); >> + >> writer.write(HtmlWidgetRenderer.formatBoundaryComment("Begin", >> "Template", location)); >> } >> FreeMarkerWorker.renderTemplateAtLocation(location, >> context, writer); >> if (insertWidgetBoundaryComments) { >> - >> writer.write(HtmlWidgetRenderer.buildBoundaryComment("End", >> "Template", location)); >> + >> writer.write(HtmlWidgetRenderer.formatBoundaryComment("End", >> "Template", location)); >> } >> } catch (IllegalArgumentException e) { >> String errMsg = "Error rendering included template >> at location [" + location + "]: " + e.toString(); >> @@ -209,4 +209,3 @@ >> } >> } >> } >> - >> >> Modified: ofbiz/trunk/framework/widget/src/org/ofbiz/widget/screen/ >> ModelScreen.java >> URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/widget/src/org/ofbiz/widget/screen/ModelScreen.java?rev=644081&r1=644080&r2=644081&view=diff >> = >> = >> = >> = >> = >> = >> = >> = >> = >> ===================================================================== >> --- ofbiz/trunk/framework/widget/src/org/ofbiz/widget/screen/ >> ModelScreen.java (original) >> +++ ofbiz/trunk/framework/widget/src/org/ofbiz/widget/screen/ >> ModelScreen.java Wed Apr 2 14:53:06 2008 >> @@ -34,6 +34,7 @@ >> import org.ofbiz.base.util.Debug; >> import org.ofbiz.base.util.FileUtil; >> import org.ofbiz.base.util.GeneralException; >> +import org.ofbiz.base.util.UtilHttp; >> import org.ofbiz.base.util.UtilValidate; >> import org.ofbiz.base.util.UtilXml; >> import org.ofbiz.base.util.string.FlexibleStringExpander; >> @@ -290,38 +291,15 @@ >> >> if ("intra-app".equals(link.getUrlMode())) { >> // look through all controller.xml files and find >> those with the request-uri referred to by the target >> - int endOfRequestUri = target.length(); >> - if (target.indexOf('?') > 0) { >> - endOfRequestUri = target.indexOf('?'); >> - } >> - String requestUri = target.substring(0, >> endOfRequestUri); >> - Debug.logInfo("In findRequestNamesLinkedtoInWidget >> have intra-app link with requestUri [" + requestUri + "]", module); >> + String requestUri = >> UtilHttp.getRequestUriFromTarget(target); >> >> Set<String> controllerLocAndRequestSet = >> ConfigXMLReader.findControllerFilesWithRequest(requestUri, null); >> >> allRequestNamesIncluded.addAll(controllerLocAndRequestSet); >> // if (controllerLocAndRequestSet.size() > 0) >> Debug.logInfo("============== In findRequestNamesLinkedtoInWidget, >> controllerLocAndRequestSet: " + controllerLocAndRequestSet, module); >> } else if ("inter-app".equals(link.getUrlMode())) { >> - int firstChar = 0; >> - if (target.charAt(0) == '/') firstChar = 1; >> - int pathSep = target.indexOf('/', 1); >> - String webappMountPoint = null; >> - if (pathSep > 0) { >> - // if not then no good, supposed to be a inter- >> app, but there is no path sep! will do general search with null and >> treat like an intra-app >> - webappMountPoint = target.substring(firstChar, >> pathSep) + "/WEB-INF"; >> - } >> - >> - int endOfRequestUri = target.length(); >> - if (target.indexOf('?') > 0) { >> - endOfRequestUri = target.indexOf('?'); >> - } >> - int slashBeforeRequestUri = >> target.lastIndexOf('/', endOfRequestUri); >> - String requestUri = null; >> - if (slashBeforeRequestUri < 0) { >> - requestUri = target.substring(0, >> endOfRequestUri); >> - } else { >> - requestUri = >> target.substring(slashBeforeRequestUri, endOfRequestUri); >> - } >> - Debug.logInfo("In findRequestNamesLinkedtoInWidget >> have inter-app link with requestUri [" + requestUri + "]", module); >> + String webappMountPoint = >> UtilHttp.getWebappMountPointFromTarget(target); >> + if (webappMountPoint != null) webappMountPoint += >> "/WEB-INF"; >> + String requestUri = >> UtilHttp.getRequestUriFromTarget(target); >> >> Set<String> controllerLocAndRequestSet = >> ConfigXMLReader.findControllerFilesWithRequest(requestUri, >> webappMountPoint); >> >> allRequestNamesIncluded.addAll(controllerLocAndRequestSet); >> >> Modified: ofbiz/trunk/framework/widget/src/org/ofbiz/widget/screen/ >> ScreenFopViewHandler.java >> URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/widget/src/org/ofbiz/widget/screen/ScreenFopViewHandler.java?rev=644081&r1=644080&r2=644081&view=diff >> = >> = >> = >> = >> = >> = >> = >> = >> = >> ===================================================================== >> --- ofbiz/trunk/framework/widget/src/org/ofbiz/widget/screen/ >> ScreenFopViewHandler.java (original) >> +++ ofbiz/trunk/framework/widget/src/org/ofbiz/widget/screen/ >> ScreenFopViewHandler.java Wed Apr 2 14:53:06 2008 >> @@ -73,14 +73,15 @@ >> } >> >> // set the input source (XSL-FO) and generate the output >> stream of contentType >> - Reader reader = new StringReader(writer.toString()); >> - StreamSource src = new StreamSource(reader); >> - if (Debug.verboseOn()) { >> - Debug.logVerbose("Transforming the following xsl-fo >> template: " + writer.toString(), module); >> + String screenOutString = writer.toString(); >> + if (!screenOutString.startsWith("<?xml")) { >> + screenOutString = "<?xml version=\"1.0\" encoding= >> \"UTF-8\"?>\n" + screenOutString; >> } >> + if (Debug.verboseOn()) Debug.logVerbose("XSL:FO Screen >> Output: " + screenOutString, module); >> >> + Reader reader = new StringReader(screenOutString); >> + StreamSource src = new StreamSource(reader); >> ByteArrayOutputStream out = new ByteArrayOutputStream(); >> - >> try { >> Fop fop = ApacheFopWorker.createFopInstance(out, >> contentType); >> ApacheFopWorker.transform(src, null, fop); >> @@ -117,5 +118,4 @@ >> throw new ViewHandlerException("Multiple errors >> rendering FOP", x); >> } >> } >> - >> } >> >> >> > -- > AntWebsystems.com: Quality OFBiz services for competitive rates..... > |
Free forum by Nabble | Edit this page |