You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jetspeed-dev@portals.apache.org by ro...@apache.org on 2004/12/02 08:14:18 UTC
cvs commit: jakarta-jetspeed-2/components/web-content/src/java/org/apache/jetspeed/portlet WebContentPortlet.java
rogerrut 2004/12/01 23:14:18
Modified: components/web-content/src/java/org/apache/jetspeed/portlet
WebContentPortlet.java
Log:
WebContentPortlet: Added state and Portlet action handling
Revision Changes Path
1.3 +19 -4 jakarta-jetspeed-2/components/web-content/src/java/org/apache/jetspeed/portlet/WebContentPortlet.java
Index: WebContentPortlet.java
===================================================================
RCS file: /home/cvs/jakarta-jetspeed-2/components/web-content/src/java/org/apache/jetspeed/portlet/WebContentPortlet.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- WebContentPortlet.java 2 Dec 2004 03:14:56 -0000 1.2
+++ WebContentPortlet.java 2 Dec 2004 07:14:18 -0000 1.3
@@ -60,7 +60,7 @@
/**
* WebContentPortlet
*
- * TODO:
+ * TODO: Preferences, cache stream instead of URL
* *
* @author <a href="mailto:rogerrutr@apache.org">Roger Ruttimann</a>
* @version $Id$
@@ -162,6 +162,10 @@
try
{
sourceURL = (String)request.getPortletSession().getAttribute(WebContentPortlet.SESSION_PARAMETER, PortletSession.APPLICATION_SCOPE);
+
+ // TODO: This is just a kludge. Filtering of bad uRL's should be more sophisticated
+ if (sourceURL.startsWith("/") || sourceURL.startsWith(".."))
+ sourceURL=null;
}
catch (Exception e )
{
@@ -174,12 +178,13 @@
// Use the cache
sourceURL = lastURL;
}
- else
+
+ if (sourceURL == null)
{
// Use the URL defined in the preferences
sourceURL = defaultViewSource;
}
-
+
// If all above fails throw an error asking the user to define an URL in edit mode
if ( sourceURL == null)
throw new PortletException("WebContent source not specified. Go to edit mode and specify an URL.");
@@ -232,6 +237,16 @@
try
{
htmlWriter = new OutputStreamWriter(byteOutputStream, this.defaultEncoding);
+
+ // Set the action URL in the rewriter
+ ((WebContentRewriter)rewriter).setActionURL(response.createActionURL());
+
+ URL baseURL = new URL(sourceAttr);
+ String baseurl = baseURL.getProtocol() + "://"+ baseURL.getHost();
+// TODO: Remove debug
+ System.out.println("BaseURL: " + baseurl);
+
+ ((WebContentRewriter)rewriter).setBaseURL(baseurl);
rewriter.rewrite(rewriteController.createParserAdaptor("text/html"), getReader(sourceAttr), htmlWriter);
}
---------------------------------------------------------------------
To unsubscribe, e-mail: jetspeed-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: jetspeed-dev-help@jakarta.apache.org