- Revision
- 262
- Author
- fabio.kung
- Date
- 2007-07-13 16:00:17 -0500 (Fri, 13 Jul 2007)
Log Message
removed jakarta standard dependency
Modified Paths
- trunk/extensions/taglib/pom.xml
- trunk/extensions/taglib/src/main/java/org/codehaus/waffle/taglib/form/CalendarTag.java
- trunk/extensions/taglib/src/main/java/org/codehaus/waffle/taglib/form/DateTag.java
- trunk/extensions/taglib/src/main/java/org/codehaus/waffle/taglib/form/TimeTag.java
- trunk/extensions/taglib/src/main/java/org/codehaus/waffle/taglib/internal/BasicTag.java
- trunk/extensions/taglib/src/main/resources/META-INF/waffle.tld
- trunk/extensions/taglib-acceptance/pom.xml
Added Paths
- trunk/extensions/taglib/src/main/java/org/apache/taglibs/standard/tag/common/fmt/LocaleSupport.java
- trunk/extensions/taglib-acceptance/resources/
Removed Paths
Diff
Modified: trunk/extensions/taglib/pom.xml (261 => 262)
--- trunk/extensions/taglib/pom.xml 2007-07-13 18:19:44 UTC (rev 261) +++ trunk/extensions/taglib/pom.xml 2007-07-13 21:00:17 UTC (rev 262) @@ -30,7 +30,7 @@ <dependency> <groupId>taglibs</groupId> <artifactId>standard</artifactId> - <scope>compile</scope> + <scope>runtime</scope> </dependency> </dependencies>
Deleted: trunk/extensions/taglib/src/main/java/org/apache/taglibs/standard/tag/common/fmt/DateSupport.java (261 => 262)
--- trunk/extensions/taglib/src/main/java/org/apache/taglibs/standard/tag/common/fmt/DateSupport.java 2007-07-13 18:19:44 UTC (rev 261) +++ trunk/extensions/taglib/src/main/java/org/apache/taglibs/standard/tag/common/fmt/DateSupport.java 2007-07-13 21:00:17 UTC (rev 262) @@ -1,20 +0,0 @@ -package org.apache.taglibs.standard.tag.common.fmt; - -import org.codehaus.waffle.taglib.form.TimeTag; -import org.codehaus.waffle.taglib.form.DateTag; - -import java.util.Locale; - -import javax.servlet.jsp.PageContext; - -public class DateSupport { - - public static Locale getFormattingLocale(PageContext pc, DateTag fromTag, boolean format, Locale[] avail) { - return SetLocaleSupport.getFormattingLocale(pc, fromTag, format, avail); - } - - public static Locale getFormattingLocale(PageContext pc, TimeTag fromTag, boolean format, Locale[] avail) { - return SetLocaleSupport.getFormattingLocale(pc, fromTag, format, avail); - } - -}
Copied: trunk/extensions/taglib/src/main/java/org/apache/taglibs/standard/tag/common/fmt/LocaleSupport.java (from rev 257, trunk/extensions/taglib/src/main/java/org/apache/taglibs/standard/tag/common/fmt/DateSupport.java) (0 => 262)
--- trunk/extensions/taglib/src/main/java/org/apache/taglibs/standard/tag/common/fmt/LocaleSupport.java (rev 0) +++ trunk/extensions/taglib/src/main/java/org/apache/taglibs/standard/tag/common/fmt/LocaleSupport.java 2007-07-13 21:00:17 UTC (rev 262) @@ -0,0 +1,57 @@ +package org.apache.taglibs.standard.tag.common.fmt; + +import javax.servlet.jsp.PageContext; +import javax.servlet.jsp.jstl.core.Config; +import java.util.Locale; + +public class LocaleSupport { + + public Locale getFormattingLocale(PageContext pc) { + Object configuredLocale = Config.find(pc, Config.FMT_LOCALE); + if (configuredLocale == null) { + configuredLocale = Config.find(pc, Config.FMT_FALLBACK_LOCALE); + } + if (configuredLocale instanceof Locale) { + return (Locale) configuredLocale; + } else if (configuredLocale instanceof String) { + return stringToLocale((String) configuredLocale); + } else { + return pc.getRequest().getLocale(); + } + + } + + /** + * Extracted from XStream project, copyright Joe Walnes + * + * @param str the string to convert + * @return the locale + */ + private Locale stringToLocale(String str) { + int[] underscorePositions = underscorePositions(str); + String language, country, variant; + if (underscorePositions[0] == -1) { // "language" + language = str; + country = ""; + variant = ""; + } else if (underscorePositions[1] == -1) { // "language_country" + language = str.substring(0, underscorePositions[0]); + country = str.substring(underscorePositions[0] + 1); + variant = ""; + } else { // "language_country_variant" + language = str.substring(0, underscorePositions[0]); + country = str.substring(underscorePositions[0] + 1, underscorePositions[1]); + variant = str.substring(underscorePositions[1] + 1); + } + return new Locale(language, country, variant); + } + + private int[] underscorePositions(String in) { + int[] result = new int[2]; + for (int i = 0; i < result.length; i++) { + int last = i == 0 ? 0 : result[i - 1]; + result[i] = in.indexOf('_', last + 1); + } + return result; + } +}
Modified: trunk/extensions/taglib/src/main/java/org/codehaus/waffle/taglib/form/CalendarTag.java (261 => 262)
--- trunk/extensions/taglib/src/main/java/org/codehaus/waffle/taglib/form/CalendarTag.java 2007-07-13 18:19:44 UTC (rev 261) +++ trunk/extensions/taglib/src/main/java/org/codehaus/waffle/taglib/form/CalendarTag.java 2007-07-13 21:00:17 UTC (rev 262) @@ -1,14 +1,12 @@ package org.codehaus.waffle.taglib.form; +import javax.servlet.jsp.JspException; +import javax.servlet.jsp.el.ELException; import java.io.IOException; import java.io.Writer; import java.text.SimpleDateFormat; import java.util.Date; -import javax.servlet.jsp.JspException; -import javax.servlet.jsp.el.ELException; -import org.apache.taglibs.standard.lang.support.ExpressionEvaluatorManager; - /** * An calendar element for html files. * @@ -55,17 +53,19 @@ } // Evaluates expressions as necessary - private void evaluateExpressions() throws JspException { - - pattern = (String) ExpressionEvaluatorManager.evaluate("pattern", pattern, String.class, this, pageContext); + private void evaluateExpressions() throws ELException { + pattern = (String) pageContext.getExpressionEvaluator().evaluate(pattern, String.class, pageContext.getVariableResolver(), null); } // evaluates _expression_ and chains to parent @Override public int doStartTag() throws JspException { - // evaluate any expressions we were passed, once per invocation - evaluateExpressions(); + try { + evaluateExpressions(); + } catch (ELException e) { + throw new JspException(e); + } // chain to the parent implementation return super.doStartTag();
Modified: trunk/extensions/taglib/src/main/java/org/codehaus/waffle/taglib/form/DateTag.java (261 => 262)
--- trunk/extensions/taglib/src/main/java/org/codehaus/waffle/taglib/form/DateTag.java 2007-07-13 18:19:44 UTC (rev 261) +++ trunk/extensions/taglib/src/main/java/org/codehaus/waffle/taglib/form/DateTag.java 2007-07-13 21:00:17 UTC (rev 262) @@ -1,5 +1,10 @@ package org.codehaus.waffle.taglib.form; +import org.apache.taglibs.standard.tag.common.fmt.LocaleSupport; + +import javax.servlet.jsp.JspException; +import javax.servlet.jsp.el.ELException; +import javax.servlet.jsp.el.ExpressionEvaluator; import java.io.IOException; import java.io.Writer; import java.text.DateFormat; @@ -7,13 +12,6 @@ import java.util.Date; import java.util.Locale; -import javax.servlet.jsp.JspException; -import javax.servlet.jsp.el.ELException; - -import org.apache.taglibs.standard.lang.support.ExpressionEvaluatorManager; -import org.apache.taglibs.standard.resources.Resources; -import org.apache.taglibs.standard.tag.common.fmt.DateSupport; - /** * An date element for html files. * @@ -34,9 +32,11 @@ private static final String FULL = "full"; private static final String DEFAULT = "default"; - - private String name, pattern, dateStyle; + private final LocaleSupport localeSupport = new LocaleSupport(); + + private String name, pattern, dateStyle; + private Date value; @Override @@ -69,29 +69,32 @@ } // Evaluates expressions as necessary - private void evaluateExpressions() throws JspException { + private void evaluateExpressions() throws ELException { - // 'dateStyle' attribute - if (dateStyle != null) { - dateStyle = (String) ExpressionEvaluatorManager.evaluate( - "dateStyle", dateStyle, String.class, this, pageContext); - } + ExpressionEvaluator evaluator = pageContext.getExpressionEvaluator(); + // 'dateStyle' attribute + if (dateStyle != null) { + dateStyle = (String) evaluator.evaluate(dateStyle, String.class, pageContext.getVariableResolver(), null); + } - // 'pattern' attribute - if (pattern != null) { - pattern = (String) ExpressionEvaluatorManager.evaluate("pattern", - pattern, String.class, this, pageContext); - } - } + // 'pattern' attribute + if (pattern != null) { + pattern = (String) evaluator.evaluate(pattern, String.class, pageContext.getVariableResolver(), null); + } + } // evaluates _expression_ and chains to parent @Override public int doStartTag() throws JspException { // evaluate any expressions we were passed, once per invocation - evaluateExpressions(); + try { + evaluateExpressions(); + } catch (ELException e) { + throw new JspException(e); + } - // chain to the parent implementation + // chain to the parent implementation return super.doStartTag(); } @@ -134,8 +137,7 @@ String formatted = null; - Locale locale = DateSupport.getFormattingLocale(pageContext, this, - true, DateFormat.getAvailableLocales()); + Locale locale = this.localeSupport.getFormattingLocale(pageContext); if (locale != null) { // Create formatter @@ -160,8 +162,7 @@ } private DateFormat createFormatter(Locale locale) throws JspException { - return DateFormat.getDateInstance(getStyle(dateStyle, - "FORMAT_DATE_INVALID_DATE_STYLE"), locale); + return DateFormat.getDateInstance(getStyle(dateStyle), locale); } /* @@ -175,7 +176,7 @@ * * @throws JspException if the given style is invalid */ - private int getStyle(String style, String errCode) throws JspException { + private int getStyle(String style) throws JspException { int ret = DateFormat.DEFAULT; if (style != null) { @@ -190,7 +191,7 @@ } else if (FULL.equalsIgnoreCase(style)) { ret = DateFormat.FULL; } else { - throw new JspException(Resources.getMessage(errCode, style)); + throw new JspException("Invalid date style"); } }
Modified: trunk/extensions/taglib/src/main/java/org/codehaus/waffle/taglib/form/TimeTag.java (261 => 262)
--- trunk/extensions/taglib/src/main/java/org/codehaus/waffle/taglib/form/TimeTag.java 2007-07-13 18:19:44 UTC (rev 261) +++ trunk/extensions/taglib/src/main/java/org/codehaus/waffle/taglib/form/TimeTag.java 2007-07-13 21:00:17 UTC (rev 262) @@ -1,5 +1,10 @@ package org.codehaus.waffle.taglib.form; +import org.apache.taglibs.standard.tag.common.fmt.LocaleSupport; + +import javax.servlet.jsp.JspException; +import javax.servlet.jsp.el.ELException; +import javax.servlet.jsp.el.ExpressionEvaluator; import java.io.IOException; import java.io.Writer; import java.text.DateFormat; @@ -7,201 +12,176 @@ import java.util.Date; import java.util.Locale; -import javax.servlet.jsp.JspException; -import javax.servlet.jsp.el.ELException; - -import org.apache.taglibs.standard.lang.support.ExpressionEvaluatorManager; -import org.apache.taglibs.standard.resources.Resources; -import org.apache.taglibs.standard.tag.common.fmt.DateSupport; - /** * An text element for html files. - * + * * @author Nico Steppat */ public class TimeTag extends FormElement { - // ********************************************************************* - // Private constants - private static final String SHORT = "short"; private static final String MEDIUM = "medium"; private static final String LONG = "long"; private static final String FULL = "full"; private static final String DEFAULT = "default"; - private String name, pattern, timeStyle; + private final LocaleSupport localeSupport = new LocaleSupport(); + + private String name, pattern, timeStyle; private Date value; @Override public void release() { - super.release(); - name = pattern = timeStyle = null; - value = null; + super.release(); + name = pattern = timeStyle = null; + value = null; } public void setName(String name) { - this.name = name; + this.name = name; } public void setPattern(String pattern) { - this.pattern = pattern; + this.pattern = pattern; } public void setTimeStyle(String style) { - this.timeStyle = style; + this.timeStyle = style; } public void setValue(Date value) { - this.value = value; + this.value = value; } // Evaluates expressions as necessary - private void evaluateExpressions() throws JspException { - /* - * Note: we don't check for type mismatches here; we assume the - * _expression_ evaluator will return the expected type (by virtue of - * knowledge we give it about what that type is). A ClassCastException - * here is truly unexpected, so we let it propagate up. - */ - - // 'value' attribute - // TODO check how the ExpressionEvaluatorManager evaluates the date () - /* - * if (value != null) { value= (Date) - * ExpressionEvaluatorManager.evaluate("value", value, Date.class, this, - * pageContext); } - */ - - // 'dateStyle' attribute - if (timeStyle != null) { - timeStyle = (String) ExpressionEvaluatorManager.evaluate("dateStyle", timeStyle, String.class, this, pageContext); - } - - // 'pattern' attribute - if (pattern != null) { - pattern = (String) ExpressionEvaluatorManager.evaluate("pattern", pattern, String.class, this, pageContext); - } + private void evaluateExpressions() throws ELException { + // 'dateStyle' attribute + ExpressionEvaluator evaluator = pageContext.getExpressionEvaluator(); + if (timeStyle != null) { + timeStyle = (String) evaluator.evaluate(timeStyle, String.class, pageContext.getVariableResolver(), null); + } + // 'pattern' attribute + if (pattern != null) { + pattern = (String) evaluator.evaluate(pattern, String.class, pageContext.getVariableResolver(), null); + } } // evaluates _expression_ and chains to parent @Override public int doStartTag() throws JspException { - - // evaluate any expressions we were passed, once per invocation - evaluateExpressions(); - - // chain to the parent implementation - return super.doStartTag(); + // evaluate any expressions we were passed, once per invocation + try { + evaluateExpressions(); + } catch (ELException e) { + throw new JspException(e); + } + // chain to the parent implementation + return super.doStartTag(); } @Override public IterationResult start(Writer out) throws JspException, IOException { + out.write("<input type=\""); + out.write(getType()); + out.write("\" name=\""); + out.write(name); + out.write("\" "); + out.write("value=\""); + if (this.value != null) { + out.write(getFormattedDate()); + } else if (pageContext.getAttribute(this.name) != null) { - out.write("<input type=\""); - out.write(getType()); - out.write("\" name=\""); - out.write(name); - out.write("\" "); - out.write("value=\""); - if (this.value != null) { - out.write(getFormattedDate()); - } else if (pageContext.getAttribute(this.name) != null) { - - Date data = "" + this.name + "}"); - this.setValue(data); - out.write(getFormattedDate()); - } - out.write("\""); - attributes.outputTo(out); - out.write("/>"); - release(); - return IterationResult.BODY; + Date data = "" + this.name + "}"); + this.setValue(data); + out.write(getFormattedDate()); + } + out.write("\""); + attributes.outputTo(out); + out.write("/>"); + release(); + return IterationResult.BODY; } private Date evaluateDate(String _expression_) throws JspException { - try { - return (Date) pageContext.getExpressionEvaluator().evaluate(_expression_, Date.class, - pageContext.getVariableResolver(), null); - } catch (ELException e) { - throw new JspException(e); - } + try { + return (Date) pageContext.getExpressionEvaluator().evaluate(_expression_, Date.class, + pageContext.getVariableResolver(), null); + } catch (ELException e) { + throw new JspException(e); + } } private String getFormattedDate() throws JspException { - String formatted = null; + String formatted; - Locale locale = DateSupport.getFormattingLocale(pageContext, this, true, DateFormat.getAvailableLocales()); - // Locale locale = new Locale("pt"); + Locale locale = this.localeSupport.getFormattingLocale(pageContext); - if (locale != null) { - // Create formatter - DateFormat formatter = createFormatter(locale); + if (locale != null) { + // Create formatter + DateFormat formatter = createFormatter(locale); - // Apply pattern, if present - if (pattern != null) { - try { - ((SimpleDateFormat) formatter).applyPattern(pattern); - } catch (ClassCastException cce) { - formatter = new SimpleDateFormat(pattern, locale); - } - } + // Apply pattern, if present + if (pattern != null) { + try { + ((SimpleDateFormat) formatter).applyPattern(pattern); + } catch (ClassCastException cce) { + formatter = new SimpleDateFormat(pattern, locale); + } + } - formatted = formatter.format(value); - } else { - // no formatting locale available, use Date.toString() - formatted = value.toString(); - } + formatted = formatter.format(value); + } else { + // no formatting locale available, use Date.toString() + formatted = value.toString(); + } - return formatted; + return formatted; } private DateFormat createFormatter(Locale locale) throws JspException { - return DateFormat.getTimeInstance(getStyle(timeStyle, "FORMAT_DATE_INVALID_DATE_STYLE"), locale); + return DateFormat.getTimeInstance(getStyle(timeStyle), locale); } - /* - * Converts the given string description of a formatting style for dates - * and times to the corresponding java.util.DateFormat constant. - * - * @param style String description of formatting style for dates and - * times @param errCode Error code to throw if given style is invalid - * - * @return java.util.DateFormat constant corresponding to given style - * - * @throws JspException if the given style is invalid - */ - private int getStyle(String style, String errCode) throws JspException { - int ret = DateFormat.DEFAULT; + /** + * Converts the given string description of a formatting style for dates + * and times to the corresponding java.util.DateFormat constant. + * + * @param style String description of formatting style for dates and + * times @param errCode Error code to throw if given style is invalid + * @return java.util.DateFormat constant corresponding to given style + * @throws JspException if the given style is invalid + */ + private int getStyle(String style) throws JspException { + int ret = DateFormat.DEFAULT; - if (style != null) { - if (DEFAULT.equalsIgnoreCase(style)) { - ret = DateFormat.DEFAULT; - } else if (SHORT.equalsIgnoreCase(style)) { - ret = DateFormat.SHORT; - } else if (MEDIUM.equalsIgnoreCase(style)) { - ret = DateFormat.MEDIUM; - } else if (LONG.equalsIgnoreCase(style)) { - ret = DateFormat.LONG; - } else if (FULL.equalsIgnoreCase(style)) { - ret = DateFormat.FULL; - } else { - throw new JspException(Resources.getMessage(errCode, style)); - } - } + if (style != null) { + if (DEFAULT.equalsIgnoreCase(style)) { + ret = DateFormat.DEFAULT; + } else if (SHORT.equalsIgnoreCase(style)) { + ret = DateFormat.SHORT; + } else if (MEDIUM.equalsIgnoreCase(style)) { + ret = DateFormat.MEDIUM; + } else if (LONG.equalsIgnoreCase(style)) { + ret = DateFormat.LONG; + } else if (FULL.equalsIgnoreCase(style)) { + ret = DateFormat.FULL; + } else { + throw new JspException("Invalid time style"); + } + } - return ret; + return ret; } protected String getType() { - return "text"; + return "text"; } @Override protected String getDefaultLabel() { - return name; + return name; } }
Modified: trunk/extensions/taglib/src/main/java/org/codehaus/waffle/taglib/internal/BasicTag.java (261 => 262)
--- trunk/extensions/taglib/src/main/java/org/codehaus/waffle/taglib/internal/BasicTag.java 2007-07-13 18:19:44 UTC (rev 261) +++ trunk/extensions/taglib/src/main/java/org/codehaus/waffle/taglib/internal/BasicTag.java 2007-07-13 21:00:17 UTC (rev 262) @@ -1,248 +1,222 @@ package org.codehaus.waffle.taglib.internal; -import java.io.IOException; -import java.io.Writer; -import java.util.MissingResourceException; -import java.util.ResourceBundle; +import org.codehaus.waffle.taglib.form.IterationResult; +import javax.servlet.http.HttpServletRequest; import javax.servlet.jsp.JspException; import javax.servlet.jsp.JspWriter; import javax.servlet.jsp.PageContext; import javax.servlet.jsp.el.ELException; -import javax.servlet.jsp.jstl.fmt.LocalizationContext; +import javax.servlet.jsp.jstl.fmt.LocaleSupport; import javax.servlet.jsp.tagext.BodyContent; import javax.servlet.jsp.tagext.BodyTag; import javax.servlet.jsp.tagext.Tag; +import java.io.IOException; +import java.io.Writer; -import org.apache.taglibs.standard.tag.common.core.UrlSupport; -import org.apache.taglibs.standard.tag.common.fmt.BundleSupport; -import org.apache.taglibs.standard.tag.common.fmt.MessageSupport; - -import org.codehaus.waffle.taglib.form.IterationResult; - /** * A basic tag. This class has been created in order to be extended. - * + * * @author Guilherme Silveira * @author Nico Steppat */ public abstract class BasicTag implements BodyTag { - private Tag parent; + private Tag parent; - protected PageContext pageContext; + protected PageContext pageContext; - private BodyContent bodyContent; + private BodyContent bodyContent; - /** - * If true, the FormElement will be rendered. - */ - private boolean rendered; - - public BasicTag() { - release(); - } + /** + * If true, the FormElement will be rendered. + */ + private boolean rendered; - /** - * Searchs a parent tag that implements the selected type. - * - * @param <T> - * the type to search - * @param type - * the class type to search - * @return the tag found or null if not found - */ - @SuppressWarnings("unchecked") - protected <T> T findAncestor(Class<T> type) { - Tag current = parent; - while (current != null && !type.isAssignableFrom(current.getClass())) { - current = current.getParent(); - } - return (T) current; - } + public BasicTag() { + release(); + } - public Tag getParent() { - return parent; - } + /** + * Searchs a parent tag that implements the selected type. + * + * @param <T> the type to search + * @param type the class type to search + * @return the tag found or null if not found + */ + @SuppressWarnings("unchecked") + protected <T> T findAncestor(Class<T> type) { + Tag current = parent; + while (current != null && !type.isAssignableFrom(current.getClass())) { + current = current.getParent(); + } + return (T) current; + } - public void setRendered(boolean rendered) { - this.rendered = rendered; + public Tag getParent() { + return parent; + } - } + public void setRendered(boolean rendered) { + this.rendered = rendered; - public void release() { - /*parent = null; - pageContext = null;*/ - rendered = true; - } + } - public void setPageContext(PageContext pageContext) { - this.pageContext = pageContext; - } + public void release() { + /*parent = null; + pageContext = null;*/ + rendered = true; + } - public void setParent(Tag parent) { - this.parent = parent; - } + public void setPageContext(PageContext pageContext) { + this.pageContext = pageContext; + } - /** - * Returns the i18n message for some key - * - * @param key - * the key to search for - * @return the i18n message - */ - public String getI18NMessage(String key) { - if (key == null || key.equals("")) { - return ""; - } - LocalizationContext locCtxt = getLocalizationContext(); + public void setParent(Tag parent) { + this.parent = parent; + } - if (locCtxt != null) { - ResourceBundle bundle = locCtxt.getResourceBundle(); - if (bundle != null) { - try { - return bundle.getString(key); - } catch (MissingResourceException mre) { - return MessageSupport.UNDEFINED_KEY + key - + MessageSupport.UNDEFINED_KEY; - } - } - } - return MessageSupport.UNDEFINED_KEY + key - + MessageSupport.UNDEFINED_KEY; - } + /** + * Returns the i18n message for some key + * + * @param key the key to search for + * @return the i18n message + */ + public String getI18NMessage(String key) { + if (key == null || key.equals("")) { + return ""; + } + return LocaleSupport.getLocalizedMessage(pageContext, key); + } - protected LocalizationContext getLocalizationContext() { - return BundleSupport.getLocalizationContext(pageContext); - } + /** + * Fixes the absolute urls appending the context name. + * + * @param url the original url + * @return the fixed url + */ + public String getAbsoluteUrl(String url) { + if (url.startsWith("/")) { + HttpServletRequest request = (HttpServletRequest) pageContext.getRequest(); + return (request.getContextPath() + url); + } else { + return url; + } + } - /** - * Retrieves an encoded url from a basic one. - * - * @param url - * the original url - * @return the encoded url - * @throws JspException - */ - public String getAbsoluteUrl(String url) throws JspException { - return UrlSupport.resolveUrl(url, null, pageContext); - } + /** + * Evaluates some _expression_. + */ + protected String evaluate(String _expression_) throws JspException { + try { + return (String) pageContext.getExpressionEvaluator().evaluate( + _expression_, String.class, + pageContext.getVariableResolver(), null); + } catch (ELException e) { + throw new JspException(e); + } + } - /** - * Evaluates some _expression_. - */ - protected String evaluate(String _expression_) throws JspException { - try { - return (String) pageContext.getExpressionEvaluator().evaluate( - _expression_, String.class, - pageContext.getVariableResolver(), null); - } catch (ELException e) { - throw new JspException(e); - } - } + /** + * Evaluates this _expression_ in EL. Returns the same as evaluate("${" + + * _expression_ + "}"); + * + * @param _expression_ _expression_ in EL. + */ + protected String evaluateEl(String _expression_) throws JspException { + return evaluate("${" + _expression_ + "}"); + } - /** - * Evaluates this _expression_ in EL. Returns the same as evaluate("${" + - * _expression_ + "}"); - * - * @param _expression_ - * _expression_ in EL. - */ - protected String evaluateEl(String _expression_) throws JspException { - return evaluate("${" + _expression_ + "}"); - } + public void setBodyContent(BodyContent bodyContent) { + this.bodyContent = bodyContent; + } - public void setBodyContent(BodyContent bodyContent) { - this.bodyContent = bodyContent; - } + public void doInitBody() throws JspException { + // does nothing + } - public void doInitBody() throws JspException { - // does nothing - } + public int doAfterBody() throws JspException { + try { + IterationResult result = afterBody(pageContext.getOut()); + if (result == IterationResult.BODY_AGAIN) { + beforeBody(pageContext.getOut()); + } + return result.getTagResult(); + } catch (IOException ex) { + throw new JspException(ex); + } + } - public int doAfterBody() throws JspException { - try { - IterationResult result = afterBody(pageContext.getOut()); - if (result == IterationResult.BODY_AGAIN) { - beforeBody(pageContext.getOut()); - } - return result.getTagResult(); - } catch (IOException ex) { - throw new JspException(ex); - } - } + /** + * To be implemented by child classes that want to do something after the + * body. + * + * @param out the writer + * @throws IOException + */ + protected IterationResult afterBody(JspWriter out) throws IOException { + // does nothing + return IterationResult.PAGE; + } - /** - * To be implemented by child classes that want to do something after the - * body. - * - * @param out - * the writer - * @throws IOException - */ - protected IterationResult afterBody(JspWriter out) throws IOException { - // does nothing - return IterationResult.PAGE; - } + public int doEndTag() throws JspException { + if (!rendered) { + return IterationResult.PAGE.getTagResult(); + } + try { + end(pageContext.getOut()); + } catch (IOException e) { + throw new JspException(e); + } + return Tag.EVAL_PAGE; + } - public int doEndTag() throws JspException { - if(!rendered) { - return IterationResult.PAGE.getTagResult(); - } - try { - end(pageContext.getOut()); - } catch (IOException e) { - throw new JspException(e); - } - return Tag.EVAL_PAGE; - } + public int doStartTag() throws JspException { + if (!rendered) { + return IterationResult.PAGE.getTagResult(); + } + try { + IterationResult result = start(pageContext.getOut()); + if (result == IterationResult.BODY) { + beforeBody(pageContext.getOut()); + } + return result.getTagResult(); + } catch (IOException e) { + throw new JspException(e); + } + } - public int doStartTag() throws JspException { - if(!rendered) { - return IterationResult.PAGE.getTagResult(); - } - try { - IterationResult result = start(pageContext.getOut()); - if (result == IterationResult.BODY) { - beforeBody(pageContext.getOut()); - } - return result.getTagResult(); - } catch (IOException e) { - throw new JspException(e); - } - } + /** + * Starts this tag once. + * + * @throws JspException + * @throws IOException + */ + protected abstract IterationResult start(Writer out) throws JspException, + IOException; - /** - * Starts this tag once. - * - * @throws JspException - * @throws IOException - */ - protected abstract IterationResult start(Writer out) throws JspException, - IOException; + /** + * Executes something before body evaluation. + * + * @throws JspException + * @throws IOException + */ + protected void beforeBody(Writer out) throws JspException, IOException { + // does nothing by default + } - /** - * Executes something before body evaluation. - * - * @throws JspException - * @throws IOException - */ - protected void beforeBody(Writer out) throws JspException, IOException { - // does nothing by default - } + /** + * Ends this tag. + * + * @throws JspException + * @throws IOException + */ + protected void end(Writer out) throws JspException, IOException { + // does nothing by default + } - /** - * Ends this tag. - * - * @throws JspException - * @throws IOException - */ - protected void end(Writer out) throws JspException, IOException { - // does nothing by default - } - - public boolean isRendered() { - return rendered; - } + public boolean isRendered() { + return rendered; + } } \ No newline at end of file
Modified: trunk/extensions/taglib/src/main/resources/META-INF/waffle.tld (261 => 262)
--- trunk/extensions/taglib/src/main/resources/META-INF/waffle.tld 2007-07-13 18:19:44 UTC (rev 261) +++ trunk/extensions/taglib/src/main/resources/META-INF/waffle.tld 2007-07-13 21:00:17 UTC (rev 262) @@ -1,6 +1,8 @@ <?xml version="1.0" encoding="UTF-8"?> -<taglib xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://java.sun.com/xml/ns/javaee/web-jsptaglibrary_2_1.xsd" version="2.1"> +<taglib xmlns="http://java.sun.com/xml/ns/javaee" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://java.sun.com/xml/ns/javaee/web-jsptaglibrary_2_1.xsd" + version="2.1"> <tlib-version>1.0</tlib-version> <jsp-version>1.2</jsp-version>
Modified: trunk/extensions/taglib-acceptance/pom.xml (261 => 262)
--- trunk/extensions/taglib-acceptance/pom.xml 2007-07-13 18:19:44 UTC (rev 261) +++ trunk/extensions/taglib-acceptance/pom.xml 2007-07-13 21:00:17 UTC (rev 262) @@ -55,7 +55,7 @@ <plugin> <groupId>org.codehaus.cargo</groupId> <artifactId>cargo-maven2-plugin</artifactId> - <!--<version>0.3-SNAPSHOT</version>--> + <version>0.3-SNAPSHOT</version> <executions> <execution> <id>start-container</id> @@ -134,7 +134,7 @@ </property> <property> <name>seleniumContextPath</name> - <value>/${pom.artifactId}-${pom.version}/</value> + <value>/${pom.artifactId}/</value> </property> </systemProperties> <includes>
To unsubscribe from this list please visit:
