[Bedework-commit] r646 - in trunk/calendar3:
common/src/edu/rpi/sss/util/jsp
uportal/src/ca/mun/portal/strutsbridge/taglib
svnadmin at bedework.org
svnadmin at bedework.org
Fri Jun 23 00:37:11 EDT 2006
Author: douglm
Date: 2006-06-23 00:37:08 -0400 (Fri, 23 Jun 2006)
New Revision: 646
Added:
trunk/calendar3/uportal/src/ca/mun/portal/strutsbridge/taglib/CalFormTag.java
trunk/calendar3/uportal/src/ca/mun/portal/strutsbridge/taglib/CalLinkTag.java
Modified:
trunk/calendar3/common/src/edu/rpi/sss/util/jsp/UtilAbstractAction.java
trunk/calendar3/uportal/src/ca/mun/portal/strutsbridge/taglib/CalRewriteTag.java
Log:
Add some missing files - further portlet fix
Modified: trunk/calendar3/common/src/edu/rpi/sss/util/jsp/UtilAbstractAction.java
===================================================================
--- trunk/calendar3/common/src/edu/rpi/sss/util/jsp/UtilAbstractAction.java 2006-06-23 04:16:17 UTC (rev 645)
+++ trunk/calendar3/common/src/edu/rpi/sss/util/jsp/UtilAbstractAction.java 2006-06-23 04:37:08 UTC (rev 646)
@@ -312,12 +312,19 @@
Everything is set up and ready to go. Execute something
---------------------------------------------------------------- */
- forward = checkLogOut(request, form);
+ if (!isPortlet) {
+ forward = checkLogOut(request, form);
+ } else {
+ forward = null;
+ }
+
if (forward != null) {
// Disable xslt filters
response.setContentType("text/html");
} else {
- response.setContentType(defaultContentType);
+ if (!isPortlet) {
+ response.setContentType(defaultContentType);
+ }
forward = checkVarReq(request, form);
if (forward == null) {
Added: trunk/calendar3/uportal/src/ca/mun/portal/strutsbridge/taglib/CalFormTag.java
===================================================================
--- trunk/calendar3/uportal/src/ca/mun/portal/strutsbridge/taglib/CalFormTag.java (rev 0)
+++ trunk/calendar3/uportal/src/ca/mun/portal/strutsbridge/taglib/CalFormTag.java 2006-06-23 04:37:08 UTC (rev 646)
@@ -0,0 +1,99 @@
+/*
+ * Copyright 2000-2004 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package ca.mun.portal.strutsbridge.taglib;
+
+import java.net.MalformedURLException;
+import java.net.URL;
+
+import javax.servlet.ServletRequest; // for javadoc
+
+import org.apache.portals.bridges.struts.PortletServlet;
+import org.apache.portals.bridges.struts.config.PortletURLTypes;
+import org.apache.struts.taglib.html.FormTag;
+
+/** Supports the Struts html:form tag to be used within uPortlet context for
+ * generating urls for the bedework portlet.
+ *
+ * @author <a href="mailto:ate at douma.nu">Ate Douma</a>
+ * @author <a href="mailto:satish at mun.ca">Satish Sekharan</a>
+ * @author Mike Douglass douglm at rpi.edu
+ * @version $Id: RewriteTag.java 2005-10-25 12:31:13Z satish $
+ */
+public class CalFormTag extends FormTag {
+ /* bedework dummy request parameter - it's an encoded form of ?b=de */
+ private static final String bedeworkDummyPar = "%3Fb%3Dde";
+
+ /**
+ * Modifies the default generated form action url to be a valid Portlet ActionURL
+ * when in the context of a {@link PortletServlet#isPortletRequest(ServletRequest) PortletRequest}.
+ * @return the formStartElement
+ */
+ protected String renderFormStartElement() {
+ String formStartElement = super.renderFormStartElement();
+
+ if (!PortletServlet.isPortletRequest(pageContext.getRequest())) {
+ return formStartElement;
+ }
+
+ int actionURLStart = formStartElement.indexOf("action=") + 8;
+ int actionURLEnd = formStartElement.indexOf('"', actionURLStart);
+
+ String urlStr = formStartElement.substring(actionURLStart,
+ actionURLEnd);
+
+ try {
+ URL url = new URL(urlStr);
+
+ /* We want a context relative url */
+ urlStr = url.getFile();
+
+ //System.out.println("FFFFFFFFFFFFFFFFFFFFUrlStr = " + urlStr);
+
+ /* Drop the context
+ */
+ int pos = urlStr.indexOf('/');
+ if (pos > 0) {
+ urlStr = urlStr.substring(pos);
+ }
+
+ urlStr = TagsSupport.getURL(pageContext, urlStr,
+ PortletURLTypes.URLType.ACTION);
+
+ /* remove embedded anchor because calendar xsl stylesheet
+ * adds extra parameters later during transformation
+ */
+ pos = urlStr.indexOf('#');
+ if (pos > -1) {
+ urlStr = urlStr.substring(0, pos);
+ }
+
+ /* Remove bedework dummy request parameter -
+ * it's an encoded form of ?b=de */
+ urlStr = urlStr.replaceAll(bedeworkDummyPar, "");
+
+ //Generate valid xml markup for transformationthrow new
+ urlStr = urlStr.replaceAll("&", "&");
+
+ //System.out.println("FFFFFFFFFFFFFFFFFFFFUrlStr = " + urlStr);
+ } catch (MalformedURLException mue) {
+ return null;
+ }
+
+ return formStartElement.substring(0, actionURLStart) +
+ urlStr +
+ formStartElement.substring(actionURLEnd);
+ }
+}
Added: trunk/calendar3/uportal/src/ca/mun/portal/strutsbridge/taglib/CalLinkTag.java
===================================================================
--- trunk/calendar3/uportal/src/ca/mun/portal/strutsbridge/taglib/CalLinkTag.java (rev 0)
+++ trunk/calendar3/uportal/src/ca/mun/portal/strutsbridge/taglib/CalLinkTag.java 2006-06-23 04:37:08 UTC (rev 646)
@@ -0,0 +1,186 @@
+/*
+ * Copyright 2000-2004 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package ca.mun.portal.strutsbridge.taglib;
+
+import java.net.MalformedURLException;
+import java.net.URL;
+
+import javax.servlet.ServletRequest; // for javadoc
+import javax.servlet.jsp.JspException;
+
+import org.apache.portals.bridges.struts.PortletServlet;
+import org.apache.portals.bridges.struts.config.PortletURLTypes; // javadoc
+import org.apache.struts.taglib.html.LinkTag;
+
+/** Supports the Struts html:link tag to be used within uPortlet context for
+ * generating urls for the bedework portlet.
+ *
+ * @author <a href="mailto:ate at douma.nu">Ate Douma</a>
+ * @author <a href="mailto:satish at mun.ca">Satish Sekharan</a>
+ * @author Mike Douglass douglm at rpi.edu
+ * @version $Id: RewriteTag.java 2005-10-25 12:31:13Z satish $
+ */
+public class CalLinkTag extends LinkTag {
+ /** Indicates which type of a url must be generated: action, render or resource.
+ * <p>If not specified, the type will be determined by
+ * {@link PortletURLTypes#getType(String)}</p>.
+ */
+ protected PortletURLTypes.URLType urlType = null;
+
+ /**
+ * @return String
+ */
+ public String getActionURL() {
+ if (urlType != null &&
+ urlType.equals(PortletURLTypes.URLType.ACTION)) {
+ return "true";
+ }
+
+ return "false";
+ }
+
+ /** Render an ActionURL when set to "true"
+ *
+ * @param value "true" renders an ActionURL
+ */
+ public void setActionURL(String value) {
+ if (value != null &&
+ value.equalsIgnoreCase("true")) {
+ urlType = PortletURLTypes.URLType.ACTION;
+ } else {
+ urlType = null;
+ }
+ }
+
+ /**
+ * @return String
+ */
+ public String getRenderURL() {
+ if (urlType != null &&
+ urlType.equals(PortletURLTypes.URLType.RENDER)) {
+ return "true";
+ }
+
+ return "false";
+ }
+
+ /** Render a RenderURL when set to "true"
+ *
+ * @param value "true" renders a RenderURL
+ */
+ public void setRenderURL(String value) {
+ if (value != null &&
+ value.equalsIgnoreCase("true")) {
+ urlType = PortletURLTypes.URLType.RENDER;
+ } else {
+ urlType = null;
+ }
+ }
+
+ /**
+ * @return String
+ */
+ public String getResourceURL() {
+ if (urlType != null &&
+ urlType.equals(PortletURLTypes.URLType.RESOURCE)) {
+ return "true";
+ }
+
+ return "false";
+ }
+
+ /**
+ * Render a ResourceURL when set to "true"
+ * @param value "true" renders a ResourceURL
+ */
+ public void setResourceURL(String value) {
+ if (value != null &&
+ value.equalsIgnoreCase("true")) {
+ urlType = PortletURLTypes.URLType.RESOURCE;
+ } else {
+ urlType = null;
+ }
+ }
+
+ /* bedework dummy request parameter - it's an encoded form of ?b=de */
+ private static final String bedeworkDummyPar = "%3Fb%3Dde";
+
+ /** Generates a PortletURL or a ResourceURL for the link when in the context of a
+ * {@link PortletServlet#isPortletRequest(ServletRequest) PortletRequest}, otherwise
+ * the default behaviour is maintained.
+ *
+ * @return the link url
+ * @exception JspException if a JSP exception has occurred
+ */
+ protected String calculateURL() throws JspException {
+ String urlStr = super.calculateURL();
+
+ if (!PortletServlet.isPortletRequest(pageContext.getRequest())) {
+ return urlStr;
+ }
+
+ try {
+ URL url = new URL(urlStr);
+
+ String path = url.getPath();
+ if (path.endsWith(".rdo")) {
+ setRenderURL("true");
+ } else if (path.endsWith(".rdo")) {
+ setActionURL("true");
+ }
+
+ /* We want a context relative url */
+ urlStr = url.getFile();
+
+ //System.out.println("LLLLLLLLLLLLLLLLLLUrlStr = " + urlStr);
+
+ /* Drop the context
+ */
+ int pos = urlStr.indexOf('/');
+ if (pos > 0) {
+ urlStr = urlStr.substring(pos);
+ }
+
+ urlStr = TagsSupport.getURL(pageContext, urlStr, urlType);
+
+ /* remove embedded anchor because calendar xsl stylesheet
+ * adds extra parameters later during transformation
+ */
+ pos = urlStr.indexOf('#');
+ if (pos > -1) {
+ urlStr = urlStr.substring(0, pos);
+ }
+
+ /* Remove bedework dummy request parameter -
+ * it's an encoded form of ?b=de */
+ urlStr = urlStr.replaceAll(bedeworkDummyPar, "");
+
+ //Generate valid xml markup for transformationthrow new
+ urlStr = urlStr.replaceAll("&", "&");
+
+ //System.out.println("LLLLLLLLLLLLLLLLLLLLLLLUrlStr = " + urlStr);
+ } catch (MalformedURLException mue) {
+ throw new JspException(mue);
+ }
+
+ return urlStr;
+ }
+
+ public void release() {
+ super.release();
+ urlType = null;
+ }
+}
Modified: trunk/calendar3/uportal/src/ca/mun/portal/strutsbridge/taglib/CalRewriteTag.java
===================================================================
--- trunk/calendar3/uportal/src/ca/mun/portal/strutsbridge/taglib/CalRewriteTag.java 2006-06-23 04:16:17 UTC (rev 645)
+++ trunk/calendar3/uportal/src/ca/mun/portal/strutsbridge/taglib/CalRewriteTag.java 2006-06-23 04:37:08 UTC (rev 646)
@@ -149,7 +149,7 @@
/* We want a context relative url */
urlStr = url.getFile();
- System.out.println("RRRRRRRRRRRRRRRRRUrlStr = " + urlStr);
+ //System.out.println("RRRRRRRRRRRRRRRRRUrlStr = " + urlStr);
/* Drop the context
*/
@@ -175,7 +175,7 @@
//Generate valid xml markup for transformationthrow new
urlStr = urlStr.replaceAll("&", "&");
- System.out.println("RRRRRRRRRRRRRRRRRUrlStr = " + urlStr);
+ //System.out.println("RRRRRRRRRRRRRRRRRUrlStr = " + urlStr);
} catch (MalformedURLException mue) {
throw new JspException(mue);
} finally {
More information about the Bedework-commit
mailing list