Author: taylor
Date: Sat May 2 01:46:31 2009
New Revision: 770879
URL: http://svn.apache.org/viewvc?rev=770879&view=rev
Log:
https://issues.apache.org/jira/browse/JS2-621
Final cleanup for 621 (WebContent). Im having some problems with challenge
authentication, but I will open that up as a single bug in future release
Modified:
portals/applications/webcontent/trunk/webcontent-jar/src/main/java/org/apache/portals/applications/webcontent/portlet/WebContentPortlet.java
Modified:
portals/applications/webcontent/trunk/webcontent-jar/src/main/java/org/apache/portals/applications/webcontent/portlet/WebContentPortlet.java
URL:
http://svn.apache.org/viewvc/portals/applications/webcontent/trunk/webcontent-jar/src/main/java/org/apache/portals/applications/webcontent/portlet/WebContentPortlet.java?rev=770879&r1=770878&r2=770879&view=diff
==============================================================================
---
portals/applications/webcontent/trunk/webcontent-jar/src/main/java/org/apache/portals/applications/webcontent/portlet/WebContentPortlet.java
(original)
+++
portals/applications/webcontent/trunk/webcontent-jar/src/main/java/org/apache/portals/applications/webcontent/portlet/WebContentPortlet.java
Sat May 2 01:46:31 2009
@@ -108,6 +108,8 @@
public static final String FORM_POST_METHOD = "post";
public static final String FORM_GET_METHOD = "get";
public static final String FORM_MULTIPART_METHOD = "multipart";
+
+ public static final String NO_URL = "<p>URL source not specified. Go to
edit mode and specify an URL.</p>";
public WebContentPortlet()
{
@@ -191,6 +193,7 @@
}
}
+
/**
* doView Renders the URL in the following order 1) SESSION_PARAMETER
* 2)cached version 3) defined for preference SRC
@@ -214,8 +217,8 @@
String sourceURL = request.getPreferences().getValue("SRC", "");
if (sourceURL == null)
{
- // BOZO - switch to edit mode automatically here, instead of
throwing exception!
- throw new PortletException("WebContent source not specified.
Go to edit mode and specify an URL.");
+ response.getWriter().print(NO_URL);
+ return;
}
currentPage = new WebContentHistoryPage(sourceURL);
}
@@ -233,16 +236,24 @@
}
catch (Exception e)
{
- // Failed to create rewriter controller
- String msg = "WebContentPortlet failed to create rewriter
controller.";
- log.error(msg,e);
- throw new PortletException(e.getMessage());
+ response.getWriter().print("<p>WebContentPortlet failed to
create rewriter controller.</p>");
+ return;
}
}
// get content from current page
response.setContentType("text/html");
- byte[] content = doWebContent(currentPage.getUrl(),
currentPage.getParams(), currentPage.isPost(), request, response);
+ byte[] content = null;
+ try
+ {
+ content = doWebContent(currentPage.getUrl(),
currentPage.getParams(), currentPage.isPost(), request, response);
+ }
+ catch (Throwable t)
+ {
+ PrintWriter writer = response.getWriter();
+ writer.print("Error retrieveing web content:" + t.getMessage());
+ return;
+ }
// System.out.println("Rewritten content is\n..."+new String(content));
// write the meta-control navigation header