Update of /var/cvs/applications/taglib/src/org/mmbase/bridge/jsp/taglib
In directory james.mmbase.org:/tmp/cvs-serv1673
Modified Files:
mmbase-taglib.xml ImageTag.java
Log Message:
MMB-1748
See also:
http://cvs.mmbase.org/viewcvs/applications/taglib/src/org/mmbase/bridge/jsp/taglib
See also: http://www.mmbase.org/jira/browse/MMB-1748
Index: mmbase-taglib.xml
===================================================================
RCS file:
/var/cvs/applications/taglib/src/org/mmbase/bridge/jsp/taglib/mmbase-taglib.xml,v
retrieving revision 1.444
retrieving revision 1.445
diff -u -b -r1.444 -r1.445
--- mmbase-taglib.xml 26 Nov 2008 14:09:43 -0000 1.444
+++ mmbase-taglib.xml 5 Dec 2008 13:59:27 -0000 1.445
@@ -39,7 +39,7 @@
Use one or more possiblevalue tags if you want to list all possible values. Use
one or more examplevalue tags is you want to give some example values.
-version: $Id: mmbase-taglib.xml,v 1.444 2008/11/26 14:09:43 michiel Exp $
+version: $Id: mmbase-taglib.xml,v 1.445 2008/12/05 13:59:27 michiel Exp $
-->
<taglib author="MMBase community">
@@ -4682,6 +4682,19 @@
</possiblevalue>
</attribute>
<attribute>
+ <name>absolute</name>
+ <required>false</required>
+ <rtexprvalue>true</rtexprvalue>
+ <refercontext>true</refercontext>
+ <info>
+ <p>
+ Whether the used url will be 'absolute' or not. Defaults to 'server'.
+ </p>
+ </info>
+ <see tag="url" attribute="absolute" />
+ <since>MMBase-1.9.1</since>
+ </attribute>
+ <attribute>
<name>element</name>
<required>false</required>
<rtexprvalue>true</rtexprvalue>
@@ -4842,6 +4855,19 @@
<see tag="node" attribute="element" />
<since>MMBase-1.7.4</since>
</attribute>
+ <attribute>
+ <name>absolute</name>
+ <required>false</required>
+ <rtexprvalue>true</rtexprvalue>
+ <refercontext>true</refercontext>
+ <info>
+ <p>
+ Whether the used url will be 'absolute' or not. Defaults to 'server'.
+ </p>
+ </info>
+ <see tag="url" attribute="absolute" />
+ <since>MMBase-1.9.1</since>
+ </attribute>
<info>
<p>
Returns an URL to the attachment servlet. This is a NodeReferrer
Index: ImageTag.java
===================================================================
RCS file:
/var/cvs/applications/taglib/src/org/mmbase/bridge/jsp/taglib/ImageTag.java,v
retrieving revision 1.79
retrieving revision 1.80
diff -u -b -r1.79 -r1.80
--- ImageTag.java 14 Aug 2008 13:42:18 -0000 1.79
+++ ImageTag.java 5 Dec 2008 13:59:27 -0000 1.80
@@ -31,7 +31,7 @@
* sensitive for future changes in how the image servlet works.
*
* @author Michiel Meeuwissen
- * @version $Id: ImageTag.java,v 1.79 2008/08/14 13:42:18 michiel Exp $
+ * @version $Id: ImageTag.java,v 1.80 2008/12/05 13:59:27 michiel Exp $
*/
public class ImageTag extends FieldTag {
@@ -50,41 +50,24 @@
private static Boolean makeRelative = null;
private static Boolean urlConvert = null;
- /** Holds value of property template. */
private Attribute template = Attribute.NULL;
-
- /** Holds value of property mode. */
private Attribute mode = Attribute.NULL;
-
- /** Holds value of property width. */
private Attribute width = Attribute.NULL;
-
- /** Holds value of property height. */
private Attribute height = Attribute.NULL;
-
- /** Holds value of property crop. */
private Attribute crop = Attribute.NULL;
-
- /** Holds value of property style. */
private Attribute style = Attribute.NULL;
-
- /** Holds value of property clazz. */
private Attribute styleClass = Attribute.NULL;
-
- /** Holds value of property align. */
private Attribute align = Attribute.NULL;
-
- /** Holds value of property border. */
private Attribute border = Attribute.NULL;
-
- /** Holds value of property hspace. */
private Attribute hspace = Attribute.NULL;
-
- /** Holds value of property vspace. */
private Attribute vspace = Attribute.NULL;
private Attribute altAttribute = Attribute.NULL;
+
+ private Attribute absolute = Attribute.NULL;
+
+
private Object prevDimension;
/**
@@ -144,6 +127,13 @@
altAttribute = getAttribute(a);
}
+ /**
+ * @since MMBase-1.9.1
+ */
+ public void setAbsolute(String a) throws JspTagException {
+ absolute = getAttribute(a, true);
+ }
+
private int getMode() throws JspTagException {
String m = mode.getString(this).toLowerCase();
if (m.length() == 0 || m.equals("url")) {
@@ -227,6 +217,8 @@
}
String servletPath = getServletPath(node, servletArgument);
+
+
String outputValue = getOutputValue(getMode(), originalNode,
servletPath, dim);
if (outputValue != null) {
@@ -267,7 +259,30 @@
Function servletPathFunction = getServletFunction(node);
Parameters args = getServletArguments(servletArgument,
servletPathFunction);
fillStandardParameters(args);
- return servletPathFunction.getFunctionValue( args).toString();
+ String url = servletPathFunction.getFunctionValue( args).toString();
+ if (absolute != Attribute.NULL) {
+ String a = absolute.getString(this);
+ HttpServletRequest req = (HttpServletRequest)
getPageContext().getRequest();
+ if ("true".equals(a)) {
+ StringBuilder show = new StringBuilder();
+ String scheme = req.getScheme();
+ show.append(scheme).append("://");
+ show.append(req.getServerName());
+ int port = req.getServerPort();
+ show.append((port == 80 && "http".equals(scheme)) ||
+ (port == 443 && "https".equals(scheme))
+ ? "" : ":" + port);
+ show.append(url);
+ url = show.toString();
+ } else if ("context".equals(a)) {
+ url = url.substring(req.getContextPath().length(),
url.length());
+ } else if ("server".equals(a)) {
+ // Ok, that's it already.
+ } else {
+ throw new TaglibException("Invalid value for absolute
attribute '" + a + "'");
+ }
+ }
+ return url;
}
public Function getServletFunction(Node node) {
_______________________________________________
Cvs mailing list
[email protected]
http://lists.mmbase.org/mailman/listinfo/cvs