You are viewing a plain text version of this content. The canonical link for it is here.
Posted to pluto-scm@portals.apache.org by cd...@apache.org on 2005/09/16 03:36:34 UTC
svn commit: r289358 - in /portals/pluto/trunk/portal/src:
java/org/apache/pluto/portlet/admin/controller/DeployWarPortlet.java
java/org/apache/pluto/portlet/admin/services/DeployWarService.java
webapp/portlets/admin/DeployWarView.jsp
Author: cdoremus
Date: Thu Sep 15 18:36:29 2005
New Revision: 289358
URL: http://svn.apache.org/viewcvs?rev=289358&view=rev
Log:
Modifications to support hot deployment of portlets. Thank you Oscar Saavedra for contributing the code that these changes are based on.
Modified:
portals/pluto/trunk/portal/src/java/org/apache/pluto/portlet/admin/controller/DeployWarPortlet.java
portals/pluto/trunk/portal/src/java/org/apache/pluto/portlet/admin/services/DeployWarService.java
portals/pluto/trunk/portal/src/webapp/portlets/admin/DeployWarView.jsp
Modified: portals/pluto/trunk/portal/src/java/org/apache/pluto/portlet/admin/controller/DeployWarPortlet.java
URL: http://svn.apache.org/viewcvs/portals/pluto/trunk/portal/src/java/org/apache/pluto/portlet/admin/controller/DeployWarPortlet.java?rev=289358&r1=289357&r2=289358&view=diff
==============================================================================
--- portals/pluto/trunk/portal/src/java/org/apache/pluto/portlet/admin/controller/DeployWarPortlet.java (original)
+++ portals/pluto/trunk/portal/src/java/org/apache/pluto/portlet/admin/controller/DeployWarPortlet.java Thu Sep 15 18:36:29 2005
@@ -130,7 +130,7 @@
service.savePageLayout(request);
//forward to first page
- request.getPortletSession().setAttribute(PlutoAdminConstants.MESSAGE_ATTR, new PortletMessage("Deployment successful. Please restart the Pluto portal.", PortletMessageType.SUCCESS));
+ request.getPortletSession().setAttribute(PlutoAdminConstants.MESSAGE_ATTR, new PortletMessage("Deployment successful. Please restart the Pluto portal or click the hot deploy link below.", PortletMessageType.SUCCESS));
_incView = "/portlets/admin/DeployWarView.jsp";
response.setPortletMode(PortletMode.VIEW);
}
Modified: portals/pluto/trunk/portal/src/java/org/apache/pluto/portlet/admin/services/DeployWarService.java
URL: http://svn.apache.org/viewcvs/portals/pluto/trunk/portal/src/java/org/apache/pluto/portlet/admin/services/DeployWarService.java?rev=289358&r1=289357&r2=289358&view=diff
==============================================================================
--- portals/pluto/trunk/portal/src/java/org/apache/pluto/portlet/admin/services/DeployWarService.java (original)
+++ portals/pluto/trunk/portal/src/java/org/apache/pluto/portlet/admin/services/DeployWarService.java Thu Sep 15 18:36:29 2005
@@ -90,6 +90,7 @@
final String METHOD_NAME = "processFileUpload(request,response)";
String fileName = null;
String serverFileName = null;
+ boolean modifyWebXml = true;
request.getPortletSession().setAttribute(PlutoAdminConstants.MESSAGE_ATTR, new PortletMessage("Deployment unsuccessful", PortletMessageType.ERROR));
// Check the request content type to see if it starts with multipart/
if (PortletDiskFileUpload.isMultipartContent(request))
@@ -117,6 +118,13 @@
String fieldName = item.getFieldName();
String value = item.getString();
response.setRenderParameter(fieldName, value);
+ if (fieldName.equalsIgnoreCase("NoWebXmlModification")) {
+ String noWebXmlModification = item.getString();
+ logWarn(METHOD_NAME, "Don't modify web.xml? " + noWebXmlModification);
+ if (noWebXmlModification != null) {
+ modifyWebXml = false;
+ }
+ }
}
else
{
@@ -152,7 +160,9 @@
}
org.apache.pluto.portalImpl.Deploy.main(args);
//NEW: Update web.xml with new servlet elements
- updateWebXml(context);
+ if (modifyWebXml) {
+ updateWebXml(context);
+ }
if (appExists) {
request.getPortletSession().setAttribute(PlutoAdminConstants.MESSAGE_ATTR, new PortletMessage("Deployment of the new portlet app has been successful, but the portlet app record '" + context + "' already exists in portletentityregistry.xml. " +
"This may have occurred if the portlet was previously partially deployed. If that is the case, continue with this screen and the next to register the portlet in pageregistry.xml. " +
@@ -678,7 +688,7 @@
for (int i = 0; i < len; i++) {
//check each element in web.xml contents
for (int j = 0; j < lenElements; j++) {
- if ((index = results.lastIndexOf("</" + elements[j])) != -1) {
+ if ((index = results.lastIndexOf("</" + elements[j]+ ">")) != -1) {
//get the length to the end of the element (>)
rest = results.substring(index);
int elementLen = rest.indexOf('>') + 1;
Modified: portals/pluto/trunk/portal/src/webapp/portlets/admin/DeployWarView.jsp
URL: http://svn.apache.org/viewcvs/portals/pluto/trunk/portal/src/webapp/portlets/admin/DeployWarView.jsp?rev=289358&r1=289357&r2=289358&view=diff
==============================================================================
--- portals/pluto/trunk/portal/src/webapp/portlets/admin/DeployWarView.jsp (original)
+++ portals/pluto/trunk/portal/src/webapp/portlets/admin/DeployWarView.jsp Thu Sep 15 18:36:29 2005
@@ -20,11 +20,15 @@
<%@ page import="javax.portlet.RenderResponse" %>
<%@ page import="javax.portlet.PortletURL" %>
<%@ page session="false" %>
+<%@ page import="org.apache.pluto.portlet.admin.bean.PageTO" %>
+<%@ page import="org.apache.pluto.portlet.admin.PlutoAdminConstants" %>
<%@ taglib uri='http://java.sun.com/portlet' prefix='portlet'%>
<%@ taglib uri="http://portals.apache.org/pluto/admin" prefix="pluto-admin" %>
<portlet:defineObjects/>
-
+<%
+ PageTO ppage = (PageTO)renderRequest.getPortletSession().getAttribute(PlutoAdminConstants.PAGE_ATTR);
+%>
<p class="portlet-section-header">Deploy War</p>
<!-- 'Post' method is required for portlet action -->
<form action="<portlet:actionURL/>"
@@ -48,3 +52,13 @@
</table>
</form>
<pluto-admin:portlet-message/>
+<%
+ if(ppage != null) {
+ String pcontext = ppage.getName();
+ String hotdeployUrl = "/pluto/portal/" + pcontext + "?hotDeploy=true";
+%>
+ <a href="<%= hotdeployUrl %>" class="portlet-msg-info">Hot deploy '<%= pcontext %>' portlet application</a>
+<%
+ renderRequest.getPortletSession().removeAttribute(PlutoAdminConstants.PAGE_ATTR);
+ }
+%>