Author: chris.laprun(a)jboss.com
Date: 2010-08-04 19:49:32 -0400 (Wed, 04 Aug 2010)
New Revision: 3745
Modified:
components/pc/trunk/portlet/src/main/java/org/gatein/pc/portlet/impl/jsr286/taglib/ResourceURL286Tag.java
components/pc/trunk/portlet/src/main/java/org/gatein/pc/portlet/impl/jsr286/taglib/ResourceURL286TagTEI.java
components/pc/trunk/test/src/test/java/org/gatein/pc/test/portlet/jsr286/tck/taglib/ResourceURLTestCase.java
components/pc/trunk/test/src/test/resources/jsr286/tck/taglib-war/resourceURL.jsp
Log:
- GTNPC-25: Removed calls to setCacheability with hardcoded improper cacheLevel values.
Note that in the JSP case, it could be possible to provide a backward-compatible solution.
This hasn't been implemented though.
Modified:
components/pc/trunk/portlet/src/main/java/org/gatein/pc/portlet/impl/jsr286/taglib/ResourceURL286Tag.java
===================================================================
---
components/pc/trunk/portlet/src/main/java/org/gatein/pc/portlet/impl/jsr286/taglib/ResourceURL286Tag.java 2010-08-04
21:02:15 UTC (rev 3744)
+++
components/pc/trunk/portlet/src/main/java/org/gatein/pc/portlet/impl/jsr286/taglib/ResourceURL286Tag.java 2010-08-04
23:49:32 UTC (rev 3745)
@@ -1,29 +1,30 @@
/*
-* JBoss, a division of Red Hat
-* Copyright 2006, Red Hat Middleware, LLC, and individual contributors as indicated
-* by the @authors tag. See the copyright.txt in the distribution for a
-* full listing of individual contributors.
-*
-* This is free software; you can redistribute it and/or modify it
-* under the terms of the GNU Lesser General Public License as
-* published by the Free Software Foundation; either version 2.1 of
-* the License, or (at your option) any later version.
-*
-* This software is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-* Lesser General Public License for more details.
-*
-* You should have received a copy of the GNU Lesser General Public
-* License along with this software; if not, write to the Free
-* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
-* 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
-*/
+ * JBoss, a division of Red Hat
+ * Copyright 2010, Red Hat Middleware, LLC, and individual
+ * contributors as indicated by the @authors tag. See the
+ * copyright.txt in the distribution for a full listing of
+ * individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ */
package org.gatein.pc.portlet.impl.jsr286.taglib;
+import javax.portlet.BaseURL;
import javax.portlet.ResourceURL;
-import javax.portlet.BaseURL;
/**
@@ -71,7 +72,7 @@
}
else
{
- resourceURL.setCacheability("PAGE");
+ resourceURL.setCacheability(ResourceURL.PAGE);
}
}
@@ -84,6 +85,7 @@
/* (non-Javadoc)
* @see org.gatein.pc.portlet.taglib.GenerateURLTag#addTypeParameter()
*/
+
protected String getTypeValue()
{
return typeParameter;
@@ -91,7 +93,7 @@
protected BaseURL generateURL() throws Exception
{
- BaseURL newPortletURL = super.generateURL();
+ BaseURL newPortletURL = super.generateURL();
setId((ResourceURL)newPortletURL);
setCacheability((ResourceURL)newPortletURL);
Modified:
components/pc/trunk/portlet/src/main/java/org/gatein/pc/portlet/impl/jsr286/taglib/ResourceURL286TagTEI.java
===================================================================
---
components/pc/trunk/portlet/src/main/java/org/gatein/pc/portlet/impl/jsr286/taglib/ResourceURL286TagTEI.java 2010-08-04
21:02:15 UTC (rev 3744)
+++
components/pc/trunk/portlet/src/main/java/org/gatein/pc/portlet/impl/jsr286/taglib/ResourceURL286TagTEI.java 2010-08-04
23:49:32 UTC (rev 3745)
@@ -1,27 +1,29 @@
/*
-* JBoss, a division of Red Hat
-* Copyright 2006, Red Hat Middleware, LLC, and individual contributors as indicated
-* by the @authors tag. See the copyright.txt in the distribution for a
-* full listing of individual contributors.
-*
-* This is free software; you can redistribute it and/or modify it
-* under the terms of the GNU Lesser General Public License as
-* published by the Free Software Foundation; either version 2.1 of
-* the License, or (at your option) any later version.
-*
-* This software is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-* Lesser General Public License for more details.
-*
-* You should have received a copy of the GNU Lesser General Public
-* License along with this software; if not, write to the Free
-* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
-* 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
-*/
+ * JBoss, a division of Red Hat
+ * Copyright 2010, Red Hat Middleware, LLC, and individual
+ * contributors as indicated by the @authors tag. See the
+ * copyright.txt in the distribution for a full listing of
+ * individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ */
package org.gatein.pc.portlet.impl.jsr286.taglib;
+import javax.portlet.ResourceURL;
import javax.servlet.jsp.tagext.TagData;
/**
@@ -47,16 +49,11 @@
if (o != null && o != TagData.REQUEST_TIME_VALUE)
{
String s = (String)o;
- if (s.toLowerCase().equals("full") ||
- s.toLowerCase().equals("portlet") ||
- s.toLowerCase().equals("page"))
- {
- return true;
- }
- else
- {
- return false;
- }
+ // GTNPC-25: note that this change will possibly render previously accepted
values in JSPs incorrect
+ // these values were wrong and ignored in ResourceURLImpl.setCacheability so
were ineffective
+ return s.toLowerCase().equals(ResourceURL.FULL) ||
+ s.toLowerCase().equals(ResourceURL.PORTLET) ||
+ s.toLowerCase().equals(ResourceURL.PAGE);
}
else
{
Modified:
components/pc/trunk/test/src/test/java/org/gatein/pc/test/portlet/jsr286/tck/taglib/ResourceURLTestCase.java
===================================================================
---
components/pc/trunk/test/src/test/java/org/gatein/pc/test/portlet/jsr286/tck/taglib/ResourceURLTestCase.java 2010-08-04
21:02:15 UTC (rev 3744)
+++
components/pc/trunk/test/src/test/java/org/gatein/pc/test/portlet/jsr286/tck/taglib/ResourceURLTestCase.java 2010-08-04
23:49:32 UTC (rev 3745)
@@ -1,43 +1,44 @@
/*
-* JBoss, a division of Red Hat
-* Copyright 2006, Red Hat Middleware, LLC, and individual contributors as indicated
-* by the @authors tag. See the copyright.txt in the distribution for a
-* full listing of individual contributors.
-*
-* This is free software; you can redistribute it and/or modify it
-* under the terms of the GNU Lesser General Public License as
-* published by the Free Software Foundation; either version 2.1 of
-* the License, or (at your option) any later version.
-*
-* This software is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-* Lesser General Public License for more details.
-*
-* You should have received a copy of the GNU Lesser General Public
-* License along with this software; if not, write to the Free
-* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
-* 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
-*/
+ * JBoss, a division of Red Hat
+ * Copyright 2010, Red Hat Middleware, LLC, and individual
+ * contributors as indicated by the @authors tag. See the
+ * copyright.txt in the distribution for a full listing of
+ * individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ */
package org.gatein.pc.test.portlet.jsr286.tck.taglib;
-import org.gatein.pc.test.unit.annotations.TestCase;
+import org.gatein.pc.test.portlet.framework.UTP1;
+import org.gatein.pc.test.unit.Assertion;
import org.gatein.pc.test.unit.PortletTestCase;
import org.gatein.pc.test.unit.PortletTestContext;
-import org.gatein.pc.test.unit.Assertion;
+import org.gatein.pc.test.unit.actions.PortletRenderTestAction;
+import org.gatein.pc.test.unit.annotations.TestCase;
import org.gatein.pc.test.unit.base.AbstractUniversalTestPortlet;
-import org.gatein.pc.test.unit.actions.PortletRenderTestAction;
-import org.gatein.pc.test.portlet.framework.UTP1;
import org.jboss.unit.driver.DriverResponse;
import org.jboss.unit.driver.response.EndTestResponse;
import org.jboss.unit.remote.driver.handler.http.response.InvokeGetResponse;
import javax.portlet.Portlet;
+import javax.portlet.PortletException;
+import javax.portlet.PortletRequestDispatcher;
import javax.portlet.RenderRequest;
import javax.portlet.RenderResponse;
-import javax.portlet.PortletException;
-import javax.portlet.PortletRequestDispatcher;
import javax.portlet.ResourceURL;
import java.io.IOException;
import java.io.StringWriter;
@@ -63,7 +64,7 @@
ResourceURL pu1 = response.createResourceURL();
pu1.setSecure(true);
- pu1.setCacheability("FULL");
+ pu1.setCacheability(ResourceURL.FULL);
ResourceURL pu2 = response.createResourceURL();
@@ -74,7 +75,7 @@
ResourceURL pu3 = response.createResourceURL();
pu3.setSecure(false);
- pu3.setParameter("testParam", new String[]
{"testParamValue", "testParamValue2"});
+ pu3.setParameter("testParam", new
String[]{"testParamValue", "testParamValue2"});
pu3.setParameter("secondParam", "testParamValue");
pu3.setProperty("testProperty", "testPropValue");
pu3.setProperty("testProperty", "testPropValue2");
@@ -103,7 +104,7 @@
String url3 = response.encodeURL(sw.toString());
- expectedResults = new String[]{ url1, url2, url3};
+ expectedResults = new String[]{url1, url2, url3};
include(dispatcher, request, response);
Modified:
components/pc/trunk/test/src/test/resources/jsr286/tck/taglib-war/resourceURL.jsp
===================================================================
---
components/pc/trunk/test/src/test/resources/jsr286/tck/taglib-war/resourceURL.jsp 2010-08-04
21:02:15 UTC (rev 3744)
+++
components/pc/trunk/test/src/test/resources/jsr286/tck/taglib-war/resourceURL.jsp 2010-08-04
23:49:32 UTC (rev 3745)
@@ -1,10 +1,33 @@
<%@ page language="java" %>
<%@ taglib
uri="http://java.sun.com/portlet_2_0" prefix="portlet"
%>
+<%--
+ ~ JBoss, a division of Red Hat
+ ~ Copyright 2010, Red Hat Middleware, LLC, and individual
+ ~ contributors as indicated by the @authors tag. See the
+ ~ copyright.txt in the distribution for a full listing of
+ ~ individual contributors.
+ ~
+ ~ This is free software; you can redistribute it and/or modify it
+ ~ under the terms of the GNU Lesser General Public License as
+ ~ published by the Free Software Foundation; either version 2.1 of
+ ~ the License, or (at your option) any later version.
+ ~
+ ~ This software is distributed in the hope that it will be useful,
+ ~ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ ~ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ ~ Lesser General Public License for more details.
+ ~
+ ~ You should have received a copy of the GNU Lesser General Public
+ ~ License along with this software; if not, write to the Free
+ ~ Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ ~ 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ --%>
+
<portlet:defineObjects/>
+<%@ page import="javax.portlet.ResourceURL" %>
+<portlet:resourceURL secure="true" escapeXml="true"
cacheability="<%= ResourceURL.FULL%>"/>
-<portlet:resourceURL secure="true" escapeXml="true"
cacheability="FULL"/>
-
<test_result_separator/>
<portlet:resourceURL secure="true" escapeXml="true"
id="testId1" var="testVar"/>