JBoss Portal SVN: r11369 - in modules/presentation/trunk/ajax/src/main/java/org/jboss/portal/presentation/ajax: client/model and 1 other directories.
by portal-commits@lists.jboss.org
Author: julien(a)jboss.com
Date: 2008-07-09 10:56:01 -0400 (Wed, 09 Jul 2008)
New Revision: 11369
Modified:
modules/presentation/trunk/ajax/src/main/java/org/jboss/portal/presentation/ajax/client/dnd/DnDPanel.java
modules/presentation/trunk/ajax/src/main/java/org/jboss/portal/presentation/ajax/client/model/AjaxLayout.java
modules/presentation/trunk/ajax/src/main/java/org/jboss/portal/presentation/ajax/client/model/AjaxObject.java
modules/presentation/trunk/ajax/src/main/java/org/jboss/portal/presentation/ajax/client/model/AjaxWindow.java
modules/presentation/trunk/ajax/src/main/java/org/jboss/portal/presentation/ajax/public/style.css
Log:
add droppable interface
Modified: modules/presentation/trunk/ajax/src/main/java/org/jboss/portal/presentation/ajax/client/dnd/DnDPanel.java
===================================================================
--- modules/presentation/trunk/ajax/src/main/java/org/jboss/portal/presentation/ajax/client/dnd/DnDPanel.java 2008-07-09 14:14:40 UTC (rev 11368)
+++ modules/presentation/trunk/ajax/src/main/java/org/jboss/portal/presentation/ajax/client/dnd/DnDPanel.java 2008-07-09 14:56:01 UTC (rev 11369)
@@ -157,10 +157,10 @@
case Event.ONMOUSEOVER:
case Event.ONMOUSEOUT:
{
- if (drag != null && element == getElement())
- {
- stopDrag();
- }
+// if (drag != null && element == getElement())
+// {
+// stopDrag();
+// }
break;
}
}
@@ -197,7 +197,7 @@
private void stopDrag()
{
- log.debug("Stopping drag with draggable " + drag.draggable);
+ log.debug("Stopping drag with draggable " + drag.draggable + " and droppable " + droppable);
//
if (droppable != null)
@@ -208,10 +208,12 @@
//
if (droppable.accept(drag.draggable))
{
+ log.debug("Droppable " + droppable + " accepted the draggable " + drag.draggable);
drag.draggable.accepted(droppable);
}
else
{
+ log.debug("Droppable " + droppable + " rejected the draggable " + drag.draggable);
drag.draggable.rejected(droppable);
}
Modified: modules/presentation/trunk/ajax/src/main/java/org/jboss/portal/presentation/ajax/client/model/AjaxLayout.java
===================================================================
--- modules/presentation/trunk/ajax/src/main/java/org/jboss/portal/presentation/ajax/client/model/AjaxLayout.java 2008-07-09 14:14:40 UTC (rev 11368)
+++ modules/presentation/trunk/ajax/src/main/java/org/jboss/portal/presentation/ajax/client/model/AjaxLayout.java 2008-07-09 14:56:01 UTC (rev 11369)
@@ -130,6 +130,35 @@
public boolean accept(Draggable draggable)
{
+ if (draggable instanceof AjaxWindow.DraggableWindow)
+ {
+ AjaxWindow.DraggableWindow draggableWindow = (AjaxWindow.DraggableWindow)draggable;
+ AjaxWindow window = draggableWindow.getWindow();
+
+ //
+ if (!getChildren().contains(window))
+ {
+ AjaxObject parent = window.getParent();
+
+ //
+ log.info("Moving window " + window.getId() + " from parent " + parent.getId() + " to layout " + getId());
+
+ //
+ parent.removeChild(window);
+
+ //
+ addChild(window);
+
+ //
+ return true;
+ }
+ else
+ {
+ log.info("Do not contain child " + window.getId());
+ }
+ }
+
+ //
return false;
}
};
@@ -149,22 +178,6 @@
return null;
}
- private boolean contains(Element container, Element contained)
- {
- if (container == contained)
- {
- return true;
- }
- for (int i = DOM.getChildCount(container) - 1;i >= 0;i--)
- {
- if (contains(DOM.getChild(container, i), contained))
- {
- return true;
- }
- }
- return false;
- }
-
protected Draggable doFindDraggable(Element element)
{
return null;
Modified: modules/presentation/trunk/ajax/src/main/java/org/jboss/portal/presentation/ajax/client/model/AjaxObject.java
===================================================================
--- modules/presentation/trunk/ajax/src/main/java/org/jboss/portal/presentation/ajax/client/model/AjaxObject.java 2008-07-09 14:14:40 UTC (rev 11368)
+++ modules/presentation/trunk/ajax/src/main/java/org/jboss/portal/presentation/ajax/client/model/AjaxObject.java 2008-07-09 14:56:01 UTC (rev 11369)
@@ -68,12 +68,16 @@
/** . */
private boolean stale;
+ /** . */
+ protected final Logger log;
+
protected AjaxObject(String id, Map properties)
{
this.id = id;
this.children = new HashMap();
this.properties = properties;
this.stale = true;
+ this.log = Logger.getLogger("AjaxObject." + id);
}
public final void createWidget()
@@ -175,7 +179,7 @@
refreshRecursive(force);
}
- private void addChild(AjaxObject child)
+ public void addChild(AjaxObject child)
{
// Create relationship
children.put(child.getId(), child);
Modified: modules/presentation/trunk/ajax/src/main/java/org/jboss/portal/presentation/ajax/client/model/AjaxWindow.java
===================================================================
--- modules/presentation/trunk/ajax/src/main/java/org/jboss/portal/presentation/ajax/client/model/AjaxWindow.java 2008-07-09 14:14:40 UTC (rev 11368)
+++ modules/presentation/trunk/ajax/src/main/java/org/jboss/portal/presentation/ajax/client/model/AjaxWindow.java 2008-07-09 14:56:01 UTC (rev 11369)
@@ -69,48 +69,64 @@
private HTML markup;
/** . */
- private Draggable draggable;
+ private DraggableWindow draggable;
- public AjaxWindow(String id, Map properties)
+ static class DraggableWindow implements Draggable
{
- super(id, properties);
- //
- draggable = new Draggable()
+ /** . */
+ private final AjaxWindow window;
+
+ DraggableWindow(AjaxWindow window)
{
- public Element getContainer()
- {
- return widget.getElement();
- }
+ this.window = window;
+ }
- public void startDragging()
- {
- widget.addStyleName("dnd-dragged");
- }
+ public AjaxWindow getWindow()
+ {
+ return window;
+ }
- public void stopDragging()
- {
- widget.removeStyleName("dnd-dragged");
- }
+ public Element getContainer()
+ {
+ return window.widget.getElement();
+ }
- public void enter(Droppable droppable)
- {
- }
+ public void startDragging()
+ {
+ window.widget.addStyleName("dnd-dragged");
+ }
- public void leave(Droppable droppable)
- {
- }
+ public void stopDragging()
+ {
+ window.widget.removeStyleName("dnd-dragged");
+ }
- public void accepted(Droppable droppable)
- {
- }
+ public void enter(Droppable droppable)
+ {
+ }
- public void rejected(Droppable droppable)
- {
- }
- };
+ public void leave(Droppable droppable)
+ {
+ }
+
+ public void accepted(Droppable droppable)
+ {
+ }
+
+ public void rejected(Droppable droppable)
+ {
+ }
}
+ public AjaxWindow(String id, Map properties)
+ {
+ super(id, properties);
+
+ //
+ draggable = new DraggableWindow(this);
+ }
+
protected Draggable doFindDraggable(Element element)
{
if (title.getElement() == element)
Modified: modules/presentation/trunk/ajax/src/main/java/org/jboss/portal/presentation/ajax/public/style.css
===================================================================
--- modules/presentation/trunk/ajax/src/main/java/org/jboss/portal/presentation/ajax/public/style.css 2008-07-09 14:14:40 UTC (rev 11368)
+++ modules/presentation/trunk/ajax/src/main/java/org/jboss/portal/presentation/ajax/public/style.css 2008-07-09 14:56:01 UTC (rev 11369)
@@ -2,7 +2,8 @@
white-space:pre;
font-family:Courier New;
font-size:12px;
- font-weight:bold;
+ font-weight:normal;
+ background-color:black;
}
.log-ERROR {
@@ -10,15 +11,15 @@
}
.log-INFO {
- color:black;
+ color:greenyellow;
}
.log-DEBUG {
- color:gray;
+ color:lightgreen;
}
.log-TRACE {
- color:lightgray;
+ color:green;
}
.pf-Pane {
16 years, 3 months
JBoss Portal SVN: r11368 - in modules/presentation/trunk/ajax/src/main/java/org/jboss/portal/presentation/ajax: client/model and 1 other directories.
by portal-commits@lists.jboss.org
Author: julien(a)jboss.com
Date: 2008-07-09 10:14:40 -0400 (Wed, 09 Jul 2008)
New Revision: 11368
Added:
modules/presentation/trunk/ajax/src/main/java/org/jboss/portal/presentation/ajax/client/dnd/Droppable.java
Modified:
modules/presentation/trunk/ajax/src/main/java/org/jboss/portal/presentation/ajax/client/dnd/DnDContext.java
modules/presentation/trunk/ajax/src/main/java/org/jboss/portal/presentation/ajax/client/dnd/DnDPanel.java
modules/presentation/trunk/ajax/src/main/java/org/jboss/portal/presentation/ajax/client/model/AjaxLayout.java
modules/presentation/trunk/ajax/src/main/java/org/jboss/portal/presentation/ajax/client/model/AjaxObject.java
modules/presentation/trunk/ajax/src/main/java/org/jboss/portal/presentation/ajax/client/model/AjaxPage.java
modules/presentation/trunk/ajax/src/main/java/org/jboss/portal/presentation/ajax/client/model/AjaxWindow.java
modules/presentation/trunk/ajax/src/main/java/org/jboss/portal/presentation/ajax/public/style.css
Log:
add droppable interface
Modified: modules/presentation/trunk/ajax/src/main/java/org/jboss/portal/presentation/ajax/client/dnd/DnDContext.java
===================================================================
--- modules/presentation/trunk/ajax/src/main/java/org/jboss/portal/presentation/ajax/client/dnd/DnDContext.java 2008-07-09 13:46:18 UTC (rev 11367)
+++ modules/presentation/trunk/ajax/src/main/java/org/jboss/portal/presentation/ajax/client/dnd/DnDContext.java 2008-07-09 14:14:40 UTC (rev 11368)
@@ -34,7 +34,7 @@
Draggable findDraggableByHandle(Panel panel, Element element);
- Object findDroppable(Element element, int x, int y);
+ Droppable findDroppable(int x, int y);
}
Modified: modules/presentation/trunk/ajax/src/main/java/org/jboss/portal/presentation/ajax/client/dnd/DnDPanel.java
===================================================================
--- modules/presentation/trunk/ajax/src/main/java/org/jboss/portal/presentation/ajax/client/dnd/DnDPanel.java 2008-07-09 13:46:18 UTC (rev 11367)
+++ modules/presentation/trunk/ajax/src/main/java/org/jboss/portal/presentation/ajax/client/dnd/DnDPanel.java 2008-07-09 14:14:40 UTC (rev 11368)
@@ -44,6 +44,9 @@
private Drag drag;
/** . */
+ private Droppable droppable;
+
+ /** . */
private DnDContext context;
public DnDPanel(DnDContext context)
@@ -114,6 +117,9 @@
);
//
+ updateDroppable(x, y);
+
+ //
// DOM.setCapture(element);
}
@@ -142,12 +148,7 @@
" on element " + element);
//
- Object droppable = context.findDroppable(element, x, y);
- if (droppable != null)
- {
- log.debug("Found droppable " + droppable);
- }
-
+ updateDroppable(x, y);
}
//
@@ -168,12 +169,62 @@
}
}
+ private void updateDroppable(int x, int y)
+ {
+ Droppable newDroppable = context.findDroppable(x, y);
+
+ //
+ if (newDroppable != null)
+ {
+ log.debug("Found droppable " + newDroppable);
+ }
+ //
+ if (droppable != newDroppable)
+ {
+ if (droppable != null)
+ {
+ droppable.leave(drag.draggable);
+ }
+ if (newDroppable != null)
+ {
+ newDroppable.enter(drag.draggable);
+ }
+ }
+
+ //
+ droppable = newDroppable;
+ }
+
private void stopDrag()
{
log.debug("Stopping drag with draggable " + drag.draggable);
+
+ //
+ if (droppable != null)
+ {
+ droppable.leave(drag.draggable);
+ drag.draggable.stopDragging();
+
+ //
+ if (droppable.accept(drag.draggable))
+ {
+ drag.draggable.accepted(droppable);
+ }
+ else
+ {
+ drag.draggable.rejected(droppable);
+ }
+
+ //
+ droppable = null;
+ }
+ else
+ {
+ drag.draggable.stopDragging();
+ }
+
// DOM.releaseCapture(drag.element);
Element containerElement = drag.draggable.getContainer();
- drag.draggable.stopDragging();
DOM.setStyleAttribute(containerElement, "position", null);
drag = null;
}
Added: modules/presentation/trunk/ajax/src/main/java/org/jboss/portal/presentation/ajax/client/dnd/Droppable.java
===================================================================
--- modules/presentation/trunk/ajax/src/main/java/org/jboss/portal/presentation/ajax/client/dnd/Droppable.java (rev 0)
+++ modules/presentation/trunk/ajax/src/main/java/org/jboss/portal/presentation/ajax/client/dnd/Droppable.java 2008-07-09 14:14:40 UTC (rev 11368)
@@ -0,0 +1,38 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2008, 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.jboss.portal.presentation.ajax.client.dnd;
+
+/**
+ * @author <a href="mailto:julien@jboss-portal.org">Julien Viet</a>
+ * @version $Revision: 630 $
+ */
+public interface Droppable
+{
+
+ void enter(Draggable draggable);
+
+ void leave(Draggable draggable);
+
+ boolean accept(Draggable draggable);
+
+}
Modified: modules/presentation/trunk/ajax/src/main/java/org/jboss/portal/presentation/ajax/client/model/AjaxLayout.java
===================================================================
--- modules/presentation/trunk/ajax/src/main/java/org/jboss/portal/presentation/ajax/client/model/AjaxLayout.java 2008-07-09 13:46:18 UTC (rev 11367)
+++ modules/presentation/trunk/ajax/src/main/java/org/jboss/portal/presentation/ajax/client/model/AjaxLayout.java 2008-07-09 14:14:40 UTC (rev 11368)
@@ -34,6 +34,7 @@
import org.jboss.portal.presentation.ajax.client.Constants;
import org.jboss.portal.presentation.ajax.client.dnd.Draggable;
+import org.jboss.portal.presentation.ajax.client.dnd.Droppable;
/**
* @author <a href="mailto:julien@jboss-portal.org">Julien Viet</a>
@@ -115,15 +116,33 @@
this.layout = layout;
}
- protected Object doFindDroppable(int x, int y)
+ private final Droppable droppable = new Droppable()
{
+ public void enter(Draggable draggable)
+ {
+ layout.addStyleName("dnd-selected");
+ }
+
+ public void leave(Draggable draggable)
+ {
+ layout.removeStyleName("dnd-selected");
+ }
+
+ public boolean accept(Draggable draggable)
+ {
+ return false;
+ }
+ };
+
+ protected Droppable doFindDroppable(int x, int y)
+ {
int left = layout.getAbsoluteLeft();
int right = left + layout.getOffsetWidth();
int top = layout.getAbsoluteTop();
int bottom = top + layout.getOffsetHeight();
if (x >= left && x <= right && y >= top && y <= bottom)
{
- return this;
+ return droppable;
}
//
Modified: modules/presentation/trunk/ajax/src/main/java/org/jboss/portal/presentation/ajax/client/model/AjaxObject.java
===================================================================
--- modules/presentation/trunk/ajax/src/main/java/org/jboss/portal/presentation/ajax/client/model/AjaxObject.java 2008-07-09 13:46:18 UTC (rev 11367)
+++ modules/presentation/trunk/ajax/src/main/java/org/jboss/portal/presentation/ajax/client/model/AjaxObject.java 2008-07-09 14:14:40 UTC (rev 11368)
@@ -41,6 +41,7 @@
import org.jboss.portal.presentation.ajax.client.util.logging.Logger;
import org.jboss.portal.presentation.ajax.client.AgentContext;
import org.jboss.portal.presentation.ajax.client.dnd.Draggable;
+import org.jboss.portal.presentation.ajax.client.dnd.Droppable;
/**
* @author <a href="mailto:julien@jboss-portal.org">Julien Viet</a>
@@ -146,14 +147,14 @@
return draggable;
}
- public final Object findDroppable(int x, int y)
+ public final Droppable findDroppable(int x, int y)
{
for (Iterator i = getChildren().iterator();i.hasNext();)
{
AjaxObject child = (AjaxObject)i.next();
//
- Object droppable = child.findDroppable(x, y);
+ Droppable droppable = child.findDroppable(x, y);
//
if (droppable != null)
@@ -246,7 +247,7 @@
protected abstract Draggable doFindDraggable(Element element);
- protected abstract Object doFindDroppable(int x, int y);
+ protected abstract Droppable doFindDroppable(int x, int y);
public abstract Widget getWidget();
Modified: modules/presentation/trunk/ajax/src/main/java/org/jboss/portal/presentation/ajax/client/model/AjaxPage.java
===================================================================
--- modules/presentation/trunk/ajax/src/main/java/org/jboss/portal/presentation/ajax/client/model/AjaxPage.java 2008-07-09 13:46:18 UTC (rev 11367)
+++ modules/presentation/trunk/ajax/src/main/java/org/jboss/portal/presentation/ajax/client/model/AjaxPage.java 2008-07-09 14:14:40 UTC (rev 11368)
@@ -33,6 +33,7 @@
import org.jboss.portal.presentation.ajax.client.dnd.DnDPanel;
import org.jboss.portal.presentation.ajax.client.dnd.DnDContext;
import org.jboss.portal.presentation.ajax.client.dnd.Draggable;
+import org.jboss.portal.presentation.ajax.client.dnd.Droppable;
/**
* @author <a href="mailto:julien@jboss-portal.org">Julien Viet</a>
@@ -96,7 +97,7 @@
return findDraggabble(element);
}
- public Object findDroppable(Element element, int x, int y)
+ public Droppable findDroppable(int x, int y)
{
return AjaxPage.this.findDroppable(x, y);
}
Modified: modules/presentation/trunk/ajax/src/main/java/org/jboss/portal/presentation/ajax/client/model/AjaxWindow.java
===================================================================
--- modules/presentation/trunk/ajax/src/main/java/org/jboss/portal/presentation/ajax/client/model/AjaxWindow.java 2008-07-09 13:46:18 UTC (rev 11367)
+++ modules/presentation/trunk/ajax/src/main/java/org/jboss/portal/presentation/ajax/client/model/AjaxWindow.java 2008-07-09 14:14:40 UTC (rev 11368)
@@ -85,12 +85,12 @@
public void startDragging()
{
- widget.addStyleName("dragged");
+ widget.addStyleName("dnd-dragged");
}
public void stopDragging()
{
- widget.removeStyleName("dragged");
+ widget.removeStyleName("dnd-dragged");
}
public void enter(Droppable droppable)
@@ -264,7 +264,7 @@
{
}
- protected Object doFindDroppable(int x, int y)
+ protected Droppable doFindDroppable(int x, int y)
{
return null;
}
Modified: modules/presentation/trunk/ajax/src/main/java/org/jboss/portal/presentation/ajax/public/style.css
===================================================================
--- modules/presentation/trunk/ajax/src/main/java/org/jboss/portal/presentation/ajax/public/style.css 2008-07-09 13:46:18 UTC (rev 11367)
+++ modules/presentation/trunk/ajax/src/main/java/org/jboss/portal/presentation/ajax/public/style.css 2008-07-09 14:14:40 UTC (rev 11368)
@@ -31,7 +31,7 @@
padding: 1px;
}
-.pf-Window.dragged {
+.pf-Window.dnd-dragged {
background-color: blue;
}
@@ -52,6 +52,10 @@
padding: 1px;
}
+.pf-Layout.dnd-selected {
+background-color: red;
+}
+
.pf-Pane {
border: 1px solid black;
padding: 1px;
16 years, 3 months
JBoss Portal SVN: r11367 - in modules/presentation/trunk/ajax/src/main/java/org/jboss/portal/presentation/ajax: client/model and 1 other directories.
by portal-commits@lists.jboss.org
Author: julien(a)jboss.com
Date: 2008-07-09 09:46:18 -0400 (Wed, 09 Jul 2008)
New Revision: 11367
Modified:
modules/presentation/trunk/ajax/src/main/java/org/jboss/portal/presentation/ajax/client/dnd/DnDPanel.java
modules/presentation/trunk/ajax/src/main/java/org/jboss/portal/presentation/ajax/client/dnd/Draggable.java
modules/presentation/trunk/ajax/src/main/java/org/jboss/portal/presentation/ajax/client/model/AjaxWindow.java
modules/presentation/trunk/ajax/src/main/java/org/jboss/portal/presentation/ajax/public/style.css
Log:
make draggable callback to update the visual style of a dragged element
Modified: modules/presentation/trunk/ajax/src/main/java/org/jboss/portal/presentation/ajax/client/dnd/DnDPanel.java
===================================================================
--- modules/presentation/trunk/ajax/src/main/java/org/jboss/portal/presentation/ajax/client/dnd/DnDPanel.java 2008-07-09 13:23:00 UTC (rev 11366)
+++ modules/presentation/trunk/ajax/src/main/java/org/jboss/portal/presentation/ajax/client/dnd/DnDPanel.java 2008-07-09 13:46:18 UTC (rev 11367)
@@ -100,6 +100,7 @@
"," + y + "), delta=(" + deltaX + "," + deltaY + ") with draggable " + draggable);
//
+ draggable.startDragging();
DOM.setStyleAttribute(containerElement, "position", "fixed");
DOM.setIntStyleAttribute(containerElement, "left", left);
DOM.setIntStyleAttribute(containerElement, "top", top);
@@ -172,6 +173,7 @@
log.debug("Stopping drag with draggable " + drag.draggable);
// DOM.releaseCapture(drag.element);
Element containerElement = drag.draggable.getContainer();
+ drag.draggable.stopDragging();
DOM.setStyleAttribute(containerElement, "position", null);
drag = null;
}
Modified: modules/presentation/trunk/ajax/src/main/java/org/jboss/portal/presentation/ajax/client/dnd/Draggable.java
===================================================================
--- modules/presentation/trunk/ajax/src/main/java/org/jboss/portal/presentation/ajax/client/dnd/Draggable.java 2008-07-09 13:23:00 UTC (rev 11366)
+++ modules/presentation/trunk/ajax/src/main/java/org/jboss/portal/presentation/ajax/client/dnd/Draggable.java 2008-07-09 13:46:18 UTC (rev 11367)
@@ -38,8 +38,16 @@
*/
Element getContainer();
- // void enter(Droppable droppable);
+ void startDragging();
- // void leave(Droppable droppable);
+ void stopDragging();
+ void enter(Droppable droppable);
+
+ void leave(Droppable droppable);
+
+ void accepted(Droppable droppable);
+
+ void rejected(Droppable droppable);
+
}
Modified: modules/presentation/trunk/ajax/src/main/java/org/jboss/portal/presentation/ajax/client/model/AjaxWindow.java
===================================================================
--- modules/presentation/trunk/ajax/src/main/java/org/jboss/portal/presentation/ajax/client/model/AjaxWindow.java 2008-07-09 13:23:00 UTC (rev 11366)
+++ modules/presentation/trunk/ajax/src/main/java/org/jboss/portal/presentation/ajax/client/model/AjaxWindow.java 2008-07-09 13:46:18 UTC (rev 11367)
@@ -37,6 +37,7 @@
import org.jboss.portal.presentation.ajax.client.PresentationClientRemoteAsync;
import org.jboss.portal.presentation.ajax.client.PresentationClientRemote;
import org.jboss.portal.presentation.ajax.client.dnd.Draggable;
+import org.jboss.portal.presentation.ajax.client.dnd.Droppable;
import org.jboss.portal.presentation.ajax.client.protocol.OpaqueWindowAction;
import org.jboss.portal.presentation.ajax.client.protocol.DestroyObjectAction;
import org.jboss.portal.presentation.ajax.client.util.Tools;
@@ -81,6 +82,32 @@
{
return widget.getElement();
}
+
+ public void startDragging()
+ {
+ widget.addStyleName("dragged");
+ }
+
+ public void stopDragging()
+ {
+ widget.removeStyleName("dragged");
+ }
+
+ public void enter(Droppable droppable)
+ {
+ }
+
+ public void leave(Droppable droppable)
+ {
+ }
+
+ public void accepted(Droppable droppable)
+ {
+ }
+
+ public void rejected(Droppable droppable)
+ {
+ }
};
}
Modified: modules/presentation/trunk/ajax/src/main/java/org/jboss/portal/presentation/ajax/public/style.css
===================================================================
--- modules/presentation/trunk/ajax/src/main/java/org/jboss/portal/presentation/ajax/public/style.css 2008-07-09 13:23:00 UTC (rev 11366)
+++ modules/presentation/trunk/ajax/src/main/java/org/jboss/portal/presentation/ajax/public/style.css 2008-07-09 13:46:18 UTC (rev 11367)
@@ -31,6 +31,10 @@
padding: 1px;
}
+.pf-Window.dragged {
+background-color: blue;
+}
+
.pf-Title {
cursor:default;
border: 1px solid black;
16 years, 3 months
JBoss Portal SVN: r11366 - in examples/trunk/JSPHelloUser: src/main/java/org/jboss/portal/portlet/samples and 3 other directories.
by portal-commits@lists.jboss.org
Author: thomas.heute(a)jboss.com
Date: 2008-07-09 09:23:00 -0400 (Wed, 09 Jul 2008)
New Revision: 11366
Added:
examples/trunk/JSPHelloUser/src/main/java/org/jboss/portal/portlet/samples/JSPHelloUserPortlet.java
examples/trunk/JSPHelloUser/src/main/webapp/WEB-INF/default-object.xml
examples/trunk/JSPHelloUser/src/main/webapp/WEB-INF/portlet-instances.xml
examples/trunk/JSPHelloUser/src/main/webapp/jsp/
examples/trunk/JSPHelloUser/src/main/webapp/jsp/edit.jsp
examples/trunk/JSPHelloUser/src/main/webapp/jsp/hello.jsp
examples/trunk/JSPHelloUser/src/main/webapp/jsp/help.jsp
examples/trunk/JSPHelloUser/src/main/webapp/jsp/welcome.jsp
Removed:
examples/trunk/JSPHelloUser/src/main/java/org/jboss/portal/portlet/samples/SimplestHelloWorldPortlet.java
Modified:
examples/trunk/JSPHelloUser/pom.xml
examples/trunk/JSPHelloUser/src/main/webapp/WEB-INF/portlet.xml
Log:
JSP Hello User example
Modified: examples/trunk/JSPHelloUser/pom.xml
===================================================================
--- examples/trunk/JSPHelloUser/pom.xml 2008-07-09 13:12:32 UTC (rev 11365)
+++ examples/trunk/JSPHelloUser/pom.xml 2008-07-09 13:23:00 UTC (rev 11366)
@@ -4,7 +4,7 @@
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>org.jboss.portal.example</groupId>
- <artifactId>HelloWorld</artifactId>
+ <artifactId>JSPHelloUser</artifactId>
<packaging>war</packaging>
<name />
<version>0.0.1</version>
Copied: examples/trunk/JSPHelloUser/src/main/java/org/jboss/portal/portlet/samples/JSPHelloUserPortlet.java (from rev 11363, examples/trunk/JSPHelloUser/src/main/java/org/jboss/portal/portlet/samples/SimplestHelloWorldPortlet.java)
===================================================================
--- examples/trunk/JSPHelloUser/src/main/java/org/jboss/portal/portlet/samples/JSPHelloUserPortlet.java (rev 0)
+++ examples/trunk/JSPHelloUser/src/main/java/org/jboss/portal/portlet/samples/JSPHelloUserPortlet.java 2008-07-09 13:23:00 UTC (rev 11366)
@@ -0,0 +1,78 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2008, 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.jboss.portal.portlet.samples;
+
+import java.io.IOException;
+
+import javax.portlet.ActionRequest;
+import javax.portlet.ActionResponse;
+import javax.portlet.GenericPortlet;
+import javax.portlet.PortletException;
+import javax.portlet.PortletRequestDispatcher;
+import javax.portlet.RenderRequest;
+import javax.portlet.RenderResponse;
+import javax.portlet.UnavailableException;
+
+public class JSPHelloUserPortlet extends GenericPortlet
+{
+
+ public void doView(RenderRequest request, RenderResponse response) throws PortletException, IOException
+ {
+ String sYourName = (String) request.getParameter("yourname");
+ if (sYourName != null)
+ {
+ request.setAttribute("yourname", sYourName);
+ PortletRequestDispatcher prd = getPortletContext().getRequestDispatcher("/jsp/hello.jsp");
+ prd.include(request, response);
+ }
+ else
+ {
+ PortletRequestDispatcher prd = getPortletContext().getRequestDispatcher("/jsp/welcome.jsp");
+ prd.include(request, response);
+ }
+ }
+
+ public void processAction(ActionRequest aRequest, ActionResponse aResponse) throws PortletException, IOException,
+ UnavailableException
+ {
+ String sYourname = (String) aRequest.getParameter("yourname");
+ aResponse.setRenderParameter("yourname", sYourname);
+ }
+
+ protected void doHelp(RenderRequest rRequest, RenderResponse rResponse) throws PortletException, IOException,
+ UnavailableException
+ {
+ rResponse.setContentType("text/html");
+ PortletRequestDispatcher prd = getPortletContext().getRequestDispatcher("/jsp/help.jsp");
+ prd.include(rRequest, rResponse);
+ }
+
+ protected void doEdit(RenderRequest rRequest, RenderResponse rResponse) throws PortletException, IOException,
+ UnavailableException
+ {
+ rResponse.setContentType("text/html");
+ PortletRequestDispatcher prd = getPortletContext().getRequestDispatcher("/jsp/edit.jsp");
+ prd.include(rRequest, rResponse);
+ }
+
+}
Deleted: examples/trunk/JSPHelloUser/src/main/java/org/jboss/portal/portlet/samples/SimplestHelloWorldPortlet.java
===================================================================
--- examples/trunk/JSPHelloUser/src/main/java/org/jboss/portal/portlet/samples/SimplestHelloWorldPortlet.java 2008-07-09 13:12:32 UTC (rev 11365)
+++ examples/trunk/JSPHelloUser/src/main/java/org/jboss/portal/portlet/samples/SimplestHelloWorldPortlet.java 2008-07-09 13:23:00 UTC (rev 11366)
@@ -1,53 +0,0 @@
-/******************************************************************************
- * 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. *
- ******************************************************************************/
-package org.jboss.portal.portlet.samples;
-
-import java.io.IOException;
-import java.io.PrintWriter;
-
-import javax.portlet.GenericPortlet;
-import javax.portlet.PortletException;
-import javax.portlet.RenderRequest;
-import javax.portlet.RenderResponse;
-
-/**
- * @author <a href="mailto:theute@jboss.org">Thomas Heute</a>
- * @version $Revision$
- */
-public class SimplestHelloWorldPortlet extends GenericPortlet
-{
- public void doView(RenderRequest request, RenderResponse response) throws PortletException
- {
- try
- {
- PrintWriter writer = response.getWriter();
- writer.write("Hello World !");
- writer.close();
- }
- catch (IOException e)
- {
- throw new PortletException(e);
- }
- }
-}
-
Added: examples/trunk/JSPHelloUser/src/main/webapp/WEB-INF/default-object.xml
===================================================================
--- examples/trunk/JSPHelloUser/src/main/webapp/WEB-INF/default-object.xml (rev 0)
+++ examples/trunk/JSPHelloUser/src/main/webapp/WEB-INF/default-object.xml 2008-07-09 13:23:00 UTC (rev 11366)
@@ -0,0 +1,42 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ ~ 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. ~
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~-->
+
+<!DOCTYPE deployments PUBLIC
+ "-//JBoss Portal//DTD Portal Object 2.6//EN"
+ "http://www.jboss.org/portal/dtd/portal-object_2_6.dtd">
+<deployments>
+ <deployment>
+ <parent-ref>default</parent-ref>
+ <if-exists>overwrite</if-exists>
+ <page>
+ <page-name>JSPHelloUser</page-name>
+ <window>
+ <window-name>JSPHelloUserWindow</window-name>
+ <instance-ref>JSPHelloUserInstance</instance-ref>
+ <region>center</region>
+ <height>0</height>
+ </window>
+ </page>
+ </deployment>
+</deployments>
\ No newline at end of file
Property changes on: examples/trunk/JSPHelloUser/src/main/webapp/WEB-INF/default-object.xml
___________________________________________________________________
Name: svn:executable
+ *
Added: examples/trunk/JSPHelloUser/src/main/webapp/WEB-INF/portlet-instances.xml
===================================================================
--- examples/trunk/JSPHelloUser/src/main/webapp/WEB-INF/portlet-instances.xml (rev 0)
+++ examples/trunk/JSPHelloUser/src/main/webapp/WEB-INF/portlet-instances.xml 2008-07-09 13:23:00 UTC (rev 11366)
@@ -0,0 +1,34 @@
+<?xml version="1.0" standalone="yes"?>
+<!--~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ ~ 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. ~
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~-->
+<!DOCTYPE deployments PUBLIC
+ "-//JBoss Portal//DTD Portlet Instances 2.6//EN"
+ "http://www.jboss.org/portlet/dtd/portlet-instances_2_6.dtd">
+<deployments>
+ <deployment>
+ <instance>
+ <instance-id>JSPHelloUserInstance</instance-id>
+ <portlet-ref>JSPHelloUserPortlet</portlet-ref>
+ </instance>
+ </deployment>
+</deployments>
\ No newline at end of file
Property changes on: examples/trunk/JSPHelloUser/src/main/webapp/WEB-INF/portlet-instances.xml
___________________________________________________________________
Name: svn:executable
+ *
Modified: examples/trunk/JSPHelloUser/src/main/webapp/WEB-INF/portlet.xml
===================================================================
--- examples/trunk/JSPHelloUser/src/main/webapp/WEB-INF/portlet.xml 2008-07-09 13:12:32 UTC (rev 11365)
+++ examples/trunk/JSPHelloUser/src/main/webapp/WEB-INF/portlet.xml 2008-07-09 13:23:00 UTC (rev 11366)
@@ -5,15 +5,18 @@
http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd"
version="2.0">
<portlet>
- <portlet-name>HelloWorldPortlet</portlet-name>
+ <portlet-name>JSPHelloUserPortlet</portlet-name>
<portlet-class>
- org.jboss.portal.portlet.samples.SimplestHelloWorldPortlet
+ org.jboss.portal.portlet.samples.JSPHelloUserPortlet
</portlet-class>
<supports>
<mime-type>text/html</mime-type>
+ <mode>view</mode>
+ <mode>edit</mode>
+ <mode>help</mode>
</supports>
<portlet-info>
- <title>Simplest Hello World Portlet</title>
+ <title>JSP Hello User Portlet</title>
</portlet-info>
</portlet>
</portlet-app>
\ No newline at end of file
Added: examples/trunk/JSPHelloUser/src/main/webapp/jsp/edit.jsp
===================================================================
--- examples/trunk/JSPHelloUser/src/main/webapp/jsp/edit.jsp (rev 0)
+++ examples/trunk/JSPHelloUser/src/main/webapp/jsp/edit.jsp 2008-07-09 13:23:00 UTC (rev 11366)
@@ -0,0 +1,2 @@
+<div class="portlet-section-header">Edit mode</div>
+<div class='Portlet-section-body">This is the edit mode, a convenient place to let the user change his portlet preferences.</div>
\ No newline at end of file
Added: examples/trunk/JSPHelloUser/src/main/webapp/jsp/hello.jsp
===================================================================
--- examples/trunk/JSPHelloUser/src/main/webapp/jsp/hello.jsp (rev 0)
+++ examples/trunk/JSPHelloUser/src/main/webapp/jsp/hello.jsp 2008-07-09 13:23:00 UTC (rev 11366)
@@ -0,0 +1,8 @@
+<%@ taglib uri="http://java.sun.com/portlet" prefix="portlet" %>
+<portlet:defineObjects/>
+
+<div class="portlet-section-header">Remember we love you: <%= renderRequest.getParameter("yourname") %></div>
+
+<portlet:renderURL var="myRenderURL"/>
+<br/>
+<a href="<%= myRenderURL %>">Ask me again</a></div>
Added: examples/trunk/JSPHelloUser/src/main/webapp/jsp/help.jsp
===================================================================
--- examples/trunk/JSPHelloUser/src/main/webapp/jsp/help.jsp (rev 0)
+++ examples/trunk/JSPHelloUser/src/main/webapp/jsp/help.jsp 2008-07-09 13:23:00 UTC (rev 11366)
@@ -0,0 +1,2 @@
+<div class="portlet-section-header">Help mode</div>
+<div class='Portlet-section-body">This is the help mode, a convenient place to give the user some help information.</div>
\ No newline at end of file
Added: examples/trunk/JSPHelloUser/src/main/webapp/jsp/welcome.jsp
===================================================================
--- examples/trunk/JSPHelloUser/src/main/webapp/jsp/welcome.jsp (rev 0)
+++ examples/trunk/JSPHelloUser/src/main/webapp/jsp/welcome.jsp 2008-07-09 13:23:00 UTC (rev 11366)
@@ -0,0 +1,35 @@
+<%@ taglib uri="http://java.sun.com/portlet" prefix="portlet" %>
+
+<div class="portlet-section-header">Welcome !</div>
+
+<br/>
+
+<div class="portlet-font">Welcome on the JSP Hello User portlet,
+my name is JBoss Portal. What's yours ?</div>
+
+<br/>
+
+<div class="portlet-font">Method 1: We simply pass the parameter to the render phase:<br/>
+<a href="<portlet:renderURL><portlet:param name="yourname" value="John Doe"/></portlet:renderURL>">John Doe</a></div>
+
+<br/>
+
+<div class="portlet-font">Method 2: We pass the parameter to the render phase, using valid XML:
+Please check the source code to see the difference with Method 1.
+<portlet:renderURL var="myRenderURL">
+ <portlet:param name="yourname" value='John Doe'/>
+</portlet:renderURL>
+<br/>
+<a href="<%= myRenderURL %>">John Doe</a></div>
+
+<br/>
+
+<div class="portlet-font">Method 3: We use a form:<br/>
+
+<portlet:actionURL var="myActionURL"/>
+<form action="<%= myActionURL %>" method="POST">
+ <span class="portlet-form-field-label">Name:</span>
+ <input class="portlet-form-input-field" type="text" name="yourname"/>
+ <input class="portlet-form-button" type="Submit"/>
+</form>
+</div>
\ No newline at end of file
16 years, 3 months
JBoss Portal SVN: r11365 - in modules/presentation/trunk/ajax/src/main/java/org/jboss/portal/presentation/ajax/client: dnd and 1 other directories.
by portal-commits@lists.jboss.org
Author: julien(a)jboss.com
Date: 2008-07-09 09:12:32 -0400 (Wed, 09 Jul 2008)
New Revision: 11365
Modified:
modules/presentation/trunk/ajax/src/main/java/org/jboss/portal/presentation/ajax/client/PresentationClientAgent.java
modules/presentation/trunk/ajax/src/main/java/org/jboss/portal/presentation/ajax/client/dnd/DnDContext.java
modules/presentation/trunk/ajax/src/main/java/org/jboss/portal/presentation/ajax/client/dnd/DnDPanel.java
modules/presentation/trunk/ajax/src/main/java/org/jboss/portal/presentation/ajax/client/dnd/Draggable.java
modules/presentation/trunk/ajax/src/main/java/org/jboss/portal/presentation/ajax/client/model/AjaxLayout.java
modules/presentation/trunk/ajax/src/main/java/org/jboss/portal/presentation/ajax/client/model/AjaxObject.java
modules/presentation/trunk/ajax/src/main/java/org/jboss/portal/presentation/ajax/client/model/AjaxPage.java
modules/presentation/trunk/ajax/src/main/java/org/jboss/portal/presentation/ajax/client/model/AjaxWindow.java
Log:
start to implement drag and drop
Modified: modules/presentation/trunk/ajax/src/main/java/org/jboss/portal/presentation/ajax/client/PresentationClientAgent.java
===================================================================
--- modules/presentation/trunk/ajax/src/main/java/org/jboss/portal/presentation/ajax/client/PresentationClientAgent.java 2008-07-09 12:16:31 UTC (rev 11364)
+++ modules/presentation/trunk/ajax/src/main/java/org/jboss/portal/presentation/ajax/client/PresentationClientAgent.java 2008-07-09 13:12:32 UTC (rev 11365)
@@ -29,6 +29,8 @@
import com.google.gwt.user.client.ui.VerticalPanel;
import com.google.gwt.user.client.rpc.ServiceDefTarget;
import com.google.gwt.user.client.rpc.AsyncCallback;
+import com.google.gwt.user.client.DOM;
+import com.google.gwt.user.client.Window;
import org.jboss.portal.presentation.ajax.client.model.update.ModelUpdate;
import org.jboss.portal.presentation.ajax.client.model.AjaxObject;
import org.jboss.portal.presentation.ajax.client.util.Bootstrap;
@@ -61,20 +63,15 @@
public void onModuleLoad()
{
- VerticalPanel main = new VerticalPanel();
-
- //
- RootPanel.get().add(main);
-
- //
AppenderWidget appender = new AppenderWidget();
- main.add(appender);
+ RootPanel.get().add(appender, 0, Window.getClientHeight() - 128);
+ DOM.setIntStyleAttribute(appender.getElement(), "zIndex", 1);
Logger.registerAppender(appender);
log.info("Added logger");
//
final AbsolutePanel bottom = new AbsolutePanel();
- main.add(bottom);
+ RootPanel.get().add(bottom);
//
Bootstrap.init();
Modified: modules/presentation/trunk/ajax/src/main/java/org/jboss/portal/presentation/ajax/client/dnd/DnDContext.java
===================================================================
--- modules/presentation/trunk/ajax/src/main/java/org/jboss/portal/presentation/ajax/client/dnd/DnDContext.java 2008-07-09 12:16:31 UTC (rev 11364)
+++ modules/presentation/trunk/ajax/src/main/java/org/jboss/portal/presentation/ajax/client/dnd/DnDContext.java 2008-07-09 13:12:32 UTC (rev 11365)
@@ -34,6 +34,7 @@
Draggable findDraggableByHandle(Panel panel, Element element);
- Object findDroppable(Element element);
+ Object findDroppable(Element element, int x, int y);
+
}
Modified: modules/presentation/trunk/ajax/src/main/java/org/jboss/portal/presentation/ajax/client/dnd/DnDPanel.java
===================================================================
--- modules/presentation/trunk/ajax/src/main/java/org/jboss/portal/presentation/ajax/client/dnd/DnDPanel.java 2008-07-09 12:16:31 UTC (rev 11364)
+++ modules/presentation/trunk/ajax/src/main/java/org/jboss/portal/presentation/ajax/client/dnd/DnDPanel.java 2008-07-09 13:12:32 UTC (rev 11365)
@@ -141,10 +141,10 @@
" on element " + element);
//
- Object droppable = context.findDroppable(element);
+ Object droppable = context.findDroppable(element, x, y);
if (droppable != null)
{
- Window.alert("Found droppable " + droppable);
+ log.debug("Found droppable " + droppable);
}
}
Modified: modules/presentation/trunk/ajax/src/main/java/org/jboss/portal/presentation/ajax/client/dnd/Draggable.java
===================================================================
--- modules/presentation/trunk/ajax/src/main/java/org/jboss/portal/presentation/ajax/client/dnd/Draggable.java 2008-07-09 12:16:31 UTC (rev 11364)
+++ modules/presentation/trunk/ajax/src/main/java/org/jboss/portal/presentation/ajax/client/dnd/Draggable.java 2008-07-09 13:12:32 UTC (rev 11365)
@@ -38,4 +38,8 @@
*/
Element getContainer();
+ // void enter(Droppable droppable);
+
+ // void leave(Droppable droppable);
+
}
Modified: modules/presentation/trunk/ajax/src/main/java/org/jboss/portal/presentation/ajax/client/model/AjaxLayout.java
===================================================================
--- modules/presentation/trunk/ajax/src/main/java/org/jboss/portal/presentation/ajax/client/model/AjaxLayout.java 2008-07-09 12:16:31 UTC (rev 11364)
+++ modules/presentation/trunk/ajax/src/main/java/org/jboss/portal/presentation/ajax/client/model/AjaxLayout.java 2008-07-09 13:12:32 UTC (rev 11365)
@@ -27,6 +27,7 @@
import com.google.gwt.user.client.ui.Panel;
import com.google.gwt.user.client.ui.Widget;
import com.google.gwt.user.client.Element;
+import com.google.gwt.user.client.DOM;
import java.util.Iterator;
import java.util.Map;
@@ -114,17 +115,36 @@
this.layout = layout;
}
- protected Object doFindDroppable(Element element)
+ protected Object doFindDroppable(int x, int y)
{
- if (element == layout.getElement())
+ int left = layout.getAbsoluteLeft();
+ int right = left + layout.getOffsetWidth();
+ int top = layout.getAbsoluteTop();
+ int bottom = top + layout.getOffsetHeight();
+ if (x >= left && x <= right && y >= top && y <= bottom)
{
return this;
}
//
- return null;
+ return null;
}
+ private boolean contains(Element container, Element contained)
+ {
+ if (container == contained)
+ {
+ return true;
+ }
+ for (int i = DOM.getChildCount(container) - 1;i >= 0;i--)
+ {
+ if (contains(DOM.getChild(container, i), contained))
+ {
+ return true;
+ }
+ }
+ return false;
+ }
protected Draggable doFindDraggable(Element element)
{
Modified: modules/presentation/trunk/ajax/src/main/java/org/jboss/portal/presentation/ajax/client/model/AjaxObject.java
===================================================================
--- modules/presentation/trunk/ajax/src/main/java/org/jboss/portal/presentation/ajax/client/model/AjaxObject.java 2008-07-09 12:16:31 UTC (rev 11364)
+++ modules/presentation/trunk/ajax/src/main/java/org/jboss/portal/presentation/ajax/client/model/AjaxObject.java 2008-07-09 13:12:32 UTC (rev 11365)
@@ -129,38 +129,41 @@
}
}
- public final Object findDroppable(Element element)
+ public final Draggable findDraggabble(Element element)
{
- Object droppable = doFindDroppable(element);
+ Draggable draggable = doFindDraggable(element);
//
- for (Iterator i = getChildren().iterator();i.hasNext() && droppable == null;)
+ for (Iterator i = getChildren().iterator();i.hasNext() && draggable == null;)
{
AjaxObject child = (AjaxObject)i.next();
//
- droppable = child.findDroppable(element);
+ draggable = child.findDraggabble(element);
}
-
+
//
- return droppable;
+ return draggable;
}
- public final Draggable findDraggabble(Element element)
+ public final Object findDroppable(int x, int y)
{
- Draggable draggable = doFindDraggable(element);
-
- //
- for (Iterator i = getChildren().iterator();i.hasNext() && draggable == null;)
+ for (Iterator i = getChildren().iterator();i.hasNext();)
{
AjaxObject child = (AjaxObject)i.next();
//
- draggable = child.findDraggabble(element);
+ Object droppable = child.findDroppable(x, y);
+
+ //
+ if (droppable != null)
+ {
+ return droppable;
+ }
}
-
+
//
- return draggable;
+ return doFindDroppable(x, y);
}
public final void refresh(boolean force)
@@ -226,6 +229,11 @@
return parent;
}
+ public String toString()
+ {
+ return "AjaxObject[id=" + id + "]";
+ }
+
protected abstract void doCreateWidget();
protected abstract void doRefresh(boolean force);
@@ -238,7 +246,7 @@
protected abstract Draggable doFindDraggable(Element element);
- protected abstract Object doFindDroppable(Element element);
+ protected abstract Object doFindDroppable(int x, int y);
public abstract Widget getWidget();
Modified: modules/presentation/trunk/ajax/src/main/java/org/jboss/portal/presentation/ajax/client/model/AjaxPage.java
===================================================================
--- modules/presentation/trunk/ajax/src/main/java/org/jboss/portal/presentation/ajax/client/model/AjaxPage.java 2008-07-09 12:16:31 UTC (rev 11364)
+++ modules/presentation/trunk/ajax/src/main/java/org/jboss/portal/presentation/ajax/client/model/AjaxPage.java 2008-07-09 13:12:32 UTC (rev 11365)
@@ -95,9 +95,10 @@
{
return findDraggabble(element);
}
- public Object findDroppable(Element element)
+
+ public Object findDroppable(Element element, int x, int y)
{
- return AjaxPage.this.findDroppable(element);
+ return AjaxPage.this.findDroppable(x, y);
}
};
}
Modified: modules/presentation/trunk/ajax/src/main/java/org/jboss/portal/presentation/ajax/client/model/AjaxWindow.java
===================================================================
--- modules/presentation/trunk/ajax/src/main/java/org/jboss/portal/presentation/ajax/client/model/AjaxWindow.java 2008-07-09 12:16:31 UTC (rev 11364)
+++ modules/presentation/trunk/ajax/src/main/java/org/jboss/portal/presentation/ajax/client/model/AjaxWindow.java 2008-07-09 13:12:32 UTC (rev 11365)
@@ -96,11 +96,6 @@
}
}
- protected Object doFindDroppable(Element element)
- {
- return null;
- }
-
protected void doCreateWidget()
{
//
@@ -242,6 +237,11 @@
{
}
+ protected Object doFindDroppable(int x, int y)
+ {
+ return null;
+ }
+
protected void doRemoveChild(AjaxObject child)
{
throw new UnsupportedOperationException();
16 years, 3 months
JBoss Portal SVN: r11364 - in examples/trunk/SimplestHelloWorld: .settings and 2 other directories.
by portal-commits@lists.jboss.org
Author: thomas.heute(a)jboss.com
Date: 2008-07-09 08:16:31 -0400 (Wed, 09 Jul 2008)
New Revision: 11364
Added:
examples/trunk/SimplestHelloWorld/src/main/webapp/WEB-INF/default-object.xml
examples/trunk/SimplestHelloWorld/src/main/webapp/WEB-INF/portlet-instances.xml
Modified:
examples/trunk/SimplestHelloWorld/.classpath
examples/trunk/SimplestHelloWorld/.project
examples/trunk/SimplestHelloWorld/.settings/org.eclipse.wst.common.component
examples/trunk/SimplestHelloWorld/pom.xml
examples/trunk/SimplestHelloWorld/src/main/java/org/jboss/portal/portlet/samples/SimplestHelloWorldPortlet.java
examples/trunk/SimplestHelloWorld/src/main/webapp/WEB-INF/portlet.xml
Log:
minor
Modified: examples/trunk/SimplestHelloWorld/.classpath
===================================================================
--- examples/trunk/SimplestHelloWorld/.classpath 2008-07-09 12:06:52 UTC (rev 11363)
+++ examples/trunk/SimplestHelloWorld/.classpath 2008-07-09 12:16:31 UTC (rev 11364)
@@ -5,12 +5,12 @@
<classpathentry excluding="**" kind="src" output="target/classes" path="src/main/resources"/>
<classpathentry excluding="**" kind="src" output="target/test-classes" path="src/test/resources"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
+ <classpathentry kind="con" path="org.eclipse.jst.j2ee.internal.web.container"/>
+ <classpathentry kind="con" path="org.eclipse.jst.j2ee.internal.module.container"/>
<classpathentry kind="con" path="org.maven.ide.eclipse.MAVEN2_CLASSPATH_CONTAINER">
<attributes>
<attribute name="org.eclipse.jst.component.dependency" value="/WEB-INF/lib"/>
</attributes>
</classpathentry>
- <classpathentry kind="con" path="org.eclipse.jst.j2ee.internal.web.container"/>
- <classpathentry kind="con" path="org.eclipse.jst.j2ee.internal.module.container"/>
<classpathentry kind="output" path="target/classes"/>
</classpath>
Modified: examples/trunk/SimplestHelloWorld/.project
===================================================================
--- examples/trunk/SimplestHelloWorld/.project 2008-07-09 12:06:52 UTC (rev 11363)
+++ examples/trunk/SimplestHelloWorld/.project 2008-07-09 12:16:31 UTC (rev 11364)
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
- <name>HelloWorld</name>
+ <name>SimplestHelloWorldPortlet</name>
<comment></comment>
<projects>
</projects>
Modified: examples/trunk/SimplestHelloWorld/.settings/org.eclipse.wst.common.component
===================================================================
--- examples/trunk/SimplestHelloWorld/.settings/org.eclipse.wst.common.component 2008-07-09 12:06:52 UTC (rev 11363)
+++ examples/trunk/SimplestHelloWorld/.settings/org.eclipse.wst.common.component 2008-07-09 12:16:31 UTC (rev 11364)
@@ -1,12 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?>
<project-modules id="moduleCoreId" project-version="1.5.0">
-<wb-module deploy-name="HelloWorld">
+<wb-module deploy-name="SimplestHelloWorldPortlet">
<wb-resource deploy-path="/" source-path="/src/main/webapp"/>
<wb-resource deploy-path="/WEB-INF/classes" source-path="/src/main/java"/>
<wb-resource deploy-path="/WEB-INF/classes" source-path="/src/main/resources"/>
<wb-resource deploy-path="/" source-path="/src/test/java"/>
<wb-resource deploy-path="/" source-path="/src/test/resources"/>
-<property name="context-root" value="HelloWorld"/>
<property name="java-output-path" value="build/classes"/>
+<property name="context-root" value="SimplestHelloWorldPortlet"/>
</wb-module>
</project-modules>
Modified: examples/trunk/SimplestHelloWorld/pom.xml
===================================================================
--- examples/trunk/SimplestHelloWorld/pom.xml 2008-07-09 12:06:52 UTC (rev 11363)
+++ examples/trunk/SimplestHelloWorld/pom.xml 2008-07-09 12:16:31 UTC (rev 11364)
@@ -4,7 +4,7 @@
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>org.jboss.portal.example</groupId>
- <artifactId>HelloWorld</artifactId>
+ <artifactId>SimplestHelloWorld</artifactId>
<packaging>war</packaging>
<name />
<version>0.0.1</version>
Modified: examples/trunk/SimplestHelloWorld/src/main/java/org/jboss/portal/portlet/samples/SimplestHelloWorldPortlet.java
===================================================================
--- examples/trunk/SimplestHelloWorld/src/main/java/org/jboss/portal/portlet/samples/SimplestHelloWorldPortlet.java 2008-07-09 12:06:52 UTC (rev 11363)
+++ examples/trunk/SimplestHelloWorld/src/main/java/org/jboss/portal/portlet/samples/SimplestHelloWorldPortlet.java 2008-07-09 12:16:31 UTC (rev 11364)
@@ -26,28 +26,16 @@
import java.io.PrintWriter;
import javax.portlet.GenericPortlet;
-import javax.portlet.PortletException;
import javax.portlet.RenderRequest;
import javax.portlet.RenderResponse;
-/**
- * @author <a href="mailto:theute@jboss.org">Thomas Heute</a>
- * @version $Revision$
- */
public class SimplestHelloWorldPortlet extends GenericPortlet
{
- public void doView(RenderRequest request, RenderResponse response) throws PortletException
+ public void doView(RenderRequest request, RenderResponse response) throws IOException
{
- try
- {
- PrintWriter writer = response.getWriter();
- writer.write("Hello World !");
- writer.close();
- }
- catch (IOException e)
- {
- throw new PortletException(e);
- }
+ PrintWriter writer = response.getWriter();
+ writer.write("Hello World !");
+ writer.close();
}
}
Added: examples/trunk/SimplestHelloWorld/src/main/webapp/WEB-INF/default-object.xml
===================================================================
--- examples/trunk/SimplestHelloWorld/src/main/webapp/WEB-INF/default-object.xml (rev 0)
+++ examples/trunk/SimplestHelloWorld/src/main/webapp/WEB-INF/default-object.xml 2008-07-09 12:16:31 UTC (rev 11364)
@@ -0,0 +1,42 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ ~ 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. ~
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~-->
+
+<!DOCTYPE deployments PUBLIC
+ "-//JBoss Portal//DTD Portal Object 2.6//EN"
+ "http://www.jboss.org/portal/dtd/portal-object_2_6.dtd">
+<deployments>
+ <deployment>
+ <parent-ref>default</parent-ref>
+ <if-exists>overwrite</if-exists>
+ <page>
+ <page-name>SimplestHelloWorld</page-name>
+ <window>
+ <window-name>SimplestHelloWorldWindow</window-name>
+ <instance-ref>SimplestHelloWorldInstance</instance-ref>
+ <region>center</region>
+ <height>0</height>
+ </window>
+ </page>
+ </deployment>
+</deployments>
\ No newline at end of file
Property changes on: examples/trunk/SimplestHelloWorld/src/main/webapp/WEB-INF/default-object.xml
___________________________________________________________________
Name: svn:executable
+ *
Added: examples/trunk/SimplestHelloWorld/src/main/webapp/WEB-INF/portlet-instances.xml
===================================================================
--- examples/trunk/SimplestHelloWorld/src/main/webapp/WEB-INF/portlet-instances.xml (rev 0)
+++ examples/trunk/SimplestHelloWorld/src/main/webapp/WEB-INF/portlet-instances.xml 2008-07-09 12:16:31 UTC (rev 11364)
@@ -0,0 +1,34 @@
+<?xml version="1.0" standalone="yes"?>
+<!--~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ ~ 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. ~
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~-->
+<!DOCTYPE deployments PUBLIC
+ "-//JBoss Portal//DTD Portlet Instances 2.6//EN"
+ "http://www.jboss.org/portlet/dtd/portlet-instances_2_6.dtd">
+<deployments>
+ <deployment>
+ <instance>
+ <instance-id>SimplestHelloWorldInstance</instance-id>
+ <portlet-ref>SimplestHelloWorldPortlet</portlet-ref>
+ </instance>
+ </deployment>
+</deployments>
\ No newline at end of file
Property changes on: examples/trunk/SimplestHelloWorld/src/main/webapp/WEB-INF/portlet-instances.xml
___________________________________________________________________
Name: svn:executable
+ *
Modified: examples/trunk/SimplestHelloWorld/src/main/webapp/WEB-INF/portlet.xml
===================================================================
--- examples/trunk/SimplestHelloWorld/src/main/webapp/WEB-INF/portlet.xml 2008-07-09 12:06:52 UTC (rev 11363)
+++ examples/trunk/SimplestHelloWorld/src/main/webapp/WEB-INF/portlet.xml 2008-07-09 12:16:31 UTC (rev 11364)
@@ -5,7 +5,7 @@
http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd"
version="2.0">
<portlet>
- <portlet-name>HelloWorldPortlet</portlet-name>
+ <portlet-name>SimplestHelloWorldPortlet</portlet-name>
<portlet-class>
org.jboss.portal.portlet.samples.SimplestHelloWorldPortlet
</portlet-class>
16 years, 3 months
JBoss Portal SVN: r11363 - examples/trunk.
by portal-commits@lists.jboss.org
Author: thomas.heute(a)jboss.com
Date: 2008-07-09 08:06:52 -0400 (Wed, 09 Jul 2008)
New Revision: 11363
Added:
examples/trunk/JSPHelloUser/
Log:
Adding new portlet
Copied: examples/trunk/JSPHelloUser (from rev 11362, examples/trunk/SimplestHelloWorld)
16 years, 3 months
JBoss Portal SVN: r11362 - docs/branches/JBoss_Portal_Branch_2_7/referenceGuide/en/modules.
by portal-commits@lists.jboss.org
Author: mmcallis
Date: 2008-07-09 02:55:36 -0400 (Wed, 09 Jul 2008)
New Revision: 11362
Modified:
docs/branches/JBoss_Portal_Branch_2_7/referenceGuide/en/modules/configuration.xml
Log:
code highlighting for configuration chapter. This
will break some examples...
Modified: docs/branches/JBoss_Portal_Branch_2_7/referenceGuide/en/modules/configuration.xml
===================================================================
--- docs/branches/JBoss_Portal_Branch_2_7/referenceGuide/en/modules/configuration.xml 2008-07-09 06:24:42 UTC (rev 11361)
+++ docs/branches/JBoss_Portal_Branch_2_7/referenceGuide/en/modules/configuration.xml 2008-07-09 06:55:36 UTC (rev 11362)
@@ -19,12 +19,10 @@
<para>
It is common for web services to run on port 80. By default, JBoss EAP and JBoss AS use port 8080. If you can not use <ulink url="http://wiki.jboss.org/wiki/Wiki.jsp?page=UsingPortForwardingWithJBoss">port forwarding</ulink>, it is recommended to change the port JBoss EAP or JBoss AS listens on. To change the default port, open the <filename>$JBOSS_HOME/server/default/deploy/jboss-web.deployer/server.xml</filename> file, and edit the <computeroutput>Connector port</computeroutput> value for the <computeroutput>jboss.web</computeroutput> service; however, this configuration only applies to Apache Tomcat:
</para>
- <para>
-<screen>
+<programlisting role="XML">
<Service name="jboss.web">
<Connector port="8088" address="${jboss.bind.address}"
-</screen>
- </para>
+</programlisting>
<para>
This example changes the default port to port 8088. The JBoss EAP or JBoss AS server must be restarted before the new port settings take affect.
</para>
@@ -53,7 +51,8 @@
<orderedlist>
<listitem>
<para>Open the <emphasis>$JBOSS_HOME/server/default/deploy/jboss-portal.sar/portal-server.war/WEB-INF/jboss-web.xml</emphasis> file. If this file does not exist, copy and save the following example:
-<programlisting><![CDATA[
+ </para>
+<programlisting role="XML"><![CDATA[
<?xml version="1.0"?>
<jboss-web>
<security-domain>java:jaas/portal</security-domain>
@@ -66,17 +65,14 @@
<jndi-name>java:PortalDS</jndi-name>
</resource-ref>
</jboss-web>]]></programlisting>
- </para>
</listitem>
<listitem>
<para>Edit the
<computeroutput><context-root></computeroutput> element with the desired context path:
</para>
- <para>
-<programlisting>
+<programlisting role="XML">
<![CDATA[<context-root>/testing</context-root>]]>
</programlisting>
- </para>
<para>
Using this example, the main JBoss Portal page would be reached by navigating to <emphasis>http://localhost:8080/testing</emphasis>.
</para>
@@ -97,12 +93,10 @@
<para>
Open the <filename>build/local.properties</filename> file and edit the <computeroutput>portal.web.context-root</computeroutput> option with the desired context path:
</para>
- <para>
<programlisting>
# Context root for the portal main servlet
portal.web.context-root=/testing
</programlisting>
- </para>
<para>
Using this example, the main JBoss Portal page would be reached by navigating to <emphasis>http://localhost:8080/testing</emphasis>.
</para>
@@ -127,13 +121,11 @@
or add a <filename>jboss-web.xml</filename> file, which declares another
context-root other than <emphasis>/</emphasis>, under the <filename>$JBOSS_HOME/server/default/deploy/jboss-web.deployer/ROOT.war/WEB-INF/</filename> directory, for the above changes to take affect. The following is an example <filename>jboss-web.xml</filename> file, which changes the Apache Tomcat context path to <computeroutput>/tomcat-root</computeroutput>:
</para>
- <para>
-<programlisting><![CDATA[
+<programlisting role="XML"><![CDATA[
<?xml version="1.0"?>
<jboss-web>
<context-root>/tomcat-root</context-root>
</jboss-web>]]></programlisting>
- </para>
</sect2>
</sect1>
<sect1 id="configuration-hibdialect">
@@ -149,12 +141,10 @@
<para>
To modify these files to force the DB dialect, un-comment the following line from each <filename>hibernate.cfg.xml</filename> file in each JBoss Portal module you intend to use, so that it looks like the following:
</para>
- <para>
-<programlisting><![CDATA[
+<programlisting role="XML"><![CDATA[
<!-- Force the dialect instead of using autodetection -->
<property name="dialect">org.hibernate.dialect.PostgreSQLDialect</property>
]]></programlisting>
- </para>
<para>
Note: this example is for a PostgreSQL database. If you use another database, you need to modify <computeroutput>org.hibernate.dialect.PostgreSQLDialect</computeroutput> to reflect the correct database. For a list of supported dialects, refer to the <ulink url="http://www.hibernate.org/hib_docs/v3/reference/en/html/session-configurat...">dialects list on the Hibernate website</ulink>.
</para>
@@ -175,12 +165,10 @@
<para>
Un-comment the following line, so that it looks like the following:
</para>
- <para>
-<programlisting><![CDATA[
+<programlisting role="XML"><![CDATA[
<!-- Force the dialect instead of using autodetection -->
<property name="dialect">org.hibernate.dialect.PostgreSQLDialect</property>
]]></programlisting>
- </para>
</listitem>
</orderedlist>
</para>
@@ -220,8 +208,7 @@
<para>
A different SMTP server (other than localhost) can be configured, along with a SMTP username and an SMTP password. The following is an example configuration that uses the Gmail SMTP server:
</para>
- <para>
-<screen><![CDATA[
+<programlisting role="XML"><![CDATA[
<mbean
code="org.jboss.portal.core.impl.mail.MailModuleImpl"
name="portal:service=Module,type=Mail"
@@ -239,8 +226,7 @@
<attribute name="SMTPTimeout">10000</attribute>
<attribute name="JNDIName">java:portal/MailModule</attribute>
</mbean>]]>
-</screen>
- </para>
+</programlisting>
<para>
Using this example, replace <computeroutput>username(a)gmail.com</computeroutput> and <computeroutput>myPassword</computeroutput> with your correct Gmail username and password.
</para>
16 years, 3 months
JBoss Portal SVN: r11361 - docs/branches/JBoss_Portal_Branch_2_7/referenceGuide/en/modules.
by portal-commits@lists.jboss.org
Author: thomas.heute(a)jboss.com
Date: 2008-07-09 02:24:42 -0400 (Wed, 09 Jul 2008)
New Revision: 11361
Modified:
docs/branches/JBoss_Portal_Branch_2_7/referenceGuide/en/modules/tutorials.xml
Log:
Just started
Modified: docs/branches/JBoss_Portal_Branch_2_7/referenceGuide/en/modules/tutorials.xml
===================================================================
--- docs/branches/JBoss_Portal_Branch_2_7/referenceGuide/en/modules/tutorials.xml 2008-07-09 06:22:14 UTC (rev 11360)
+++ docs/branches/JBoss_Portal_Branch_2_7/referenceGuide/en/modules/tutorials.xml 2008-07-09 06:24:42 UTC (rev 11361)
@@ -1,10 +1,9 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE chapter PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
+ "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd">
<chapter id="tutorials">
<chapterinfo>
<author>
- <firstname>Roy</firstname>
- <surname>Russo</surname>
- </author>
- <author>
<firstname>Chris</firstname>
<surname>Laprun</surname>
</author>
@@ -15,470 +14,594 @@
</chapterinfo>
<title>Portlet Primer</title>
<sect1 id="portlet_primer">
- <title>JSR-168 Overview</title>
- <para>The <ulink url="http://www.jcp.org/en/jsr/detail?id=168">JSR-168 Portlet Specification</ulink> aims at defining portlets that can be used by any JSR-168 portlet container, also known as a portal. There are different portals with commercial and non-commercial licenses. This chapter gives a brief overview of the JSR-168 Portlet Specification. Portlet developers are strongly encouraged to read the <ulink url="http://www.jcp.org/en/jsr/detail?id=168">JSR-168 Portlet Specification</ulink>.
+ <title>JSR-168 and JSR-286 overview</title>
+ <para>
+ The Portlet Specifications aims at defining portlets that can be used by any
+ <ulink url="http://www.jcp.org/en/jsr/detail?id=168">
+ JSR-168 (Portlet 1.0)
+ </ulink>
+ or
+ <ulink url="http://www.jcp.org/en/jsr/detail?id=286">
+ JSR-286 (Portlet 2.0)
+ </ulink>
+ portlet container. Most Java EE portals include a portlet container, it is
+ obvously the case for JBoss Portal which includes the JBoss Portlet container
+ supporting the two versions. This chapter gives a brief overview of the Portlet
+ Specifications. Portlet developers are strongly encouraged to read the
+ <ulink url="http://www.jcp.org/en/jsr/detail?id=286">
+ JSR-286 Portlet Specification
+ </ulink>
+ .
</para>
<para>
- JBoss Portal is fully JSR-168 compliant, which means any JSR-168 portlet behaves as it should inside the portal.
+ JBoss Portal is fully JSR-286 compliant, which means any JSR-168 or JSR-286
+ portlet behaves as it is mandated by the respective specifications inside the
+ portal.
</para>
<sect2>
<title>Portal Pages</title>
<para>
- A portal can be seen as pages with different areas, and inside areas, different windows, and each window
- having one portlet:
- </para>
- <para>
- <mediaobject>
- <imageobject>
- <imagedata align="center" fileref="images/tutorials/SpecPortalDef.png" valign="middle"/>
- </imageobject>
- </mediaobject>
- </para>
+ A portal can be seen as pages with different areas, and inside areas,
+ different windows, and each window having one portlet:
+ </para>
+ <para>
+ <mediaobject>
+ <imageobject>
+ <imagedata fileref="images/tutorials/SpecPortalDef.png" scalefit="1" />
+ </imageobject>
+ </mediaobject>
+ </para>
</sect2>
<sect2>
<title>Rendering Modes</title>
- <para>A portlet can have different view modes. Three modes are defined by the JSR-168 specification, but a portal can
- extend those modes. The three modes are:
- </para>
- <para>
+ <para>
+ A portlet can have different view modes. Three modes are defined by the
+ JSR-288 specification:
+ </para>
+ <para>
<itemizedlist>
<listitem>
- <para>
- <computeroutput>view</computeroutput> - generates markup reflecting the current state of the portlet.
- </para>
- </listitem>
+ <para>
+ <emphasis>view</emphasis>
+ - generates markup reflecting the current state of the portlet.
+ </para>
+ </listitem>
<listitem>
- <para>
- <computeroutput>edit</computeroutput> - allows a user to customize the behavior of the portlet.
- </para>
- </listitem>
+ <para>
+ <emphasis>edit</emphasis>
+ - allows a user to customize the behavior of the portlet.
+ </para>
+ </listitem>
<listitem>
- <para>
- <computeroutput>help</computeroutput> - provides information to the user as to how to use the portlet.
- </para>
- </listitem>
+ <para>
+ <emphasis>help</emphasis>
+ - provides information to the user as to how to use the portlet.
+ </para>
+ </listitem>
</itemizedlist>
</para>
</sect2>
<sect2>
<title>Window States</title>
<para>
- Window states are an indicator of how much page real-estate a portlet consumes on any given page.
- The three states defined by the JSR-168 specification are:
+ Window states are an indicator of how much page real-estate a portlet consumes
+ on any given page. The three states defined by the JSR-168 specification are:
</para>
- <para>
+ <para>
<itemizedlist>
<listitem>
- <para>
- <computeroutput>normal</computeroutput> - a portlet shares this page with other portlets.
- </para>
- </listitem>
+ <para>
+ <emphasis>normal</emphasis>
+ - a portlet shares this page with other portlets.
+ </para>
+ </listitem>
<listitem>
- <para>
- <computeroutput>minimized</computeroutput> -a portlet may show very little information, or none at all.
- </para>
- </listitem>
+ <para>
+ <emphasis>minimized</emphasis>
+ -a portlet may show very little information, or none at all.
+ </para>
+ </listitem>
<listitem>
- <para>
- <computeroutput>maximized</computeroutput> - a portlet may be the only portlet displayed on this page.
- </para>
- </listitem>
+ <para>
+ <emphasis>maximized</emphasis>
+ - a portlet may be the only portlet displayed on this page.
+ </para>
+ </listitem>
</itemizedlist>
</para>
</sect2>
<sect2>
<title>Section Status</title>
- <para>
- This overview of the JSR-168 Portlet Specification is a work in progress. Check back for more in-depth analsis of the specification. The sections following here after contain real-world cases for how to leverage the specification.
- </para>
+ <para>
+ This overview of the JSR-168 Portlet Specification is a work in progress.
+ Check back for more in-depth analsis of the specification. The sections
+ following here after contain real-world cases for how to leverage the
+ specification.
+ </para>
</sect2>
</sect1>
<sect1 id="tutorials_tutorials">
<title>Tutorials</title>
<para>
- The tutorials contained in this chapter are targetted toward portlet developers. Although they are a good
- starting and reference point, it is highly recommend that portlet developers read and understand the
- <ulink url="http://www.jcp.org/en/jsr/detail?id=168">JSR-168 Portlet Specification</ulink>. Use the <ulink url="http://jboss.org/index.html?module=bb&op=viewforum&f=215">JBoss Portal User Forums</ulink> for user-to-user help.
+ The tutorials contained in this chapter are targetted toward portlet developers.
+ Although they are a good starting and reference point, it is highly recommend
+ that portlet developers read and understand the
+ <ulink url="http://www.jcp.org/en/jsr/detail?id=286">
+ JSR-286 Portlet Specification
+ </ulink>
+ . Use the
+ <ulink url="http://jboss.org/index.html?module=bb&op=viewforum&f=215">
+ JBoss Portal User Forums
+ </ulink>
+ for user-to-user help.
</para>
- <!--<sect2 id="build_instructions">
- <title>
- Building and deploying the tutorials
- </title>
- <sect3>
- <title id="ant_build">Ant based tutorials</title>
- <para>
- For projects that are Ant based you can execute the build.xml with ant or inside your IDE.
- Executing <literal>ant</literal> will compile all source files and produce a
- artifact file auch as a .war.
- <sbr/>
- Before you run your first tutorial build, you must download <ulink url="http://ant.apache.org/bindownload.cgi">Apache Ant</ulink>
- and add it to your classpath.
- </para>
- <para>
- The <literal>explode</literal> target will produce the following:
-
- </para>
- <para>
- Deploying the portlet is as easy as copying/moving the <literal>helloworldjspportlet.war</literal> file
- to the server <literal>deploy</literal> directory. We can then see our portlet on the Portal default
- page (<ulink url="http://localhost:8080/portal/">http://localhost:8080/portal/</ulink>):
-
- </para>
- </sect3>
- <sect3>
- <title id="maven_build">Maven based tutorials</title>
- <para>
-
- </para>
- </sect3>
- </sect2>-->
-
<sect2>
<title>Deploying your first Portlet</title>
<sect3>
<title>Introduction</title>
<para>
- This section describes how to deploy a portlet in JBoss Portal. Before proceeding, download the <ulink
- url="http://anonsvn.jboss.org/repos/portletswap/portlets/2_6/bundles/HelloWorl...">HelloWorldPortlet</ulink> from <ulink url="http://labs.jboss.com/portletswap/">JBoss PortletSwap</ulink>.
- </para>
+ This section describes how to deploy a portlet in JBoss Portal. Before
+ proceeding, download the
+ <ulink
+ url="http://anonsvn.jboss.org/repos/portletswap/portlets/2_6/bundles/HelloWorl...">
+ HelloWorldPortlet
+ </ulink>
+ from
+ <ulink url="http://labs.jboss.com/portletswap/">JBoss PortletSwap</ulink>
+ .
+ </para>
</sect3>
<sect3>
<title>Package Structure</title>
<para>
- Like other Java Platform, Enterprise Edition (Java EE) applications, portlets are packaged in WAR files. A typical portlet WAR file can include servlets, resource bundles, images, HTML, <trademark class="trade">JavaServer</trademark> Pages (<trademark class="trade">JSP</trademark>), and other static or dynamic files. The following is an example of the directory structure of the HelloWorldPortlet portlet:
+ Like other Java Platform, Enterprise Edition (Java EE) applications,
+ portlets are packaged in WAR files. A typical portlet WAR file can include
+ servlets, resource bundles, images, HTML,
+ <trademark class="trade">JavaServer</trademark>
+ Pages (
+ <trademark class="trade">JSP</trademark>
+ ), and other static or dynamic files. The following is an example of the
+ directory structure of the HelloWorldPortlet portlet:
</para>
- <para>
- <mediaobject>
- <imageobject>
- <imagedata align="center" fileref="images/tutorials/first_portlet/package.gif" valign="middle"/>
- </imageobject>
- </mediaobject>
- </para>
- </sect3>
+<programlistingco>
+ <areaspec>
+ <area id="javaclass" coords='9' />
+ <area id="defaultobject" coords='10' />
+ <area id="portletinstances" coords='11' />
+ <area id="portlet" coords='12' />
+ <area id="web" coords='13' />
+ </areaspec>
+ <programlisting><![CDATA[|-- SimplestHelloWorld-0.0.1.war
+| `-- WEB-INF
+| |-- classes
+| | `-- org
+| | `-- jboss
+| | `-- portal
+| | `-- portlet
+| | `-- samples
+| | `-- SimplestHelloWorldPortlet.class
+| |-- default-object.xml
+| |-- portlet-instances.xml
+| |-- portlet.xml
+| `-- web.xml]]>
+ </programlisting>
+ <calloutlist>
+ <callout arearefs="javaclass">
+ <para>
+ The compiled Java class implementing <emphasis>javax.portlet.Portlet</emphasis> (through <emphasis>javax.portlet.GenericPortlet</emphasis>)
+ </para>
+ </callout>
+ <callout arearefs="defaultobject">
+ <para>
+ <emphasis>default-object.xml</emphasis> is an optional file, it is used to define the layout of the portal. It can be used to define the different portals, pages and windows.
+ The same result can be obtained through the administration portal. Note that the definition of the layout is stored in database, this file is then used to populate the database
+ during deployment which can be very useful during development.
+ </para>
+ </callout>
+ <callout arearefs="portletinstances">
+ <para>
+ <emphasis>portlet-instances.xml</emphasis> is also optional, it allows to create a portlet instance from the SimpleHelloWorld portlet definition. Creating
+ instances can also be done through the administration portal. Note that the definition of instances is stored in database, this file is then used to populate the database
+ during deployment which can be very useful during development.
+ </para>
+ </callout>
+ <callout arearefs="portlet">
+ <para>This is the mandatory descriptor files for portlets. It is used during deployment..</para>
+ </callout>
+ <callout arearefs="web">
+ <para>This is the mandatory descriptor for web applications.</para>
+ </callout>
+ </calloutlist>
+ </programlistingco>
+ </sect3>
<sect3>
<title>Portlet Classes</title>
<para>
- The following is the <filename>HelloWorldPortlet/src/main/org/jboss/portlet/hello/HelloWorldPortlet.java</filename> Java source file, which comes bundled with the <ulink
- url="http://anonsvn.jboss.org/repos/portletswap/portlets/2_6/bundles/HelloWorl...">HelloWorldPortlet</ulink>:
- </para>
- <para>
-<screen><![CDATA[
+ The following is the
+ <filename>
+ SimplestHelloWorldPortlet/src/main/java/org/jboss/portal/portlet/samples/SimplestHelloWorldPortlet.java
+ </filename>
+ Java source file, which comes bundled with your JBoss Portal download:
+ </para>
+ <programlistingco>
+ <areaspec>
+ <area id="extends" coords='10' />
+ <area id="doview" coords='13' />
+ <area id="writer" coords='15' />
+ <area id="write" coords='16' />
+ <area id="close" coords='17' />
+ </areaspec>
+ <programlisting role="JAVA"><![CDATA[package org.jboss.portal.portlet.samples;
-package org.jboss.portlet.hello;
+import java.io.IOException;
+import java.io.PrintWriter;
import javax.portlet.GenericPortlet;
-import javax.portlet.PortletException;
import javax.portlet.RenderRequest;
import javax.portlet.RenderResponse;
-import javax.portlet.UnavailableException;
-import java.io.IOException;
-import java.io.PrintWriter;
-public class HelloWorldPortlet extends GenericPortlet
-
+public class SimplestHelloWorldPortlet extends GenericPortlet
{
- protected void doView(RenderRequest rRequest, RenderResponse rResponse)
- throws PortletException, IOException, UnavailableException
-
- {
- rResponse.setContentType("text/html");
- PrintWriter writer = rResponse.getWriter();
- writer.write("Hello World!");
- writer.close();
- }
-
-} ]]>
-</screen>
- </para>
- <para>
- <variablelist>
- <varlistentry><term><screen>
-public class HelloWorldPortlet extends GenericPortlet</screen></term>
- <listitem>
- <para>
- All portlets must implement the <literal>javax.portlet.Portlet</literal> interface. The portlet
- API provides a convenient implementation of this interface, in the form of the
- <literal>javax.portlet.GenericPortlet</literal> class, which among other things, implements
- the <literal>Portlet render</literal> method to dispatch to abstract mode-specific methods to
- make it easier to support the standard portlet modes. As well, it provides
- a default implementation for the <literal>processAction</literal>, <literal>init</literal> and
- <literal>destroy</literal> methods. It is recommended to extend <literal>GenericPortlet</literal>
- for most cases.
- </para>
- </listitem>
- </varlistentry>
- <varlistentry><term><screen>
-protected void doView(RenderRequest rRequest, RenderResponse rResponse)
-throws PortletException, IOException, UnavailableException</screen></term>
- <listitem>
- <para>
- As we extend from <literal>GenericPortlet</literal>, and are only interested in supporting the <literal>view</literal> mode, only the <literal>doView</literal> method needs to be implemented, and the <literal>GenericPortlet</literal> <literal>render</literal> implemention calls our implementation when the <literal>view</literal> mode is requested.
- </para>
- </listitem>
- </varlistentry>
- <varlistentry><term><screen>
-rResponse.setContentType("text/html");</screen></term>
- <listitem>
- <para>
- As in the servlet world, you must declare what content-type the portlet will be
- responding in. Do this before starting to write content, or the portlet will throw an exception.
- </para>
- </listitem>
- </varlistentry>
- <varlistentry><term><screen>
-PrintWriter writer = rResponse.getWriter();
-writer.write("Hello World!");
-writer.close();</screen></term>
- <listitem>
- <para>
- This produces the <literal>Hello World!</literal> text in our portlet window.
- </para>
- </listitem>
- </varlistentry>
- </variablelist>
-</para>
-<para>
- <note>
- <title>Markup Fragments</title>
- <para>
- Portlets are responsible for generating markup fragments, as they are included on a page and are
- surrounded by other portlets. In particular, this means that a portlet outputting HTML must
- not output any markup that cannot be found in a <literal><body></literal> element.
- </para>
- </note>
-</para>
+ public void doView(RenderRequest request,
+ RenderResponse response) throws IOException
+ {
+ PrintWriter writer = response.getWriter();
+ writer.write("Hello World !");
+ writer.close();
+ }
+}]]>
+ </programlisting>
+ <calloutlist>
+ <callout arearefs="extends">
+ <para>
+ All portlets must implement the
+ <literal>javax.portlet.Portlet</literal>
+ interface. The portlet API provides a convenient implementation
+ of this interface, in the form of the
+ <literal>javax.portlet.GenericPortlet</literal>
+ class, which among other things, implements the
+ <literal>Portlet render</literal>
+ method to dispatch to abstract mode-specific methods to make it
+ easier to support the standard portlet modes. As well, it
+ provides a default implementation for the
+ <literal>processAction</literal>
+ ,
+ <literal>init</literal>
+ and
+ <literal>destroy</literal>
+ methods. It is recommended to extend
+ <literal>GenericPortlet</literal>
+ for most cases.
+ </para>
+ </callout>
+ <callout arearefs="doview">
+ <para>
+ As we extend from
+ <literal>GenericPortlet</literal>
+ , and are only interested in supporting the
+ <literal>view</literal>
+ mode, only the
+ <literal>doView</literal>
+ method needs to be implemented, and the
+ <literal>GenericPortlet</literal>
+ <literal>render</literal>
+ implemention calls our implementation when the
+ <literal>view</literal>
+ mode is requested.
+ </para>
+ </callout>
+ <callout arearefs="writer">
+ <para>
+ Use the
+ <emphasis>RenderResponse</emphasis>
+ to obtain a writer to be used to produce content.
+ </para>
+ </callout>
+ <callout arearefs="write">
+ <para>Write the markup to display.</para>
+ </callout>
+ <callout arearefs="close">
+ <para>Closing the writer.</para>
+ </callout>
+ </calloutlist>
+ </programlistingco>
+ <para>
+ <note>
+ <title>Markup Fragments</title>
+ <para>
+ Portlets are responsible for generating markup fragments, as they are
+ included on a page and are surrounded by other portlets. In
+ particular, this means that a portlet outputting HTML must not output
+ any markup that cannot be found in a
+ <literal><body></literal>
+ element.
+ </para>
+ </note>
+ </para>
</sect3>
<sect3 id="first_portlet_descriptors">
<title>Application Descriptors</title>
<para>
- JBoss Portal requires certain descriptors to be included in a portlet WAR file. Some of
- these descriptors are defined by the JSR-168 Portlet Specification, and others are specific to JBoss Portal. The following is an example of the directory structure of the HelloWorldPortlet portlet:
- </para>
- <para>
- <mediaobject>
- <imageobject>
- <imagedata align="center" fileref="images/tutorials/first_portlet/package.gif" valign="middle"/>
- </imageobject>
- </mediaobject>
- </para>
- <para>
- To create the <filename>WEB-INF/</filename> and <filename>META-INF/</filename> directories, extract the <filename>helloworldportlet.war</filename> file.
- </para>
- <para>
- The following is an example of the <filename>HelloWorldPortlet/WEB-INF/portlet.xml</filename> file. This file must adhere to its definition in the JSR-168 Portlet Specification. You may define more than one portlet application in this file:
- </para>
- <para>
-<screen><![CDATA[
-<?xml version="1.0" encoding="UTF-8"?>
-<portlet-app xmlns="http://java.sun.com/xml/ns/portlet/portlet-app_1_0.xsd"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://java.sun.com/xml/ns/portlet/portlet-app_1_0.xsd
- http://java.sun.com/xml/ns/portlet/portlet-app_1_0.xsd"
- version="1.0">
+ JBoss Portal requires certain descriptors to be included in a portlet WAR
+ file. Some of these descriptors are defined by the Portlet
+ Specification, and others are specific to JBoss Portal.
+ </para>
+ <para>
+ The following is an example of the
+ <filename>SimplestHelloWorldPortlet/WEB-INF/portlet.xml</filename>
+ file. This file must adhere to its definition in the JSR-286 Portlet
+ Specification. You may define more than one portlet application in this
+ file:
+ </para>
+ <programlistingco>
+ <areaspec>
+ <area id="portletname" coords='8' />
+ <area id="portletclass" coords='9' />
+ <area id="supports" coords='12' />
+ <area id="portletinfo" coords='15' />
+ </areaspec>
+ <programlisting><![CDATA[
+<portlet-app xmlns="http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd
+ http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd"
+ version="2.0">
<portlet>
- <portlet-name>HelloWorldPortlet</portlet-name>
- <portlet-class>org.jboss.portlet.hello.HelloWorldPortlet</portlet-class>
+ <portlet-name>SimplestHelloWorldPortlet</portlet-name>
+ <portlet-class>
+ org.jboss.portal.portlet.samples.SimplestHelloWorldPortlet
+ </portlet-class>
<supports>
- <mime-type>text/html</mime-type>
- <portlet-mode>view</portlet-mode>
+ <mime-type>text/html</mime-type>
</supports>
<portlet-info>
- <title>HelloWorld Portlet</title>
+ <title>Simplest Hello World Portlet</title>
</portlet-info>
</portlet>
</portlet-app>]]>
-</screen>
- </para>
- <para>
- <variablelist>
- <varlistentry><term><screen><![CDATA[
-<portlet-name>HelloWorldPortlet</portlet-name>]]></screen></term>
-<listitem>
- <para>
- Define the portlet name. It does not have to be the class name.
- </para>
-</listitem>
-</varlistentry>
-<varlistentry><term><screen><![CDATA[
-<portlet-class>org.jboss.portlet.hello.HelloWorldPortlet</portlet-class>]]></screen></term>
-<listitem>
- <para>
- The Fully Qualified Name (FQN) of your portlet class must be declared here.
- </para>
-</listitem>
-</varlistentry>
-<varlistentry><term><screen><![CDATA[
-<supports>
- <mime-type>text/html</mime-type>
- <portlet-mode>view</portlet-mode>
-</supports>]]></screen></term>
-<listitem>
- <para>
- The <computeroutput><supports></computeroutput> element declares all of the markup types that a portlet supports in the <literal>render</literal> method. This is accomplished via the
- <computeroutput><mime-type></computeroutput> element, which is required for every portlet. The declared MIME types must match the capability of the portlet. As well, it allows you to pair which modes and window states are supported for each markup type. All portlets must support the <computeroutput>view</computeroutput> portlet mode, so this does not have to be declared. Use the <computeroutput><mime-type></computeroutput> element to define which markup type your portlet supports, which in this example, is <computeroutput>text/html</computeroutput>. This section tells the portal that it only outputs text and HTML, and that it only supports the <computeroutput>view</computeroutput> mode.
- </para>
-</listitem>
-</varlistentry>
-<varlistentry><term><screen><![CDATA[
-<portlet-info>
- <title>HelloWorld Portlet</title>
-</portlet-info>]]></screen></term>
-<listitem>
- <para>
- When rendered, the portlet's title is displayed as the header in the portlet window, unless it is overridden programmatically. In this example, the title would be <computeroutput>HelloWorld Portlet</computeroutput>.
- </para>
-</listitem>
-</varlistentry>
-</variablelist>
-</para>
- <para>
- The <filename>HelloWorldPortlet/WEB-INF/portlet-instances.xml</filename> file is a JBoss Portal specific descriptor, that allows you to create instances of portlets. The
- <computeroutput><portlet-ref></computeroutput> value must match the <computeroutput><portlet-name></computeroutput> value
- given in the <filename>HelloWorldPortlet/WEB-INF/portlet.xml</filename> file. The <computeroutput><instance-id></computeroutput>
- value can be named anything, but it must match the <computeroutput><instance-ref></computeroutput> value given
- in the <filename>*-object.xml</filename> file, which in this example, would be the <filename>HelloWorldPortlet/WEB-INF/helloworld-object.xml</filename> file.
- </para>
-<para>
- The following is an example of the <filename>HelloWorldPortlet/WEB-INF/portlet-instances.xml</filename> file:
-</para>
-<para>
-<screen><![CDATA[
-<?xml version="1.0" standalone="yes"?>
+ </programlisting>
+ <calloutlist>
+ <callout arearefs="portletname">
+ <para>Define the portlet name. It does not have to be the class name.</para>
+ </callout>
+ <callout arearefs="portletclass">
+ <para>
+ The Fully Qualified Name (FQN) of your portlet class must be
+ declared here.
+ </para>
+ </callout>
+ <callout arearefs="supports">
+ <para>
+ The
+ <computeroutput><supports></computeroutput>
+ element declares all of the markup types that a portlet
+ supports in the
+ <literal>render</literal>
+ method. This is accomplished via the
+ <computeroutput><mime-type></computeroutput>
+ element, which is required for every portlet. The declared MIME
+ types must match the capability of the portlet. As well, it
+ allows you to pair which modes and window states are supported
+ for each markup type. All portlets must support the
+ <computeroutput>view</computeroutput>
+ portlet mode, so this does not have to be declared. Use the
+ <computeroutput><mime-type></computeroutput>
+ element to define which markup type your portlet supports,
+ which in this example, is
+ <computeroutput>text/html</computeroutput>
+ . This section tells the portal that it only outputs HTML.
+ </para>
+ </callout>
+ <callout arearefs="portletinfo">
+ <para>
+ When rendered, the portlet's title is displayed as the header
+ in the portlet window, unless it is overridden
+ programmatically. In this example, the title would be
+ <computeroutput>HelloWorld Portlet</computeroutput>
+ .
+ </para>
+ </callout>
+ </calloutlist>
+ </programlistingco>
+ <para>
+ The
+ <filename>HelloWorldPortlet/WEB-INF/portlet-instances.xml</filename>
+ file is a JBoss Portal specific descriptor, that allows you to create
+ instances of portlets. The
+ <computeroutput><portlet-ref></computeroutput>
+ value must match the
+ <computeroutput><portlet-name></computeroutput>
+ value given in the
+ <filename>HelloWorldPortlet/WEB-INF/portlet.xml</filename>
+ file. The
+ <computeroutput><instance-id></computeroutput>
+ value can be named anything, but it must match the
+ <computeroutput><instance-ref></computeroutput>
+ value given in the
+ <filename>*-object.xml</filename>
+ file, which in this example, would be the
+ <filename>SimplestHelloWorldPortlet/WEB-INF/default-object.xml</filename>
+ file.
+ </para>
+ <para>
+ The following is an example of the
+ <filename>SimplestHelloWorldPortlet/WEB-INF/portlet-instances.xml</filename>
+ file:
+ </para>
+ <programlisting role="XML"><![CDATA[<?xml version="1.0" standalone="yes"?>
<!DOCTYPE deployments PUBLIC
"-//JBoss Portal//DTD Portlet Instances 2.6//EN"
- "http://www.jboss.org/portal/dtd/portlet-instances_2_6.dtd">
+ "http://www.jboss.org/portlet/dtd/portlet-instances_2_6.dtd">
<deployments>
<deployment>
<instance>
- <instance-id>HelloWorldPortletInstance</instance-id>
- <portlet-ref>HelloWorldPortlet</portlet-ref>
+ <instance-id>SimplestHelloWorldInstance</instance-id>
+ <portlet-ref>SimplestHelloWorldPortlet</portlet-ref>
</instance>
</deployment>
</deployments>]]>
-</screen>
-</para>
-<para>
- The <filename>*-object.xml</filename> file is a JBoss Portal specific descriptor that allow users to
- define the structure of their portal instances, and create and configure their windows and
- pages. In the following example:
-</para>
-<para>
- <itemizedlist>
- <listitem>
- <para>
- a portlet window is created.
- </para>
- </listitem>
- <listitem>
- <para>
- specifies that the window displays the markup generated by the <computeroutput>HelloWorldPortletInstance</computeroutput> portlet instance.
- </para>
- </listitem>
- <listitem>
- <para>
- the window is assigned to the <computeroutput>default.default</computeroutput> page.
- </para>
- </listitem>
- <listitem>
- <para>
- the <computeroutput><region></computeroutput> element specifies where the window appears on the page.
- </para>
- </listitem>
- </itemizedlist>
-</para>
-<para>
- The following is an example <filename>HelloWorldPortlet/WEB-INF/helloworld-object.xml</filename> file:
-</para>
-<para>
-<screen><![CDATA[<?xml version="1.0" encoding="UTF-8"?>
+ </programlisting>
+ <para>
+ The
+ <filename>*-object.xml</filename>
+ file is a JBoss Portal specific descriptor that allow users to define the
+ structure of their portal instances, and create and configure their windows
+ and pages. In the following example:
+ </para>
+ <para>
+ <itemizedlist>
+ <listitem>
+ <para>a portlet window is created.</para>
+ </listitem>
+ <listitem>
+ <para>
+ specifies that the window displays the markup generated by the
+ <computeroutput>HelloWorldPortletInstance</computeroutput>
+ portlet instance.
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+ the window is assigned to the
+ <computeroutput>default.default</computeroutput>
+ page.
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+ the
+ <computeroutput><region></computeroutput>
+ element specifies where the window appears on the page.
+ </para>
+ </listitem>
+ </itemizedlist>
+ </para>
+ <para>
+ The following is an example
+ <filename>SimplestHelloWorldPortlet/WEB-INF/default-object.xml</filename>
+ file:
+ </para>
+ <programlistingco>
+ <areaspec>
+ <area id="parentref" coords='7' />
+ <area id="ifexists" coords='8' />
+ <area id="windowname" coords='12' />
+ <area id="instanceref" coords='13' />
+ <area id="region" coords='14' />
+ <area id="height" coords='15' />
+ </areaspec>
+ <programlisting><![CDATA[<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE deployments PUBLIC
"-//JBoss Portal//DTD Portal Object 2.6//EN"
"http://www.jboss.org/portal/dtd/portal-object_2_6.dtd">
<deployments>
<deployment>
- <parent-ref>default.default</parent-ref>
+ <parent-ref>default</parent-ref>
<if-exists>overwrite</if-exists>
- <window>
- <window-name>HelloWorldPortletWindow</window-name>
- <instance-ref>HelloWorldPortletInstance</instance-ref>
- <region>center</region>
- <height>1</height>
- </window>
+ <page>
+ <page-name>SimplestHelloWorld</page-name>
+ <window>
+ <window-name>SimplestHelloWorldWindow</window-name>
+ <instance-ref>SimplestHelloWorldInstance</instance-ref>
+ <region>center</region>
+ <height>0</height>
+ </window>
+ </page>
</deployment>
</deployments>]]>
-</screen>
-</para>
-
-<para>
- <variablelist>
- <varlistentry><term><screen><![CDATA[
-<parent-ref>default.default</parent-ref>]]>
-</screen></term>
-<listitem>
- <para>
- Tells the portal where this portlet appears. In this case, <computeroutput>default.default</computeroutput> specifies that the portlet appears in the portal instance named <computeroutput>default</computeroutput>, and on the page named <computeroutput>default</computeroutput>.
- </para>
-</listitem>
-</varlistentry>
-<varlistentry><term><screen><![CDATA[
-<if-exists>overwrite</if-exists>]]>
-</screen></term>
-<listitem>
- <para>
- Instructs the portal to overwrite or keep this object if it already exists. Accepted values are <computeroutput>overwrite</computeroutput> and <computeroutput>keep</computeroutput>. The <computeroutput>overwrite</computeroutput> option destroys the existing object, and creates a new one based on the content of the deployment. The <computeroutput>keep</computeroutput> option maintains the existing object deployment, or creates a new one if it does not exist.
- </para>
-</listitem>
-</varlistentry>
-<varlistentry><term><screen><![CDATA[
-<window-name>HelloWorldPortletWindow</window-name>]]>
-</screen></term>
-<listitem>
- <para>
- A <emphasis role="bold">unique name</emphasis> given to the portlet window. This can be named anything.
- </para>
-</listitem>
-</varlistentry>
-<varlistentry><term><screen><![CDATA[
-<instance-ref>HelloWorldPortletInstance</instance-ref>]]>
-</screen></term>
-<listitem>
- <para>
- The value of <computeroutput><instance-ref></computeroutput> must match the value of one of the
- <computeroutput><instance-id></computeroutput> elements found in the <filename>HelloWorldPortlet/WEB-INF/portlet-instances.xml</filename> file.
- </para>
-</listitem>
-</varlistentry>
-<varlistentry><term><screen><![CDATA[
-<region>center</region>
-<height>1</height>]]>
-</screen></term>
-<listitem>
- <para>
- Specifies where the window appears within the page layout.
- </para>
-</listitem>
-</varlistentry>
-</variablelist>
-</para>
-<para>
- The following diagram illustrates the relationship between the <filename>portlet.xml</filename>, <filename>portlet-instances.xml</filename>, and <filename>helloworld-object.xml</filename> descriptors:
-</para>
-<para>
+ </programlisting>
+ <calloutlist>
+ <callout arearefs="parentref">
+ <para>
+ Tells the portal where this portlet appears. In this case,
+ <computeroutput>default.default</computeroutput>
+ specifies that the portlet appears in the portal instance named
+ <computeroutput>default</computeroutput>
+ , and on the page named
+ <computeroutput>default</computeroutput>
+ .
+ </para>
+ </callout>
+ <callout arearefs="ifexists">
+ <para>
+ Instructs the portal to overwrite or keep this object if it
+ already exists. Accepted values are
+ <computeroutput>overwrite</computeroutput>
+ and
+ <computeroutput>keep</computeroutput>
+ . The
+ <computeroutput>overwrite</computeroutput>
+ option destroys the existing object, and creates a new one
+ based on the content of the deployment. The
+ <computeroutput>keep</computeroutput>
+ option maintains the existing object deployment, or creates a
+ new one if it does not exist.
+ </para>
+ </callout>
+ <callout arearefs="windowname">
+ <para>
+ A
+ <emphasis role="bold">unique name</emphasis>
+ given to the portlet window. This can be named anything.
+ </para>
+ </callout>
+ <callout arearefs="instanceref">
+ <para>
+ The value of
+ <computeroutput><instance-ref></computeroutput>
+ must match the value of one of the
+ <computeroutput><instance-id></computeroutput>
+ elements found in the
+ <filename>
+ HelloWorldPortlet/WEB-INF/portlet-instances.xml
+ </filename>
+ file.
+ </para>
+ </callout>
+ <callout arearefs="region">
+ <para>
+ Specifies where the window appears within the page layout.
+ </para>
+ </callout>
+ <callout arearefs="height">
+ <para>
+ Specifies where the window appears within the page layout.
+ </para>
+ </callout>
+ </calloutlist>
+ </programlistingco>
+ <para>
+ The following diagram illustrates the relationship between the
+ <filename>portlet.xml</filename>
+ ,
+ <filename>portlet-instances.xml</filename>
+ , and
+ <filename>helloworld-object.xml</filename>
+ descriptors:
+ </para>
+ <para>
<mediaobject>
<imageobject>
- <imagedata align="center" fileref="images/tutorials/first_portlet/desc_relationship.gif"
- valign="middle"/>
+ <imagedata align="center"
+ fileref="images/tutorials/first_portlet/desc_relationship.gif"
+ valign="middle" />
</imageobject>
</mediaobject>
-</para>
+ </para>
<para>
- JBoss Portal 2.6 introduces the notion of <emphasis>content-type</emphasis>, which is a generic mechanism to
- specify what content displayed by a given portlet window. The <computeroutput>window</computeroutput> section
- of the previous example, <filename>HelloWorldPortlet/WEB-INF/helloworld-object.xml</filename>, can be re-written to take advantage of the new content framework. The following is an example deployment descriptor that uses the new content framework:
+ JBoss Portal 2.6 introduced the notion of
+ <emphasis>content-type</emphasis>
+ , which is a generic mechanism to specify what content displayed by a given
+ portlet window. The
+ <computeroutput>window</computeroutput>
+ section of the previous example,
+ <filename>SimplestHelloWorldPortlet/WEB-INF/default-object.xml</filename>
+ , can be re-written to take advantage of the new content framework. The
+ following is an example deployment descriptor that uses the new content
+ framework:
</para>
- <para>
-<screen><![CDATA[
+ <programlisting role="XML"><![CDATA[
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE deployments PUBLIC
"-//JBoss Portal//DTD Portal Object 2.6//EN"
@@ -488,188 +611,334 @@
<parent-ref>default.default</parent-ref>
<if-exists>overwrite</if-exists>
<window>
- <window-name>HelloWorldPortletWindow</window-name>
+ <window-name>SimplestHelloWorldWindow</window-name>
<content>
<content-type>portlet</content-type>
- <content-uri>HelloWorldPortletInstance</content-uri>
+ <content-uri>SimplestHelloWorldInstance</content-uri>
</content>
<region>center</region>
<height>1</height>
</window>
</deployment>
</deployments>]]>
-</screen>
- </para>
- <para>
+ </programlisting>
+ <para>
- This declaration is equivalent to the previous <filename>HelloWorldPortlet/WEB-INF/helloworld-object.xml</filename> example. Use <computeroutput><content-type></computeroutput> to specify the content to display. In this example, the content being displayed by the <computeroutput>HelloWorldPortletWindow</computeroutput> is a <computeroutput>portlet</computeroutput>. The <computeroutput><content-uri></computeroutput> element specifies which content to display, which in this example, is the <computeroutput>HelloWorldPortletInstance</computeroutput>:
- </para>
- <para>
-<screen><![CDATA[
-<content>
+ This declaration is equivalent to the previous
+ <filename>SimplestHelloWorldPortlet/WEB-INF/default-object.xml</filename>
+ example. Use
+ <computeroutput><content-type></computeroutput>
+ to specify the content to display. In this example, the content being
+ displayed by the
+ <computeroutput>SimplestHelloWorldWindow</computeroutput>
+ is a
+ <computeroutput>portlet</computeroutput>
+ . The
+ <computeroutput><content-uri></computeroutput>
+ element specifies which content to display, which in this example, is the
+ <computeroutput>HelloWorldPortletInstance</computeroutput>
+ :
+ </para>
+ <programlisting role="XML"><![CDATA[<content>
<content-type>portlet</content-type>
<content-uri>HelloWorldPortletInstance</content-uri>
</content>]]>
-</screen>
- </para>
- <para>
- To display certain content or a file, use the <computeroutput>cms</computeroutput> content-type, with the <computeroutput><content-uri></computeroutput> element being the path to the file in the CMS. This behavior is pluggable: you can plug in almost any type of content.
- </para>
+ </programlisting>
+ <para>
+ To display certain content or a file, use the
+ <computeroutput>cms</computeroutput>
+ content-type, with the
+ <computeroutput><content-uri></computeroutput>
+ element being the path to the file in the CMS. This behavior is pluggable:
+ you can plug in almost any type of content.
+ </para>
</sect3>
<sect3 id="first_portlet_build">
<title>Building your Portlet</title>
<para>
- The <filename>HelloWorldPortlet.zip</filename> file contains a pre-compiled <filename>helloworldportlet.war</filename> file; however, to manually build the <filename>helloworldportlet.war</filename> file:
- </para>
- <para>
- <orderedlist>
- <listitem>
- <para>
- Change into the <filename>HelloWorldPortlet/</filename> directory, and remove the existing <filename>helloworldportlet.war</filename> file.
- </para>
- </listitem>
- <listitem>
- <para>
- If required, edit the <filename>HelloWorldPortlet/src/main/org/jboss/portlet/hello/HelloWorldPortlet.java</filename> file, and the application descriptors in the <filename>HelloWorldPortlet/src/resources/helloworldportlet-war/WEB-INF/</filename> directory.
- </para>
- </listitem>
- <listitem>
- <para>
- Change into <filename>HelloWorldPortlet/</filename> directory, and run the <command>ant deploy</command> command. On Windows, the output will be similar to the following:
- </para>
- <para>
- <mediaobject>
- <imageobject>
- <imagedata align="center" fileref="images/tutorials/first_portlet/building.gif" valign="middle"/>
- </imageobject>
- </mediaobject>
- </para>
- </listitem>
- </orderedlist>
- </para>
- <para>
- Note: the directory names will be different for your system.
- </para>
+ The
+ <filename>HelloWorldPortlet.zip</filename>
+ file contains a pre-compiled
+ <filename>helloworldportlet.war</filename>
+ file; however, to manually build the
+ <filename>helloworldportlet.war</filename>
+ file:
+ </para>
<para>
- Expanding the <filename>helloworldportlet.war</filename> file allows you to deploy the portlet as an expanded directory, which makes development easier. As well, it gives you access to the application descriptors, resource files, JSF, and JSP pages. To expand the <filename>helloworldportlet.war</filename> file:
- </para>
- <para>
- <orderedlist>
- <listitem>
- <para>
- If you do not have the <filename>HelloWorldPortlet/helloworldportlet.war</filename> file, change into the <filename>HelloWorldPortlet/</filename> directory, and run the <command>ant deploy</command> command. This creates the <filename>helloworldportlet.war</filename> file.
- </para>
- </listitem>
- <listitem>
- <para>
- To expand the WAR file, change into the <filename>HelloWorldPortlet/</filename> directory, and run the <command>ant explode</command> command. On Windows, the output will be similar to the following:
- </para>
- <para>
- <mediaobject>
- <imageobject>
- <imagedata align="center" fileref="images/tutorials/first_portlet/buildexplode.gif" valign="middle"/>
- </imageobject>
- </mediaobject>
- </para>
- </listitem>
- </orderedlist>
- </para>
- <para>
- Note: the directory names will be different for your system.
- </para>
- <para>
- The <command>ant explode</command> command creates a directory structure such as the following:
- </para>
- <para>
+ <orderedlist>
+ <listitem>
+ <para>
+ Change into the
+ <filename>HelloWorldPortlet/</filename>
+ directory, and remove the existing
+ <filename>helloworldportlet.war</filename>
+ file.
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+ If required, edit the
+ <filename>
+ HelloWorldPortlet/src/main/org/jboss/portlet/hello/HelloWorldPortlet.java
+ </filename>
+ file, and the application descriptors in the
+ <filename>
+ HelloWorldPortlet/src/resources/helloworldportlet-war/WEB-INF/
+ </filename>
+ directory.
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+ Change into
+ <filename>HelloWorldPortlet/</filename>
+ directory, and run the
+ <command>ant deploy</command>
+ command. On Windows, the output will be similar to the following:
+ </para>
+ <para>
+ <mediaobject>
+ <imageobject>
+ <imagedata align="center"
+ fileref="images/tutorials/first_portlet/building.gif"
+ valign="middle" />
+ </imageobject>
+ </mediaobject>
+ </para>
+ </listitem>
+ </orderedlist>
+ </para>
+ <para>Note: the directory names will be different for your system.</para>
+ <para>
+ Expanding the
+ <filename>helloworldportlet.war</filename>
+ file allows you to deploy the portlet as an expanded directory, which makes
+ development easier. As well, it gives you access to the application
+ descriptors, resource files, JSF, and JSP pages. To expand the
+ <filename>helloworldportlet.war</filename>
+ file:
+ </para>
+ <para>
+ <orderedlist>
+ <listitem>
+ <para>
+ If you do not have the
+ <filename>HelloWorldPortlet/helloworldportlet.war</filename>
+ file, change into the
+ <filename>HelloWorldPortlet/</filename>
+ directory, and run the
+ <command>ant deploy</command>
+ command. This creates the
+ <filename>helloworldportlet.war</filename>
+ file.
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+ To expand the WAR file, change into the
+ <filename>HelloWorldPortlet/</filename>
+ directory, and run the
+ <command>ant explode</command>
+ command. On Windows, the output will be similar to the following:
+ </para>
+ <para>
+ <mediaobject>
+ <imageobject>
+ <imagedata align="center"
+ fileref="images/tutorials/first_portlet/buildexplode.gif"
+ valign="middle" />
+ </imageobject>
+ </mediaobject>
+ </para>
+ </listitem>
+ </orderedlist>
+ </para>
+ <para>Note: the directory names will be different for your system.</para>
+ <para>
+ The
+ <command>ant explode</command>
+ command creates a directory structure such as the following:
+ </para>
+ <para>
<mediaobject>
<imageobject>
- <imagedata align="center" fileref="images/tutorials/first_portlet/exploded.gif" valign="middle"/>
+ <imagedata align="center"
+ fileref="images/tutorials/first_portlet/exploded.gif"
+ valign="middle" />
</imageobject>
</mediaobject>
- </para>
- <para>
- The expanded WAR file and the application descriptors are located in the <filename>HelloWorldPortlet/output/lib/exploded/helloworldportlet.war/WEB-INF/</filename> directory.
</para>
+ <para>
+ The expanded WAR file and the application descriptors are located in the
+ <filename>
+ HelloWorldPortlet/output/lib/exploded/helloworldportlet.war/WEB-INF/
+ </filename>
+ directory.
+ </para>
</sect3>
<sect3>
<title>Deploying your Portlet</title>
<para>
- If you did not expand the <filename>helloworldportlet.war</filename> file, copy the <filename>HelloWorldPortlet/helloworldportlet.war</filename> file into the correct JBoss AS or JBoss EAP <filename>deploy/</filename> directory. If you expanded the <filename>helloworldportlet.war</filename> file, copy the <filename>HelloWorldPortlet/output/lib/exploded/helloworldportlet.war/</filename> directory into the correct JBoss AS or JBoss EAP <filename>deploy/</filename> directory. For example, if you are using the <computeroutput>default</computeroutput> JBoss AS profile, copy the WAR file or the expanded directory into the <filename>$JBOSS_HOME/server/default/deploy/</filename> directory.
- </para>
- <para>
- Performing this step on a running instance of JBoss AS or JBoss EAP, and JBoss Portal, triggers a hot-deploy of the portlet:
- </para>
- <para>
-<screen><![CDATA[
+ If you did not expand the
+ <filename>helloworldportlet.war</filename>
+ file, copy the
+ <filename>HelloWorldPortlet/helloworldportlet.war</filename>
+ file into the correct JBoss AS or JBoss EAP
+ <filename>deploy/</filename>
+ directory. If you expanded the
+ <filename>helloworldportlet.war</filename>
+ file, copy the
+ <filename>
+ HelloWorldPortlet/output/lib/exploded/helloworldportlet.war/
+ </filename>
+ directory into the correct JBoss AS or JBoss EAP
+ <filename>deploy/</filename>
+ directory. For example, if you are using the
+ <computeroutput>default</computeroutput>
+ JBoss AS profile, copy the WAR file or the expanded directory into the
+ <filename>$JBOSS_HOME/server/default/deploy/</filename>
+ directory.
+ </para>
+ <para>
+ Performing this step on a running instance of JBoss AS or JBoss EAP, and
+ JBoss Portal, triggers a hot-deploy of the portlet:
+ </para>
+ <para>
+ <screen><![CDATA[
INFO [TomcatDeployer] deploy, ctxPath=/helloworldportlet,
warUrl=.../tmp/deploy/tmp35219helloworldportlet-exp.war/]]>
-</screen>
- </para>
- <para>
- To see the HelloWorldPortlet, navigate to <ulink url="http://localhost:8080/portal/">http://localhost:8080/portal/</ulink>, or, if the default JBoss Portal page is already open, refresh the page. The HelloWorldPortlet is added to the bottom of the default JBoss Portal page:
- </para>
- <para>
+ </screen>
+ </para>
+ <para>
+ To see the HelloWorldPortlet, navigate to
+ <ulink url="http://localhost:8080/portal/">
+ http://localhost:8080/portal/
+ </ulink>
+ , or, if the default JBoss Portal page is already open, refresh the page.
+ The HelloWorldPortlet is added to the bottom of the default JBoss Portal
+ page:
+ </para>
+ <para>
<mediaobject>
<imageobject>
- <imagedata align="center" fileref="images/tutorials/first_portlet/output.png" valign="middle"/>
+ <imagedata align="center"
+ fileref="images/tutorials/first_portlet/output.png"
+ valign="middle" />
</imageobject>
</mediaobject>
</para>
- <para>
- To re-deploy the portlet, for example, if you have made changes to any of the application descriptors, touch the <filename>$JBOSS_HOME/server/<replaceable>configuration</replaceable>/deploy/helloworldportlet.war/WEB-INF/web.xml</filename> file. This only works if you copied the <filename>HelloWorldPortlet/output/lib/exploded/helloworldportlet.war/</filename> directory into the JBoss AS or JBoss EAP <filename>deploy/</filename> directory. On Linux, run the following command to re-deploy the HelloWorldPortlet:
- </para>
- <para>
-<screen>
-touch $JBOSS_HOME/server/<replaceable>configuration</replaceable>/deploy/helloworldportlet.war/WEB-INF/web.xml
-</screen>
- </para>
- <para>
- Re-deploying the HelloWorldPortlet produces output to the JBoss AS or JBoss EAP console, similar to the following:
- </para>
- <para>
-<screen><![CDATA[
+ <para>
+ To re-deploy the portlet, for example, if you have made changes to any of
+ the application descriptors, touch the
+ <filename>
+ $JBOSS_HOME/server/
+ <replaceable>configuration</replaceable>
+ /deploy/helloworldportlet.war/WEB-INF/web.xml
+ </filename>
+ file. This only works if you copied the
+ <filename>
+ HelloWorldPortlet/output/lib/exploded/helloworldportlet.war/
+ </filename>
+ directory into the JBoss AS or JBoss EAP
+ <filename>deploy/</filename>
+ directory. On Linux, run the following command to re-deploy the
+ HelloWorldPortlet:
+ </para>
+ <para>
+ <screen>
+ touch $JBOSS_HOME/server/
+ <replaceable>configuration</replaceable>
+ /deploy/helloworldportlet.war/WEB-INF/web.xml
+ </screen>
+ </para>
+ <para>
+ Re-deploying the HelloWorldPortlet produces output to the JBoss AS or JBoss
+ EAP console, similar to the following:
+ </para>
+ <para>
+ <screen><![CDATA[
INFO [TomcatDeployer] undeploy, ctxPath=/helloworldportlet,
warUrl=.../deploy/helloworldportlet.war/
INFO [TomcatDeployer] deploy, ctxPath=/helloworldportlet,
warUrl=.../deploy/helloworldportlet.war/]]>
-</screen>
-</para>
-</sect3>
+ </screen>
+ </para>
+ </sect3>
</sect2>
<sect2>
- <title>An example <trademark class="trade">JavaServer</trademark> Pages (<trademark class="trade">JSP</trademark>) portlet</title>
+ <title>
+ An example
+ <trademark class="trade">JavaServer</trademark>
+ Pages (
+ <trademark class="trade">JSP</trademark>
+ ) portlet
+ </title>
<sect3>
<title>Introduction</title>
- <para>
- This section describes how to deploy a <trademark class="trade">JSP</trademark> portlet in JBoss Portal. Before proceeding, download the <ulink url="http://anonsvn.jboss.org/repos/portletswap/portlets/2_4/bundles/HelloWorl...">HelloWorldJSPPortlet</ulink> from <ulink url="http://labs.jboss.com/portletswap/">JBoss PortletSwap</ulink>. The HelloWorldJSPPortlet demonstrates how to use JSP pages for view rendering, and the portlet tag library (taglib) for generating links.
+ <para>
+ This section describes how to deploy a
+ <trademark class="trade">JSP</trademark>
+ portlet in JBoss Portal. Before proceeding, download the
+ <ulink
+ url="http://anonsvn.jboss.org/repos/portletswap/portlets/2_4/bundles/HelloWorl...">
+ HelloWorldJSPPortlet
+ </ulink>
+ from
+ <ulink url="http://labs.jboss.com/portletswap/">JBoss PortletSwap</ulink>
+ . The HelloWorldJSPPortlet demonstrates how to use JSP pages for view
+ rendering, and the portlet tag library (taglib) for generating links.
</para>
</sect3>
<sect3>
<title>Package Structure</title>
<para>
- The application descriptors for the HelloWorldJSPPortlet portlet are similar to those from the HelloWorldPortlet (<xref linkend="first_portlet_descriptors"/>). Refer to <xref linkend="descriptors_portlet"/> for further information about application descriptors.
- </para>
- <para>
- The HelloWorldJSPPortlet portlet contains the traditional portlet and JBoss Portal specific application descriptors. The following is an example of the directory structure of the HelloWorldJSPPortlet portlet:
- </para>
- <para>
+ The application descriptors for the HelloWorldJSPPortlet portlet are
+ similar to those from the HelloWorldPortlet (
+ <xref linkend="first_portlet_descriptors" />
+ ). Refer to
+ <xref linkend="descriptors_portlet" />
+ for further information about application descriptors.
+ </para>
+ <para>
+ The HelloWorldJSPPortlet portlet contains the traditional portlet and JBoss
+ Portal specific application descriptors. The following is an example of the
+ directory structure of the HelloWorldJSPPortlet portlet:
+ </para>
+ <para>
<mediaobject>
<imageobject>
- <imagedata align="center" fileref="images/tutorials/jsp_portlet/package.gif" valign="middle"/>
+ <imagedata align="center"
+ fileref="images/tutorials/jsp_portlet/package.gif"
+ valign="middle" />
</imageobject>
</mediaobject>
</para>
- <para>
- To create the <filename>WEB-INF/</filename> and <filename>META-INF/</filename> directories, extract the <filename>helloworldjspportlet.war</filename> file.
- </para>
+ <para>
+ To create the
+ <filename>WEB-INF/</filename>
+ and
+ <filename>META-INF/</filename>
+ directories, extract the
+ <filename>helloworldjspportlet.war</filename>
+ file.
+ </para>
</sect3>
<sect3>
<title>Portlet Classes</title>
<para>
- The <ulink url="http://anonsvn.jboss.org/repos/portletswap/portlets/2_4/bundles/HelloWorl...">HelloWorldJSPPortlet</ulink> contains the <filename>HelloWorldJSPPortlet/src/main/org/jboss/portlet/hello/HelloWorldJSPPortlet.java</filename> file:
- </para>
- <para>
-<screen><![CDATA[
+ The
+ <ulink
+ url="http://anonsvn.jboss.org/repos/portletswap/portlets/2_4/bundles/HelloWorl...">
+ HelloWorldJSPPortlet
+ </ulink>
+ contains the
+ <filename>
+ HelloWorldJSPPortlet/src/main/org/jboss/portlet/hello/HelloWorldJSPPortlet.java
+ </filename>
+ file:
+ </para>
+ <para>
+ <screen><![CDATA[
package org.jboss.portlet.hello;
import javax.portlet.ActionRequest;
@@ -734,24 +1003,34 @@
prd.include(rRequest, rResponse);
}
}]]>
-</screen>
-</para>
-<para>
- <variablelist>
- <varlistentry><term><screen><![CDATA[
+ </screen>
+ </para>
+ <para>
+ <variablelist>
+ <varlistentry>
+ <term>
+ <screen><![CDATA[
protected void doHelp(RenderRequest rRequest, RenderResponse rResponse)
throws PortletException, IOException, UnavailableException]]>
-</screen><screen><![CDATA[
+ </screen>
+ <screen><![CDATA[
protected void doEdit(RenderRequest rRequest, RenderResponse rResponse)
throws PortletException, IOException, UnavailableException]]>
-</screen></term>
-<listitem>
- <para>
- Support for these modes must be declared in the <filename>HelloWorldJSPPortlet/WEB-INF/portlet.xml</filename> file. They are triggered when a user clicks on the respective icons in the portlet window titlebar, or through generated links within the portlet.
- </para>
-</listitem>
-</varlistentry>
-<varlistentry><term><screen><![CDATA[
+ </screen>
+ </term>
+ <listitem>
+ <para>
+ Support for these modes must be declared in the
+ <filename>HelloWorldJSPPortlet/WEB-INF/portlet.xml</filename>
+ file. They are triggered when a user clicks on the respective
+ icons in the portlet window titlebar, or through generated
+ links within the portlet.
+ </para>
+ </listitem>
+ </varlistentry>
+ <varlistentry>
+ <term>
+ <screen><![CDATA[
public void processAction(ActionRequest aRequest, ActionResponse aResponse)
throws PortletException, IOException, UnavailableException
{
@@ -761,52 +1040,105 @@
aResponse.setRenderParameter("yourname", sYourname);
}]]>
-</screen></term>
-<listitem>
- <para>
- This method is triggered when a user clicks on an <computeroutput>actionURL</computeroutput>, which is defined in the <filename>HelloWorldJSPPortlet/WEB-INF/jsp/view.jsp</filename> file. This retrieves <computeroutput>yourname</computeroutput> from the HTML form, and passes it as a <computeroutput>aResponse.setRenderParameter</computeroutput> to the <literal>doView()</literal> method.
- </para>
-</listitem>
-</varlistentry>
-<varlistentry><term><screen><![CDATA[
+ </screen>
+ </term>
+ <listitem>
+ <para>
+ This method is triggered when a user clicks on an
+ <computeroutput>actionURL</computeroutput>
+ , which is defined in the
+ <filename>HelloWorldJSPPortlet/WEB-INF/jsp/view.jsp</filename>
+ file. This retrieves
+ <computeroutput>yourname</computeroutput>
+ from the HTML form, and passes it as a
+ <computeroutput>aResponse.setRenderParameter</computeroutput>
+ to the
+ <literal>doView()</literal>
+ method.
+ </para>
+ </listitem>
+ </varlistentry>
+ <varlistentry>
+ <term>
+ <screen><![CDATA[
rResponse.setContentType("text/html");]]>
-</screen></term>
-<listitem>
- <para>
- As in the servlet world, you must declare what content-type the portlet will be responding in. Do this before starting to write content, or the portlet throws an exception.
- </para>
-</listitem>
-</varlistentry>
-<varlistentry><term><screen><![CDATA[
+ </screen>
+ </term>
+ <listitem>
+ <para>
+ As in the servlet world, you must declare what content-type the
+ portlet will be responding in. Do this before starting to write
+ content, or the portlet throws an exception.
+ </para>
+ </listitem>
+ </varlistentry>
+ <varlistentry>
+ <term>
+ <screen><![CDATA[
protected void doView(RenderRequest rRequest, RenderResponse rResponse)
throws PortletException, IOException, UnavailableException]]>
-</screen></term>
-<listitem>
- <para>
- The <literal>doView</literal> implementation is responsible for dispatching to the appropriate JSP, <filename>HelloWorldJSPPortlet/WEB-INF/jsp/view.jsp</filename> or <filename>HelloWorldJSPPortlet/WEB-INF/jsp/view2.jsp</filename>, depending on the existence of the <literal>yourname</literal> parameter passed in from <literal>processAction</literal>.
- </para>
-</listitem>
-</varlistentry>
-</variablelist>
-</para>
+ </screen>
+ </term>
+ <listitem>
+ <para>
+ The
+ <literal>doView</literal>
+ implementation is responsible for dispatching to the
+ appropriate JSP,
+ <filename>HelloWorldJSPPortlet/WEB-INF/jsp/view.jsp</filename>
+ or
+ <filename>HelloWorldJSPPortlet/WEB-INF/jsp/view2.jsp</filename>
+ , depending on the existence of the
+ <literal>yourname</literal>
+ parameter passed in from
+ <literal>processAction</literal>
+ .
+ </para>
+ </listitem>
+ </varlistentry>
+ </variablelist>
+ </para>
</sect3>
<sect3>
- <title><trademark class="trade">JSP</trademark> files and the Portlet Tag Library</title>
+ <title>
+ <trademark class="trade">JSP</trademark>
+ files and the Portlet Tag Library
+ </title>
<para>
- The <filename>HelloWorldJSPPortlet/WEB-INF/jsp/view.jsp</filename> and <filename>HelloWorldJSPPortlet/WEB-INF/jsp/view2.jsp</filename> <trademark class="trade">JSP</trademark> files are included in the HelloWorldJSPPortlet portlet. The <filename>view.jsp</filename> file allows a user to input their name. This is then posted to the <computeroutput>processAction</computeroutput> method in the portlet class, which is set as a <computeroutput>aResponse.setRenderParameter</computeroutput>. The <computeroutput>doView</computeroutput> <literal>render</literal> method is invoked, which dispatches to the <filename>view2.jsp</filename> JSP:
- </para>
- <para>
+ The
+ <filename>HelloWorldJSPPortlet/WEB-INF/jsp/view.jsp</filename>
+ and
+ <filename>HelloWorldJSPPortlet/WEB-INF/jsp/view2.jsp</filename>
+ <trademark class="trade">JSP</trademark>
+ files are included in the HelloWorldJSPPortlet portlet. The
+ <filename>view.jsp</filename>
+ file allows a user to input their name. This is then posted to the
+ <computeroutput>processAction</computeroutput>
+ method in the portlet class, which is set as a
+ <computeroutput>aResponse.setRenderParameter</computeroutput>
+ . The
+ <computeroutput>doView</computeroutput>
+ <literal>render</literal>
+ method is invoked, which dispatches to the
+ <filename>view2.jsp</filename>
+ JSP:
+ </para>
+ <para>
<mediaobject>
<imageobject>
- <imagedata align="center" fileref="images/tutorials/jsp_portlet/process.gif" valign="middle"/>
+ <imagedata align="center"
+ fileref="images/tutorials/jsp_portlet/process.gif"
+ valign="middle" />
</imageobject>
</mediaobject>
</para>
- <para>
- The following is an example of the <filename>HelloWorldJSPPortlet/WEB-INF/jsp/view.jsp</filename> file:
+ <para>
+ The following is an example of the
+ <filename>HelloWorldJSPPortlet/WEB-INF/jsp/view.jsp</filename>
+ file:
</para>
<para>
-<screen><![CDATA[
+ <screen><![CDATA[
<%@ taglib uri="http://java.sun.com/portlet" prefix="portlet" %>
<portlet:defineObjects/>
@@ -826,215 +1158,400 @@
href="<portlet:renderURL><portlet:param name="yourname" value="Roy Russo">
</portlet:param></portlet:renderURL>">this</a>.
</div>]]>
-</screen>
-</para>
-<para>
-<variablelist>
- <varlistentry><term><screen><![CDATA[
+ </screen>
+ </para>
+ <para>
+ <variablelist>
+ <varlistentry>
+ <term>
+ <screen><![CDATA[
<%@ taglib uri="http://java.sun.com/portlet" prefix="portlet" %>]]>
-</screen></term>
-<listitem>
- <para>
- Define the portlet taglib. You do not need to bundle the portlet taglib - JBoss Portal handles this for you.
- </para>
-</listitem>
-</varlistentry>
-<varlistentry><term><screen><![CDATA[
+ </screen>
+ </term>
+ <listitem>
+ <para>
+ Define the portlet taglib. You do not need to bundle the
+ portlet taglib - JBoss Portal handles this for you.
+ </para>
+ </listitem>
+ </varlistentry>
+ <varlistentry>
+ <term>
+ <screen><![CDATA[
<portlet:defineObjects/>]]>
-</screen></term>
-<listitem>
- <para>
- Calling <literal>defineObjects</literal> makes available implicit objects in the JSP, such as
- <literal>renderRequest</literal>, <literal>actionRequest</literal>, and <literal>portletConfig</literal>.
- </para>
-</listitem>
-</varlistentry>
-<varlistentry><term><screen><![CDATA[
+ </screen>
+ </term>
+ <listitem>
+ <para>
+ Calling
+ <literal>defineObjects</literal>
+ makes available implicit objects in the JSP, such as
+ <literal>renderRequest</literal>
+ ,
+ <literal>actionRequest</literal>
+ , and
+ <literal>portletConfig</literal>
+ .
+ </para>
+ </listitem>
+ </varlistentry>
+ <varlistentry>
+ <term>
+ <screen><![CDATA[
<form action="<portlet:actionURL><portlet:param name="page" value="mainview"/>
</portlet:actionURL>" method="POST">]]>
-</screen></term>
-<listitem>
- <para>
- A HTML form is created. This form posts to the URL defined by the portlet taglib. In this example, an <computeroutput>actionURL</computeroutput> is created, that activates the <literal>processAction</literal> method, which passes the input parameters from the form.
- </para>
-</listitem>
-</varlistentry>
-<varlistentry><term><screen><![CDATA[
+ </screen>
+ </term>
+ <listitem>
+ <para>
+ A HTML form is created. This form posts to the URL defined by
+ the portlet taglib. In this example, an
+ <computeroutput>actionURL</computeroutput>
+ is created, that activates the
+ <literal>processAction</literal>
+ method, which passes the input parameters from the form.
+ </para>
+ </listitem>
+ </varlistentry>
+ <varlistentry>
+ <term>
+ <screen><![CDATA[
<a href="<portlet:renderURL><portlet:param name="yourname" value="Roy Russo">
</portlet:param></portlet:renderURL>">]]>
-</screen></term>
-<listitem>
- <para>
- You can create a link to the <computeroutput>doView</computeroutput> method by creating a <computeroutput>renderURL</computeroutput>, which passes the <computeroutput>yourname</computeroutput> parameter.
- </para>
-</listitem>
-</varlistentry>
-</variablelist>
-</para>
+ </screen>
+ </term>
+ <listitem>
+ <para>
+ You can create a link to the
+ <computeroutput>doView</computeroutput>
+ method by creating a
+ <computeroutput>renderURL</computeroutput>
+ , which passes the
+ <computeroutput>yourname</computeroutput>
+ parameter.
+ </para>
+ </listitem>
+ </varlistentry>
+ </variablelist>
+ </para>
</sect3>
<sect3>
- <title>Building your <trademark class="trade">JSP</trademark> portlet</title>
- <para>
- The <filename>HelloWorldJSPPortlet.zip</filename> file contains a pre-compiled <filename>helloworldjspportlet.war</filename> file; however, to manually build the <filename>helloworldjspportlet.war</filename> file:
- </para>
- <para>
- <orderedlist>
- <listitem>
- <para>
- Change into the <filename>HelloWorldJSPPortlet/</filename> directory, and remove the existing <filename>helloworldjspportlet.war</filename> file.
- </para>
- </listitem>
- <listitem>
- <para>
- If required, edit the <filename>HelloWorldJSPPortlet/src/main/org/jboss/portlet/hello/HelloWorldJSPPortlet.java</filename> file, and the application descriptors in the <filename>HelloWorldJSPPortlet/src/resources/helloworldjspportlet-war/WEB-INF/</filename> directory.
- </para>
- </listitem>
- <listitem>
- <para>
- Change into <filename>HelloWorldJSPPortlet/</filename> directory, and run the <command>ant deploy</command> command. On Linux, the output will be similar to the following:
- </para>
- <para>
- <mediaobject>
- <imageobject>
- <imagedata align="center" fileref="images/tutorials/jsp_portlet/jsp_ant_deploy.png" valign="middle"/>
- </imageobject>
- </mediaobject>
- </para>
- </listitem>
- </orderedlist>
- </para>
- <para>
- Note: the directory names will be different for your system.
- </para>
- <para>
- Expanding the <filename>helloworldjspportlet.war</filename> file allows you to deploy the portlet as an expanded directory, which makes development easier. As well, it gives you access to the application descriptors, resource files, JSF, and <trademark class="trade">JSP</trademark> pages. To expand the <filename>helloworldjspportlet.war</filename> file:
- </para>
- <para>
- <orderedlist>
- <listitem>
- <para>
- If you do not have the <filename>HelloWorldJSPPortlet/helloworldjspportlet.war</filename> file, change into the <filename>HelloWorldJSPPortlet/</filename> directory, and run the <command>ant deploy</command> command. This creates the <filename>helloworldjspportlet.war</filename> file.
- </para>
- </listitem>
- <listitem>
- <para>
- To expand the WAR file, change into the <filename>HelloWorldJSPPortlet/</filename> directory, and run the <command>ant explode</command> command. On Linux, the output will be similar to the following:
- </para>
- <para>
- <mediaobject>
- <imageobject>
- <imagedata align="center" fileref="images/tutorials/jsp_portlet/jsp_ant_explode.png" valign="middle"/>
- </imageobject>
- </mediaobject>
- </para>
- </listitem>
- </orderedlist>
- </para>
- <para>
- Note: the directory names will be different for your system.
- </para>
- <para>
- The <command>ant explode</command> command creates a directory structure such as the following:
- </para>
- <para>
- <mediaobject>
- <imageobject>
- <imagedata align="center" fileref="images/tutorials/jsp_portlet/exploded.gif" valign="middle"/>
- </imageobject>
- </mediaobject>
- </para>
- <para>
- The expanded WAR file and the application descriptors are located in the <filename>HelloWorldJSPPortlet/output/lib/exploded/helloworldjspportlet.war/WEB-INF/</filename> directory.
- </para>
- </sect3>
- <sect3>
- <title>Deploying your <trademark class="trade">JSP</trademark> portlet</title>
- <para>
- If you did not expand the <filename>helloworldjspportlet.war</filename> file, copy the <filename>HelloWorldJSPPortlet/helloworldjspportlet.war</filename> file into the correct JBoss AS or JBoss EAP <filename>deploy/</filename> directory. If you expanded the <filename>helloworldjspportlet.war</filename> file, copy the <filename>HelloWorldJSPPortlet/output/lib/exploded/helloworldjspportlet.war/</filename> directory into the correct JBoss AS or JBoss EAP <filename>deploy/</filename> directory. For example, if you are using the <computeroutput>default</computeroutput> JBoss AS profile, copy the WAR file or the expanded directory into the <filename>$JBOSS_HOME/server/default/deploy/</filename> directory.
- </para>
- <para>
- Performing this step on a running instance of JBoss AS or JBoss EAP, and JBoss Portal, triggers a hot-deploy of the portlet:
- </para>
- <para>
-<screen><![CDATA[
+ <title>
+ Building your
+ <trademark class="trade">JSP</trademark>
+ portlet
+ </title>
+ <para>
+ The
+ <filename>HelloWorldJSPPortlet.zip</filename>
+ file contains a pre-compiled
+ <filename>helloworldjspportlet.war</filename>
+ file; however, to manually build the
+ <filename>helloworldjspportlet.war</filename>
+ file:
+ </para>
+ <para>
+ <orderedlist>
+ <listitem>
+ <para>
+ Change into the
+ <filename>HelloWorldJSPPortlet/</filename>
+ directory, and remove the existing
+ <filename>helloworldjspportlet.war</filename>
+ file.
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+ If required, edit the
+ <filename>
+ HelloWorldJSPPortlet/src/main/org/jboss/portlet/hello/HelloWorldJSPPortlet.java
+ </filename>
+ file, and the application descriptors in the
+ <filename>
+ HelloWorldJSPPortlet/src/resources/helloworldjspportlet-war/WEB-INF/
+ </filename>
+ directory.
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+ Change into
+ <filename>HelloWorldJSPPortlet/</filename>
+ directory, and run the
+ <command>ant deploy</command>
+ command. On Linux, the output will be similar to the following:
+ </para>
+ <para>
+ <mediaobject>
+ <imageobject>
+ <imagedata align="center"
+ fileref="images/tutorials/jsp_portlet/jsp_ant_deploy.png"
+ valign="middle" />
+ </imageobject>
+ </mediaobject>
+ </para>
+ </listitem>
+ </orderedlist>
+ </para>
+ <para>Note: the directory names will be different for your system.</para>
+ <para>
+ Expanding the
+ <filename>helloworldjspportlet.war</filename>
+ file allows you to deploy the portlet as an expanded directory, which makes
+ development easier. As well, it gives you access to the application
+ descriptors, resource files, JSF, and
+ <trademark class="trade">JSP</trademark>
+ pages. To expand the
+ <filename>helloworldjspportlet.war</filename>
+ file:
+ </para>
+ <para>
+ <orderedlist>
+ <listitem>
+ <para>
+ If you do not have the
+ <filename>HelloWorldJSPPortlet/helloworldjspportlet.war</filename>
+ file, change into the
+ <filename>HelloWorldJSPPortlet/</filename>
+ directory, and run the
+ <command>ant deploy</command>
+ command. This creates the
+ <filename>helloworldjspportlet.war</filename>
+ file.
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+ To expand the WAR file, change into the
+ <filename>HelloWorldJSPPortlet/</filename>
+ directory, and run the
+ <command>ant explode</command>
+ command. On Linux, the output will be similar to the following:
+ </para>
+ <para>
+ <mediaobject>
+ <imageobject>
+ <imagedata align="center"
+ fileref="images/tutorials/jsp_portlet/jsp_ant_explode.png"
+ valign="middle" />
+ </imageobject>
+ </mediaobject>
+ </para>
+ </listitem>
+ </orderedlist>
+ </para>
+ <para>Note: the directory names will be different for your system.</para>
+ <para>
+ The
+ <command>ant explode</command>
+ command creates a directory structure such as the following:
+ </para>
+ <para>
+ <mediaobject>
+ <imageobject>
+ <imagedata align="center"
+ fileref="images/tutorials/jsp_portlet/exploded.gif"
+ valign="middle" />
+ </imageobject>
+ </mediaobject>
+ </para>
+ <para>
+ The expanded WAR file and the application descriptors are located in the
+ <filename>
+ HelloWorldJSPPortlet/output/lib/exploded/helloworldjspportlet.war/WEB-INF/
+ </filename>
+ directory.
+ </para>
+ </sect3>
+ <sect3>
+ <title>
+ Deploying your
+ <trademark class="trade">JSP</trademark>
+ portlet
+ </title>
+ <para>
+ If you did not expand the
+ <filename>helloworldjspportlet.war</filename>
+ file, copy the
+ <filename>HelloWorldJSPPortlet/helloworldjspportlet.war</filename>
+ file into the correct JBoss AS or JBoss EAP
+ <filename>deploy/</filename>
+ directory. If you expanded the
+ <filename>helloworldjspportlet.war</filename>
+ file, copy the
+ <filename>
+ HelloWorldJSPPortlet/output/lib/exploded/helloworldjspportlet.war/
+ </filename>
+ directory into the correct JBoss AS or JBoss EAP
+ <filename>deploy/</filename>
+ directory. For example, if you are using the
+ <computeroutput>default</computeroutput>
+ JBoss AS profile, copy the WAR file or the expanded directory into the
+ <filename>$JBOSS_HOME/server/default/deploy/</filename>
+ directory.
+ </para>
+ <para>
+ Performing this step on a running instance of JBoss AS or JBoss EAP, and
+ JBoss Portal, triggers a hot-deploy of the portlet:
+ </para>
+ <para>
+ <screen><![CDATA[
INFO [TomcatDeployer] deploy, ctxPath=/helloworldjspportlet,
warUrl=.../deploy/helloworldjspportlet.war/]]>
-</screen>
-</para>
-<para>
- To see the HelloWorldJSPPortlet, navigate to <ulink url="http://localhost:8080/portal/"></ulink>, or, if the default JBoss Portal page is already open, refresh the page. The HelloWorldJSPPortlet is added to the bottom of the default JBoss Portal page:
-</para>
-<para>
- <mediaobject>
- <imageobject>
- <imagedata align="center" fileref="images/tutorials/jsp_portlet/output.png" valign="middle"/>
- </imageobject>
- </mediaobject>
-</para>
-<para>
- To re-deploy the portlet, for example, if you have made changes to any of the application descriptors, touch the <filename>$JBOSS_HOME/server/<replaceable>configuration</replaceable>/deploy/helloworldjspportlet.war/WEB-INF/web.xml</filename> file. This only works if you copied the <filename>HelloWorldJSPPortlet/output/lib/exploded/helloworldjspportlet.war/</filename> directory into the JBoss AS or JBoss EAP <filename>deploy/</filename> directory. On Linux, run the following command to re-deploy the HelloWorldJSPPortlet:
-</para>
-<para>
-<screen>
-touch $JBOSS_HOME/server/<replaceable>configuration</replaceable>/deploy/helloworldjspportlet.war/WEB-INF/web.xml
-</screen>
-</para>
-<para>
- Re-deploying the HelloWorldJSPPortlet produces output to the JBoss AS or JBoss EAP console, similar to the following:
-</para>
-<para>
-<screen><![CDATA[
+ </screen>
+ </para>
+ <para>
+ To see the HelloWorldJSPPortlet, navigate to
+ <ulink url="http://localhost:8080/portal/"></ulink>
+ , or, if the default JBoss Portal page is already open, refresh the page.
+ The HelloWorldJSPPortlet is added to the bottom of the default JBoss Portal
+ page:
+ </para>
+ <para>
+ <mediaobject>
+ <imageobject>
+ <imagedata align="center"
+ fileref="images/tutorials/jsp_portlet/output.png" valign="middle" />
+ </imageobject>
+ </mediaobject>
+ </para>
+ <para>
+ To re-deploy the portlet, for example, if you have made changes to any of
+ the application descriptors, touch the
+ <filename>
+ $JBOSS_HOME/server/
+ <replaceable>configuration</replaceable>
+ /deploy/helloworldjspportlet.war/WEB-INF/web.xml
+ </filename>
+ file. This only works if you copied the
+ <filename>
+ HelloWorldJSPPortlet/output/lib/exploded/helloworldjspportlet.war/
+ </filename>
+ directory into the JBoss AS or JBoss EAP
+ <filename>deploy/</filename>
+ directory. On Linux, run the following command to re-deploy the
+ HelloWorldJSPPortlet:
+ </para>
+ <para>
+ <screen>
+ touch $JBOSS_HOME/server/
+ <replaceable>configuration</replaceable>
+ /deploy/helloworldjspportlet.war/WEB-INF/web.xml
+ </screen>
+ </para>
+ <para>
+ Re-deploying the HelloWorldJSPPortlet produces output to the JBoss AS or
+ JBoss EAP console, similar to the following:
+ </para>
+ <para>
+ <screen><![CDATA[
INFO [TomcatDeployer] undeploy, ctxPath=/helloworldjspportlet,
warUrl=.../deploy/helloworldjspportlet.war/
INFO [TomcatDeployer] deploy, ctxPath=/helloworldjspportlet,
warUrl=.../deploy/helloworldjspportlet.war/]]>
-</screen>
-</para>
-</sect3>
-</sect2>
+ </screen>
+ </para>
+ </sect3>
+ </sect2>
<sect2 id="sunri_42x">
- <title>An example <trademark class="trade">Sun</trademark> JSF Reference Implementation (RI) portlet</title>
+ <title>
+ An example
+ <trademark class="trade">Sun</trademark>
+ JSF Reference Implementation (RI) portlet
+ </title>
<sect3>
<title>Introduction</title>
<para>
- This section describes how to deploy a JSF portlet in JBoss Portal, using the Apache MyFaces JSF implementation in JBoss AS and JBoss EAP. Before proceeding, download the <ulink url="http://anonsvn.jboss.org/repos/portletswap/portlets/2_6/bundles/HelloWorl...">HelloWorldJSFSunRIPortlet</ulink> from <ulink url="http://labs.jboss.com/portletswap/">JBoss PortletSwap</ulink>.
+ This section describes how to deploy a JSF portlet in JBoss Portal, using
+ the Apache MyFaces JSF implementation in JBoss AS and JBoss EAP. Before
+ proceeding, download the
+ <ulink
+ url="http://anonsvn.jboss.org/repos/portletswap/portlets/2_6/bundles/HelloWorl...">
+ HelloWorldJSFSunRIPortlet
+ </ulink>
+ from
+ <ulink url="http://labs.jboss.com/portletswap/">JBoss PortletSwap</ulink>
+ .
</para>
- </sect3>
+ </sect3>
<sect3>
<title>Package Structure</title>
- <para>
- JBoss Portal requires certain descriptors to be included in a portlet WAR file. Some of these descriptors are defined by the JSR-168 Portlet Specification, and others are specific to JBoss Portal. Like a typical JSF application, the HelloWorldJSFSunRIPortlet package contains a <filename>faces-config.xml</filename> file that defines managed-beans, converters, validators, navigation rules, and so on. The following is an example of the directory structure of the HelloWorldJSFSunRIPortlet portlet:
- </para>
<para>
+ JBoss Portal requires certain descriptors to be included in a portlet WAR
+ file. Some of these descriptors are defined by the JSR-168 Portlet
+ Specification, and others are specific to JBoss Portal. Like a typical JSF
+ application, the HelloWorldJSFSunRIPortlet package contains a
+ <filename>faces-config.xml</filename>
+ file that defines managed-beans, converters, validators, navigation rules,
+ and so on. The following is an example of the directory structure of the
+ HelloWorldJSFSunRIPortlet portlet:
+ </para>
+ <para>
<mediaobject>
<imageobject>
- <imagedata align="center" fileref="images/tutorials/jsf_portlet/package_sunri.png" valign="middle"/>
+ <imagedata align="center"
+ fileref="images/tutorials/jsf_portlet/package_sunri.png"
+ valign="middle" />
</imageobject>
</mediaobject>
- </para>
- <para>
- To create the <filename>WEB-INF/</filename> and <filename>META-INF/</filename> directories, extract the <filename>helloworldjsfsunriportlet.war</filename> file.
- </para>
- <para>
+ </para>
+ <para>
+ To create the
+ <filename>WEB-INF/</filename>
+ and
+ <filename>META-INF/</filename>
+ directories, extract the
+ <filename>helloworldjsfsunriportlet.war</filename>
+ file.
+ </para>
+ <para>
<note>
- <title>Bundled <trademark class="trade">Sun</trademark> JSF RI</title>
- <para>
- JBoss AS version 4.2.<replaceable>x</replaceable> and JBoss EAP bundle the <trademark class="trade">Sun</trademark> JSF RI libraries in the
- <filename>$JBOSS_HOME/server/default/deploy/jboss-web.deployer/jsf-libs/</filename> directory. Therefore, you do not need to package the Sun JSF RI libraries with your portlet application.
- </para>
+ <title>
+ Bundled
+ <trademark class="trade">Sun</trademark>
+ JSF RI
+ </title>
+ <para>
+ JBoss AS version 4.2.
+ <replaceable>x</replaceable>
+ and JBoss EAP bundle the
+ <trademark class="trade">Sun</trademark>
+ JSF RI libraries in the
+ <filename>
+ $JBOSS_HOME/server/default/deploy/jboss-web.deployer/jsf-libs/
+ </filename>
+ directory. Therefore, you do not need to package the Sun JSF RI
+ libraries with your portlet application.
+ </para>
</note>
</para>
- </sect3>
- <sect3>
- <title>Application Descriptors</title>
+ </sect3>
+ <sect3>
+ <title>Application Descriptors</title>
<para>
- Only the <filename>portlet.xml</filename>, <filename>faces-config.xml</filename>, and <filename>web.xml</filename> descriptors are described here. For more information about application descriptors, refer to <xref linkend="first_portlet_descriptors"/> and <xref linkend="descriptors_portlet"/>.
- </para>
- <para>
- The following is an example of the <filename>HelloWorldJSFSunRIPortlet/WEB-INF/portlet.xml</filename> file. This file must adhere to its definition in the JSR-168 Portlet Specification. You may define more than one portlet application in this file:
- </para>
- <para>
-<screen><![CDATA[
+ Only the
+ <filename>portlet.xml</filename>
+ ,
+ <filename>faces-config.xml</filename>
+ , and
+ <filename>web.xml</filename>
+ descriptors are described here. For more information about application
+ descriptors, refer to
+ <xref linkend="first_portlet_descriptors" />
+ and
+ <xref linkend="descriptors_portlet" />
+ .
+ </para>
+ <para>
+ The following is an example of the
+ <filename>HelloWorldJSFSunRIPortlet/WEB-INF/portlet.xml</filename>
+ file. This file must adhere to its definition in the JSR-168 Portlet
+ Specification. You may define more than one portlet application in this
+ file:
+ </para>
+ <para>
+ <screen><![CDATA[
<?xml version="1.0" encoding="UTF-8"?>
<portlet-app xmlns="http://java.sun.com/xml/ns/portlet/portlet-app_1_0.xsd"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
@@ -1057,50 +1574,90 @@
</portlet-info>
</portlet>
</portlet-app>]]>
-</screen>
- </para>
- <para>
- <variablelist>
- <varlistentry><term><screen><![CDATA[
+ </screen>
+ </para>
+ <para>
+ <variablelist>
+ <varlistentry>
+ <term>
+ <screen><![CDATA[
<portlet-class>com.sun.faces.portlet.FacesPortlet</portlet-class>]]>
-</screen></term>
-<listitem>
- <para>
- This specifies that the <computeroutput>com.sun.faces.portlet.FacesPortlet</computeroutput> handles all requests and responses from the users. This class is part of the <filename>HelloWorldJSFSunRIPortlet/WEB-INF/lib/jsf-portlet.jar</filename> file.
- </para>
-</listitem>
-</varlistentry>
-<varlistentry><term><screen><![CDATA[
+ </screen>
+ </term>
+ <listitem>
+ <para>
+ This specifies that the
+ <computeroutput>
+ com.sun.faces.portlet.FacesPortlet
+ </computeroutput>
+ handles all requests and responses from the users. This class
+ is part of the
+ <filename>
+ HelloWorldJSFSunRIPortlet/WEB-INF/lib/jsf-portlet.jar
+ </filename>
+ file.
+ </para>
+ </listitem>
+ </varlistentry>
+ <varlistentry>
+ <term>
+ <screen><![CDATA[
<init-param>
<name>com.sun.faces.portlet.INIT_VIEW</name>
<value>/WEB-INF/jsp/index.jsp</value>
</init-param>]]>
-</screen></term>
-<listitem>
- <para>
- You must initialize the portlet with a default page to render, similar to a welcome page.
- </para>
-</listitem>
-</varlistentry>
-<varlistentry><term><screen><![CDATA[
+ </screen>
+ </term>
+ <listitem>
+ <para>
+ You must initialize the portlet with a default page to render,
+ similar to a welcome page.
+ </para>
+ </listitem>
+ </varlistentry>
+ <varlistentry>
+ <term>
+ <screen><![CDATA[
<supports>
<mime-type>text/html</mime-type>
<portlet-mode>view</portlet-mode>
-</supports>]]></screen></term>
- <listitem>
- <para>
- The <computeroutput><supports></computeroutput> element allows you to declare all of the markup types that a portlet supports in the <literal>render</literal> method. This is accomplished via the
- <computeroutput><mime-type></computeroutput> element, which is required for every portlet. The declared MIME types must match the capability of the portlet. As well, it allows you to pair which modes and window states are supported for each markup type. All portlets must support the <computeroutput>view</computeroutput> portlet mode, so this does not have to be declared. Use the <computeroutput><mime-type></computeroutput> element to define which markup type your portlet supports, which in this example, is <computeroutput>text/html</computeroutput>. This section tells the portal that it only outputs text and HTML, and that it only supports the <computeroutput>view</computeroutput> mode.
- </para>
-</listitem>
-</varlistentry>
-</variablelist>
-</para>
-<para>
- The following is an example <filename>HelloWorldJSFSunRIPortlet/WEB-INF/faces-config.xml</filename> file:
-</para>
-<para>
-<screen><![CDATA[
+</supports>]]></screen>
+ </term>
+ <listitem>
+ <para>
+ The
+ <computeroutput><supports></computeroutput>
+ element allows you to declare all of the markup types that a
+ portlet supports in the
+ <literal>render</literal>
+ method. This is accomplished via the
+ <computeroutput><mime-type></computeroutput>
+ element, which is required for every portlet. The declared MIME
+ types must match the capability of the portlet. As well, it
+ allows you to pair which modes and window states are supported
+ for each markup type. All portlets must support the
+ <computeroutput>view</computeroutput>
+ portlet mode, so this does not have to be declared. Use the
+ <computeroutput><mime-type></computeroutput>
+ element to define which markup type your portlet supports,
+ which in this example, is
+ <computeroutput>text/html</computeroutput>
+ . This section tells the portal that it only outputs text and
+ HTML, and that it only supports the
+ <computeroutput>view</computeroutput>
+ mode.
+ </para>
+ </listitem>
+ </varlistentry>
+ </variablelist>
+ </para>
+ <para>
+ The following is an example
+ <filename>HelloWorldJSFSunRIPortlet/WEB-INF/faces-config.xml</filename>
+ file:
+ </para>
+ <para>
+ <screen><![CDATA[
<?xml version="1.0"?>
<!DOCTYPE faces-config PUBLIC
"-//Sun Microsystems, Inc.//DTD JavaServer Faces Config 1.0//EN"
@@ -1120,16 +1677,32 @@
</navigation-case>
</navigation-rule>
</faces-config>]]>
-</screen>
-</para>
-<para>
- Without the <filename>faces-config.xml</filename> file, the application would work the same outside of the portlet as it would inside a portlet container. In this example, a basic user bean, <computeroutput><managed-bean-name>user</managed-bean-name></computeroutput>, and a navigation rule are defined, which handle the submission of the original form in the <filename>HelloWorldJSFSunRIPortlet/WEB-INF/jsp/index.jsp</filename> file.
-</para>
-<para>
- The following is an example of the <computeroutput>Faces Servlet</computeroutput> and <computeroutput>Faces Servlet Mapping</computeroutput> sections from the <filename>HelloWorldJSFSunRIPortlet/WEB-INF/web.xml</filename> file:
-</para>
-<para>
-<screen><![CDATA[
+ </screen>
+ </para>
+ <para>
+ Without the
+ <filename>faces-config.xml</filename>
+ file, the application would work the same outside of the portlet as it
+ would inside a portlet container. In this example, a basic user bean,
+ <computeroutput>
+ <managed-bean-name>user</managed-bean-name>
+ </computeroutput>
+ , and a navigation rule are defined, which handle the submission of the
+ original form in the
+ <filename>HelloWorldJSFSunRIPortlet/WEB-INF/jsp/index.jsp</filename>
+ file.
+ </para>
+ <para>
+ The following is an example of the
+ <computeroutput>Faces Servlet</computeroutput>
+ and
+ <computeroutput>Faces Servlet Mapping</computeroutput>
+ sections from the
+ <filename>HelloWorldJSFSunRIPortlet/WEB-INF/web.xml</filename>
+ file:
+ </para>
+ <para>
+ <screen><![CDATA[
<?xml version="1.0"?>
<!DOCTYPE web-app PUBLIC
"-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
@@ -1151,212 +1724,361 @@
</servlet-mapping>
</web-app>]]>
-</screen>
-</para>
-<para>
- For Sun JSF RI portlets, the <computeroutput>Faces Servlet</computeroutput> and <computeroutput>Faces Servlet Mapping</computeroutput> sections are required to associate files with the <filename>.jsf</filename> extension to the Apache MyFaces servlet.
-</para>
-<para>
- <warning>
- <title>Classes for the JSF-Portlet bridge are not included</title>
- <para>
- Unlike Apache MyFaces, the classes for the JSF-Portlet bridge are not included in the JSF implementation, JBoss AS, or JBoss EAP. This library must be available in your application package. Navigate to the <ulink url="https://jsfportletbridge.dev.java.net/servlets/ProjectDocumentList">JSF-Portlet bridge webpage</ulink> to download the JSF-Portlet bridge library.
- </para>
- </warning>
-</para>
+ </screen>
+ </para>
+ <para>
+ For Sun JSF RI portlets, the
+ <computeroutput>Faces Servlet</computeroutput>
+ and
+ <computeroutput>Faces Servlet Mapping</computeroutput>
+ sections are required to associate files with the
+ <filename>.jsf</filename>
+ extension to the Apache MyFaces servlet.
+ </para>
+ <para>
+ <warning>
+ <title>Classes for the JSF-Portlet bridge are not included</title>
+ <para>
+ Unlike Apache MyFaces, the classes for the JSF-Portlet bridge are not
+ included in the JSF implementation, JBoss AS, or JBoss EAP. This
+ library must be available in your application package. Navigate to
+ the
+ <ulink
+ url="https://jsfportletbridge.dev.java.net/servlets/ProjectDocumentList">
+ JSF-Portlet bridge webpage
+ </ulink>
+ to download the JSF-Portlet bridge library.
+ </para>
+ </warning>
+ </para>
</sect3>
<sect3>
- <title>Building your JSF portlet</title>
- <para>
- The <filename>HelloWorldJSFSunRIPortlet.zip</filename> file contains a pre-compiled <filename>helloworldjsfsunriportlet.war</filename> file; however, to manually build the <filename>helloworldjsfsunriportlet.war</filename> file:
- </para>
- <para>
- <orderedlist>
- <listitem>
- <para>
- Change into the <filename>HelloWorldJSFSunRIPortlet/</filename> directory, and remove the existing <filename>helloworldjsfsunriportlet.war</filename> file.
- </para>
- </listitem>
- <listitem>
- <para>
- If required, edit the <filename>HelloWorldJSFSunRIPortlet/src/main/org/jboss/portlet/hello/bean/User.java</filename> file, and the application descriptors in the <filename>HelloWorldJSFSunRIPortlet/src/resources/helloworldjsfsunriportlet-war/WEB-INF/</filename> directory.
- </para>
- </listitem>
- <listitem>
- <para>
- Change into <filename>HelloWorldJSFSunRIPortlet/</filename> directory, and run the <command>ant deploy</command> command. On Linux, the output will be similar to the following:
- </para>
- <para>
- <mediaobject>
- <imageobject>
- <imagedata align="center" fileref="images/tutorials/jsf_portlet/jsf_ant_deploy.png" valign="middle"/>
- </imageobject>
- </mediaobject>
- </para>
- </listitem>
- </orderedlist>
- </para>
- <para>
- Note: the directory names will be different for your system.
- </para>
- <para>
- Expanding the <filename>helloworldjsfsunriportlet.war</filename> file allows you to deploy the portlet as an expanded directory, which makes development easier. As well, it gives you access to the application descriptors, resource files, JSF, and JSP pages. To expand the <filename>helloworldjsfsunriportlet.war</filename> file:
- </para>
- <para>
- <orderedlist>
- <listitem>
- <para>
- If you do not have the <filename>HelloWorldJSFSunRIPortlet/helloworldjsfsunriportlet.war</filename> file, change into the <filename>HelloWorldJSFSunRIPortlet/</filename> directory, and run the <command>ant deploy</command> command. This creates the <filename>helloworldjsfsunriportlet.war</filename> file.
- </para>
- </listitem>
- <listitem>
- <para>
- To expand the WAR file, change into the <filename>HelloWorldJSFSunRIPortlet/</filename> directory, and run the <command>ant explode</command> command. On Linux, the output will be similar to the following:
- </para>
- <para>
- <mediaobject>
- <imageobject>
- <imagedata align="center" fileref="images/tutorials/jsf_portlet/jsf_ant_explode.png" valign="middle"/>
- </imageobject>
- </mediaobject>
- </para>
- </listitem>
- </orderedlist>
- </para>
- <para>
- Note: the directory names will be different for your system.
- </para>
- <para>
- The expanded WAR file and the application descriptors are located in the <filename>HelloWorldJSFSunRIPortlet/output/lib/exploded/helloworldjsfsunriportlet.war/WEB-INF/</filename> directory.
+ <title>Building your JSF portlet</title>
+ <para>
+ The
+ <filename>HelloWorldJSFSunRIPortlet.zip</filename>
+ file contains a pre-compiled
+ <filename>helloworldjsfsunriportlet.war</filename>
+ file; however, to manually build the
+ <filename>helloworldjsfsunriportlet.war</filename>
+ file:
</para>
- </sect3>
- <sect3>
- <title>Deploying your JSF portlet</title>
- <para>
- If you did not expand the <filename>helloworldjsfsunriportlet.war</filename> file, copy the <filename>HelloWorldJSFSunRIPortlet/helloworldjsfsunriportlet.war</filename> file into the correct JBoss AS or JBoss EAP <filename>deploy/</filename> directory. If you expanded the <filename>helloworldjsfsunriportlet.war</filename> file, copy the <filename>HelloWorldJSFSunRIPortlet/output/lib/exploded/helloworldjsfsunriportlet.war/</filename> directory into the correct JBoss AS or JBoss EAP <filename>deploy/</filename> directory. For example, if you are using <computeroutput>default</computeroutput> JBoss AS profile, copy the WAR file or the expanded directory into the <filename>$JBOSS_HOME/server/default/deploy/</filename> directory.
- </para>
- <para>
- Performing this step on a running instance of JBoss AS or JBoss EAP, and JBoss Portal, triggers a hot-deploy of the portlet:
- </para>
- <para>
-<screen><![CDATA[
+ <para>
+ <orderedlist>
+ <listitem>
+ <para>
+ Change into the
+ <filename>HelloWorldJSFSunRIPortlet/</filename>
+ directory, and remove the existing
+ <filename>helloworldjsfsunriportlet.war</filename>
+ file.
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+ If required, edit the
+ <filename>
+ HelloWorldJSFSunRIPortlet/src/main/org/jboss/portlet/hello/bean/User.java
+ </filename>
+ file, and the application descriptors in the
+ <filename>
+ HelloWorldJSFSunRIPortlet/src/resources/helloworldjsfsunriportlet-war/WEB-INF/
+ </filename>
+ directory.
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+ Change into
+ <filename>HelloWorldJSFSunRIPortlet/</filename>
+ directory, and run the
+ <command>ant deploy</command>
+ command. On Linux, the output will be similar to the following:
+ </para>
+ <para>
+ <mediaobject>
+ <imageobject>
+ <imagedata align="center"
+ fileref="images/tutorials/jsf_portlet/jsf_ant_deploy.png"
+ valign="middle" />
+ </imageobject>
+ </mediaobject>
+ </para>
+ </listitem>
+ </orderedlist>
+ </para>
+ <para>Note: the directory names will be different for your system.</para>
+ <para>
+ Expanding the
+ <filename>helloworldjsfsunriportlet.war</filename>
+ file allows you to deploy the portlet as an expanded directory, which makes
+ development easier. As well, it gives you access to the application
+ descriptors, resource files, JSF, and JSP pages. To expand the
+ <filename>helloworldjsfsunriportlet.war</filename>
+ file:
+ </para>
+ <para>
+ <orderedlist>
+ <listitem>
+ <para>
+ If you do not have the
+ <filename>
+ HelloWorldJSFSunRIPortlet/helloworldjsfsunriportlet.war
+ </filename>
+ file, change into the
+ <filename>HelloWorldJSFSunRIPortlet/</filename>
+ directory, and run the
+ <command>ant deploy</command>
+ command. This creates the
+ <filename>helloworldjsfsunriportlet.war</filename>
+ file.
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+ To expand the WAR file, change into the
+ <filename>HelloWorldJSFSunRIPortlet/</filename>
+ directory, and run the
+ <command>ant explode</command>
+ command. On Linux, the output will be similar to the following:
+ </para>
+ <para>
+ <mediaobject>
+ <imageobject>
+ <imagedata align="center"
+ fileref="images/tutorials/jsf_portlet/jsf_ant_explode.png"
+ valign="middle" />
+ </imageobject>
+ </mediaobject>
+ </para>
+ </listitem>
+ </orderedlist>
+ </para>
+ <para>Note: the directory names will be different for your system.</para>
+ <para>
+ The expanded WAR file and the application descriptors are located in the
+ <filename>
+ HelloWorldJSFSunRIPortlet/output/lib/exploded/helloworldjsfsunriportlet.war/WEB-INF/
+ </filename>
+ directory.
+ </para>
+ </sect3>
+ <sect3>
+ <title>Deploying your JSF portlet</title>
+ <para>
+ If you did not expand the
+ <filename>helloworldjsfsunriportlet.war</filename>
+ file, copy the
+ <filename>
+ HelloWorldJSFSunRIPortlet/helloworldjsfsunriportlet.war
+ </filename>
+ file into the correct JBoss AS or JBoss EAP
+ <filename>deploy/</filename>
+ directory. If you expanded the
+ <filename>helloworldjsfsunriportlet.war</filename>
+ file, copy the
+ <filename>
+ HelloWorldJSFSunRIPortlet/output/lib/exploded/helloworldjsfsunriportlet.war/
+ </filename>
+ directory into the correct JBoss AS or JBoss EAP
+ <filename>deploy/</filename>
+ directory. For example, if you are using
+ <computeroutput>default</computeroutput>
+ JBoss AS profile, copy the WAR file or the expanded directory into the
+ <filename>$JBOSS_HOME/server/default/deploy/</filename>
+ directory.
+ </para>
+ <para>
+ Performing this step on a running instance of JBoss AS or JBoss EAP, and
+ JBoss Portal, triggers a hot-deploy of the portlet:
+ </para>
+ <para>
+ <screen><![CDATA[
INFO [TomcatDeployer] deploy, ctxPath=/helloworldjsfsunriportlet,
warUrl=.../tmp/deploy/tmp9138helloworldjsfsunriportlet-exp.war/]]>
-</screen>
- </para>
- <para>
- To see the HelloWorldJSFSunRIPortlet, navigate to <ulink url="http://localhost:8080/portal/">http://localhost:8080/portal/</ulink>, or, if the default JBoss Portal page is already open, refresh the page. The HelloWorldJSFSunRIPortlet is added to the bottom of the default JBoss Portal page:
- </para>
- <para>
- <mediaobject>
- <imageobject>
- <imagedata align="center" fileref="images/tutorials/jsf_portlet/output.png" valign="middle"/>
- </imageobject>
+ </screen>
+ </para>
+ <para>
+ To see the HelloWorldJSFSunRIPortlet, navigate to
+ <ulink url="http://localhost:8080/portal/">
+ http://localhost:8080/portal/
+ </ulink>
+ , or, if the default JBoss Portal page is already open, refresh the page.
+ The HelloWorldJSFSunRIPortlet is added to the bottom of the default JBoss
+ Portal page:
+ </para>
+ <para>
+ <mediaobject>
+ <imageobject>
+ <imagedata align="center"
+ fileref="images/tutorials/jsf_portlet/output.png" valign="middle" />
+ </imageobject>
</mediaobject>
</para>
- <para>
- To re-deploy the portlet, for example, if you have made changes to any of the application descriptors, touch the <filename>$JBOSS_HOME/server/<replaceable>configuration</replaceable>/deploy/helloworldjsfsunriportlet.war/WEB-INF/web.xml</filename> file. This only works if you copied the <filename>HelloWorldJSFSunRIPortlet/output/lib/exploded/helloworldjsfsunriportlet.war/</filename> directory into the JBoss AS or JBoss EAP <filename>deploy/</filename> directory. On Linux, run the following command to re-deploy the HelloWorldJSFSunRIPortlet:
- </para>
- <para>
-<screen>
-touch $JBOSS_HOME/server/<replaceable>configuration</replaceable>/deploy/helloworldjsfsunriportlet.war/WEB-INF/web.xml
-</screen>
- </para>
- <para>
- Re-deploying the HelloWorldJSFSunRIPortlet produces output to the JBoss AS or JBoss EAP console, similar to the following:
- </para>
- <para>
-<screen><![CDATA[
+ <para>
+ To re-deploy the portlet, for example, if you have made changes to any of
+ the application descriptors, touch the
+ <filename>
+ $JBOSS_HOME/server/
+ <replaceable>configuration</replaceable>
+ /deploy/helloworldjsfsunriportlet.war/WEB-INF/web.xml
+ </filename>
+ file. This only works if you copied the
+ <filename>
+ HelloWorldJSFSunRIPortlet/output/lib/exploded/helloworldjsfsunriportlet.war/
+ </filename>
+ directory into the JBoss AS or JBoss EAP
+ <filename>deploy/</filename>
+ directory. On Linux, run the following command to re-deploy the
+ HelloWorldJSFSunRIPortlet:
+ </para>
+ <para>
+ <screen>
+ touch $JBOSS_HOME/server/
+ <replaceable>configuration</replaceable>
+ /deploy/helloworldjsfsunriportlet.war/WEB-INF/web.xml
+ </screen>
+ </para>
+ <para>
+ Re-deploying the HelloWorldJSFSunRIPortlet produces output to the JBoss AS
+ or JBoss EAP console, similar to the following:
+ </para>
+ <para>
+ <screen><![CDATA[
INFO [TomcatDeployer] undeploy, ctxPath=/helloworldjsfsunriportlet,
warUrl=.../deploy/helloworldjsfsunriportlet.war/
INFO [TomcatDeployer] deploy, ctxPath=/helloworldjsfsunriportlet,
warUrl=.../deploy/helloworldjsfsunriportlet.war/]]>
-</screen>
- </para>
- </sect3>
-</sect2>
+ </screen>
+ </para>
+ </sect3>
+ </sect2>
<!--<sect2 id="sunri_42x_301">
<title>Portal and JSF RI: A basic demonstration using common components</title>
<sect3>
- <para>JSF portlets are now possible using the MyFaces 301 implementation of the JSR-301 specification.
- This does NOT mean that you are using the MyFaces implementation of JSF, it only means that you are
- using the 301 bridge implementation (which was initially donated by Oracle). The 301 spec or bridge is
- a subsystem that allows a JavaServer Faces resource to execute and satisfy a portlet request. You can
- read more about the specification details <ulink url="http://jcp.org/en/jsr/detail?id=301">here</ulink>.
- </para>
+ <para>JSF portlets are now possible using the MyFaces 301 implementation of the JSR-301 specification.
+ This does NOT mean that you are using the MyFaces implementation of JSF, it only means that you are
+ using the 301 bridge implementation (which was initially donated by Oracle). The 301 spec or bridge is
+ a subsystem that allows a JavaServer Faces resource to execute and satisfy a portlet request. You can
+ read more about the specification details <ulink url="http://jcp.org/en/jsr/detail?id=301">here</ulink>.
+ </para>
</sect3>
<sect3>
- <title>Downloading The Project Source</title>
- <para>
- You have 2 options for getting started.
- <sbr/>
- 1) Download the binary distribution in a zip file. This will
- include all the source files along with a deployable war file.
- <sbr/>
- 2) Use subversion to checkout the source
- code. If you plan on making changes to the source or possibly using it as a template for future development,
- it is recommended that you checkout the project and use maven to build the war.
- <para>
- For instructions on setting up Subversion and/or Maven 2 see <xref linkend="first_portlet_descriptors"/>
- </para>
- <itemizedlist>
- <listitem>
- <para>
- You can download all the project files in one zip file here:
- <sbr/>
- <ulink url="http://anonsvn.jboss.org/repos/portletswap/portlets/2_6/bundles/JSFRIPort...">http://anonsvn.jboss.org/repos/portletswap/portlets/2_6/bundles/JSFRIPort...</ulink>.
- <sbr/>
- Once you extract the zip archive, the deployable war file is located in the target/ directory.
- </para>
- </listitem>
- <listitem>
- <para>
- The source code:
- <sbr/>
- <ulink url="http://anonsvn.jboss.org/repos/portletswap/portlets/src/framework/JSFRIPo...">http://anonsvn.jboss.org/repos/portletswap/portlets/src/framework/JSFRIPo...</ulink>.
- </para>
- </listitem>
- </itemizedlist>
- </para>
+ <title>Downloading The Project Source</title>
+ <para>
+ You have 2 options for getting started.
+ <sbr/>
+ 1) Download the binary distribution in a zip file. This will
+ include all the source files along with a deployable war file.
+ <sbr/>
+ 2) Use subversion to checkout the source
+ code. If you plan on making changes to the source or possibly using it as a template for future development,
+ it is recommended that you checkout the project and use maven to build the war.
+ <para>
+ For instructions on setting up Subversion and/or Maven 2 see <xref linkend="first_portlet_descriptors"/>
+ </para>
+ <itemizedlist>
+ <listitem>
+ <para>
+ You can download all the project files in one zip file here:
+ <sbr/>
+ <ulink url="http://anonsvn.jboss.org/repos/portletswap/portlets/2_6/bundles/JSFRIPort...">http://anonsvn.jboss.org/repos/portletswap/portlets/2_6/bundles/JSFRIPort...</ulink>.
+ <sbr/>
+ Once you extract the zip archive, the deployable war file is located in the target/ directory.
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+ The source code:
+ <sbr/>
+ <ulink url="http://anonsvn.jboss.org/repos/portletswap/portlets/src/framework/JSFRIPo...">http://anonsvn.jboss.org/repos/portletswap/portlets/src/framework/JSFRIPo...</ulink>.
+ </para>
+ </listitem>
+ </itemizedlist>
+ </para>
</sect3>
- </sect2>-->
+ </sect2>-->
<sect2 id="myfaces_42x">
<title>An example Apache MyFaces JSF portlet</title>
<sect3>
<title>Introduction</title>
- <para>
- This section describes how to deploy a JSF portlet in JBoss Portal, using the Apache MyFaces JSF implementation in JBoss AS and JBoss EAP. Before proceeding, download the <ulink url="http://anonsvn.jboss.org/repos/portletswap/portlets/2_6/bundles/HelloWorl...">HelloWorldJSFMyFaces42Portlet</ulink> from <ulink url="http://labs.jboss.com/portletswap/">JBoss PortletSwap</ulink>.
- </para>
- <para>
- Apache MyFaces can be used globally for the entire server, replacing the Sun JSF RI libraries, but the HelloWorldJSFMyFaces42Portlet uses its own libraries, but does not affect the application server.
- </para>
+ <para>
+ This section describes how to deploy a JSF portlet in JBoss Portal, using
+ the Apache MyFaces JSF implementation in JBoss AS and JBoss EAP. Before
+ proceeding, download the
+ <ulink
+ url="http://anonsvn.jboss.org/repos/portletswap/portlets/2_6/bundles/HelloWorl...">
+ HelloWorldJSFMyFaces42Portlet
+ </ulink>
+ from
+ <ulink url="http://labs.jboss.com/portletswap/">JBoss PortletSwap</ulink>
+ .
+ </para>
+ <para>
+ Apache MyFaces can be used globally for the entire server, replacing the
+ Sun JSF RI libraries, but the HelloWorldJSFMyFaces42Portlet uses its own
+ libraries, but does not affect the application server.
+ </para>
</sect3>
<sect3>
<title>Package Structure</title>
- <para>
- JBoss Portal requires certain descriptors to be included in a portlet WAR file. Some of these descriptors are defined by the JSR-168 Portlet Specification, and others are specific to JBoss Portal. Like a typical JSF application, the HelloWorldJSFMyFaces42Portlet package contains a <filename>faces-config.xml</filename> file that defines managed-beans, converters, validators, navigation rules, and so on. The following is an example of the directory structure of the HelloWorldJSFMyFaces42Portlet portlet:
- </para>
<para>
+ JBoss Portal requires certain descriptors to be included in a portlet WAR
+ file. Some of these descriptors are defined by the JSR-168 Portlet
+ Specification, and others are specific to JBoss Portal. Like a typical JSF
+ application, the HelloWorldJSFMyFaces42Portlet package contains a
+ <filename>faces-config.xml</filename>
+ file that defines managed-beans, converters, validators, navigation rules,
+ and so on. The following is an example of the directory structure of the
+ HelloWorldJSFMyFaces42Portlet portlet:
+ </para>
+ <para>
<mediaobject>
<imageobject>
- <imagedata align="center" fileref="images/tutorials/jsf_portlet/package_myfaces42.png" valign="middle"/>
+ <imagedata align="center"
+ fileref="images/tutorials/jsf_portlet/package_myfaces42.png"
+ valign="middle" />
</imageobject>
</mediaobject>
- </para>
- <para>
- To create the <filename>WEB-INF/</filename> and <filename>META-INF/</filename> directories, extract the <filename>helloworldjsfmyfacesportlet.war</filename> file. The <filename>WEB-INF/lib/</filename> directory must contain the Apache MyFaces libraries, along with the dependent libraries.
</para>
- </sect3>
- <sect3>
- <title>Application Descriptors</title>
- <para>
- Only the <filename>portlet.xml</filename>, <filename>faces-config.xml</filename>, and <filename>web.xml</filename> descriptors are described here. For more information about application descriptors, refer to <xref linkend="first_portlet_descriptors"/> and <xref linkend="descriptors_portlet"/>.
- </para>
- <para>
- The following is an example of the <filename>HelloWorldJSFMyFaces42Portlet/WEB-INF/portlet.xml</filename> file. This file must adhere to its definition in the JSR-168 Portlet Specification. You may define more than one portlet application in this file:
- </para>
- <para>
-<screen><![CDATA[
+ <para>
+ To create the
+ <filename>WEB-INF/</filename>
+ and
+ <filename>META-INF/</filename>
+ directories, extract the
+ <filename>helloworldjsfmyfacesportlet.war</filename>
+ file. The
+ <filename>WEB-INF/lib/</filename>
+ directory must contain the Apache MyFaces libraries, along with the
+ dependent libraries.
+ </para>
+ </sect3>
+ <sect3>
+ <title>Application Descriptors</title>
+ <para>
+ Only the
+ <filename>portlet.xml</filename>
+ ,
+ <filename>faces-config.xml</filename>
+ , and
+ <filename>web.xml</filename>
+ descriptors are described here. For more information about application
+ descriptors, refer to
+ <xref linkend="first_portlet_descriptors" />
+ and
+ <xref linkend="descriptors_portlet" />
+ .
+ </para>
+ <para>
+ The following is an example of the
+ <filename>HelloWorldJSFMyFaces42Portlet/WEB-INF/portlet.xml</filename>
+ file. This file must adhere to its definition in the JSR-168 Portlet
+ Specification. You may define more than one portlet application in this
+ file:
+ </para>
+ <para>
+ <screen><![CDATA[
<?xml version="1.0" encoding="UTF-8"?>
<portlet-app xmlns="http://java.sun.com/xml/ns/portlet/portlet-app_1_0.xsd"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
@@ -1379,58 +2101,97 @@
</portlet-info>
</portlet>
</portlet-app>]]>
-</screen>
-</para>
-<para>
- <variablelist>
- <varlistentry><term><screen><![CDATA[
+ </screen>
+ </para>
+ <para>
+ <variablelist>
+ <varlistentry>
+ <term>
+ <screen><![CDATA[
<portlet-class>org.apache.myfaces.portlet.MyFacesGenericPortlet</portlet-class>]]>
-</screen></term>
-<listitem>
- <para>
- This specifies that the <computeroutput>org.apache.myfaces.portlet.MyFacesGenericPortlet</computeroutput> handles all requests and responses from the users. Therefore, there is no need to develop a specific portlet class, as Apache MyFaces provides a generic implementation which bridges the JSF and portlet worlds.
- </para>
-</listitem>
-</varlistentry>
-<varlistentry><term><screen><![CDATA[
+ </screen>
+ </term>
+ <listitem>
+ <para>
+ This specifies that the
+ <computeroutput>
+ org.apache.myfaces.portlet.MyFacesGenericPortlet
+ </computeroutput>
+ handles all requests and responses from the users. Therefore,
+ there is no need to develop a specific portlet class, as Apache
+ MyFaces provides a generic implementation which bridges the JSF
+ and portlet worlds.
+ </para>
+ </listitem>
+ </varlistentry>
+ <varlistentry>
+ <term>
+ <screen><![CDATA[
<init-param>
<name>default-view</name>
<value>/WEB-INF/jsp/index.jsp</value>
</init-param>]]>
-</screen></term>
-<listitem>
- <para>
- You must initialize the portlet with a default page to render, similar to a welcome page.
- </para>
-</listitem>
-</varlistentry>
-<varlistentry><term><screen><![CDATA[
+ </screen>
+ </term>
+ <listitem>
+ <para>
+ You must initialize the portlet with a default page to render,
+ similar to a welcome page.
+ </para>
+ </listitem>
+ </varlistentry>
+ <varlistentry>
+ <term>
+ <screen><![CDATA[
<supports>
<mime-type>text/html</mime-type>
<portlet-mode>view</portlet-mode>
-</supports>]]></screen></term>
- <listitem>
- <para>
- The <computeroutput><supports></computeroutput> element allows you to declare all of the markup types that a portlet supports in the <literal>render</literal> method. This is accomplished via the
- <computeroutput><mime-type></computeroutput> element, which is required for every portlet. The declared MIME types must match the capability of the portlet. As well, it allows you to pair which modes and window states are supported for each markup type. All portlets must support the <computeroutput>view</computeroutput> portlet mode, so this does not have to be declared. Use the <computeroutput><mime-type></computeroutput> element to define which markup type your portlet supports, which in this example, is <computeroutput>text/html</computeroutput>. This section tells the portal that it only outputs text and HTML, and that it only supports the <computeroutput>view</computeroutput> mode.
- </para>
-</listitem>
-</varlistentry>
-</variablelist>
-</para>
-<para>
- <note>
- <title>Adding Functionality to an Apache MyFaces JSF portlet</title>
- <para>
- To add functionality to an Apache MyFaces JSF portlet, sub-class it and create your own class.
- </para>
- </note>
-</para>
-<para>
- The following is an example <filename>HelloWorldJSFMyFaces42Portlet/WEB-INF/faces-config.xml</filename> file:
-</para>
-<para>
-<screen><![CDATA[
+</supports>]]></screen>
+ </term>
+ <listitem>
+ <para>
+ The
+ <computeroutput><supports></computeroutput>
+ element allows you to declare all of the markup types that a
+ portlet supports in the
+ <literal>render</literal>
+ method. This is accomplished via the
+ <computeroutput><mime-type></computeroutput>
+ element, which is required for every portlet. The declared MIME
+ types must match the capability of the portlet. As well, it
+ allows you to pair which modes and window states are supported
+ for each markup type. All portlets must support the
+ <computeroutput>view</computeroutput>
+ portlet mode, so this does not have to be declared. Use the
+ <computeroutput><mime-type></computeroutput>
+ element to define which markup type your portlet supports,
+ which in this example, is
+ <computeroutput>text/html</computeroutput>
+ . This section tells the portal that it only outputs text and
+ HTML, and that it only supports the
+ <computeroutput>view</computeroutput>
+ mode.
+ </para>
+ </listitem>
+ </varlistentry>
+ </variablelist>
+ </para>
+ <para>
+ <note>
+ <title>Adding Functionality to an Apache MyFaces JSF portlet</title>
+ <para>
+ To add functionality to an Apache MyFaces JSF portlet, sub-class it
+ and create your own class.
+ </para>
+ </note>
+ </para>
+ <para>
+ The following is an example
+ <filename>HelloWorldJSFMyFaces42Portlet/WEB-INF/faces-config.xml</filename>
+ file:
+ </para>
+ <para>
+ <screen><![CDATA[
<?xml version="1.0"?>
<!DOCTYPE faces-config PUBLIC
"-//Sun Microsystems, Inc.//DTD JavaServer Faces Config 1.0//EN"
@@ -1450,283 +2211,393 @@
</navigation-case>
</navigation-rule>
</faces-config>]]>
-</screen>
-</para>
- <para>
- Without the <filename>faces-config.xml</filename> file, the application would work the same outside of the portlet as it would inside a portlet container. In this example, a basic user bean, <computeroutput><managed-bean-name>user</managed-bean-name></computeroutput>, and a navigation rule are defined, which handle the submission of the original form in the <filename>HelloWorldJSFMyFaces42Portlet/WEB-INF/jsp/index.jsp</filename> file.
- </para>
-<para>
- The following is an example of the <computeroutput><context-parm></computeroutput> element from the <filename>HelloWorldJSFMyFaces42Portlet/WEB-INF/web.xml</filename> file:
-</para>
-<para>
-<screen><![CDATA[
+ </screen>
+ </para>
+ <para>
+ Without the
+ <filename>faces-config.xml</filename>
+ file, the application would work the same outside of the portlet as it
+ would inside a portlet container. In this example, a basic user bean,
+ <computeroutput>
+ <managed-bean-name>user</managed-bean-name>
+ </computeroutput>
+ , and a navigation rule are defined, which handle the submission of the
+ original form in the
+ <filename>HelloWorldJSFMyFaces42Portlet/WEB-INF/jsp/index.jsp</filename>
+ file.
+ </para>
+ <para>
+ The following is an example of the
+ <computeroutput><context-parm></computeroutput>
+ element from the
+ <filename>HelloWorldJSFMyFaces42Portlet/WEB-INF/web.xml</filename>
+ file:
+ </para>
+ <para>
+ <screen><![CDATA[
<context-param>
<param-name>org.jboss.jbossfaces.WAR_BUNDLES_JSF_IMPL</param-name>
<param-value>true</param-value>
</context-param>]]>
-</screen>
-</para>
-<para>
- These extra parameters let the application server know that the portlet embeds its own libraries. This avoids collision with the Sun JSF RI libraries bundled with JBoss AS and JBoss EAP. For more information, refer to the <ulink url="http://wiki.jboss.org/wiki/Wiki.jsp?page=JBossFaces">JBossFaces page on the JBoss Wiki</ulink>.
-</para>
-</sect3>
+ </screen>
+ </para>
+ <para>
+ These extra parameters let the application server know that the portlet
+ embeds its own libraries. This avoids collision with the Sun JSF RI
+ libraries bundled with JBoss AS and JBoss EAP. For more information, refer
+ to the
+ <ulink url="http://wiki.jboss.org/wiki/Wiki.jsp?page=JBossFaces">
+ JBossFaces page on the JBoss Wiki
+ </ulink>
+ .
+ </para>
+ </sect3>
<sect3>
<title>Building your Apache MyFaces JSF portlet</title>
- <para>
- The <filename>HelloWorldJSFMyFaces42Portlet.zip</filename> file contains a pre-compiled <filename>helloworldjsfmyfacesportlet.war</filename> file; however, to manually build the <filename>helloworldjsfmyfacesportlet.war</filename> file:
- </para>
- <para>
- <orderedlist>
- <listitem>
- <para>
- Change into the <filename>HelloWorldJSFMyFaces42Portlet/</filename> directory, and remove the existing <filename>helloworldjsfmyfacesportlet.war</filename> file.
- </para>
- </listitem>
- <listitem>
- <para>
- If required, edit the <filename>HelloWorldJSFMyFaces42Portlet/src/main/org/jboss/portlet/hello/bean/User.java</filename> file, and the application descriptors in the <filename>HelloWorldJSFMyFaces42Portlet/src/resources/helloworldjsfmyfacesportlet-war/WEB-INF/</filename> directory.
- </para>
- </listitem>
- <listitem>
- <para>
- Change into <filename>HelloWorldJSFMyFaces42Portlet/</filename> directory, and run the <command>ant deploy</command> command. On Linux, the output will be similar to the following:
- </para>
- <para>
- <mediaobject>
- <imageobject>
- <imagedata align="center" fileref="images/tutorials/jsf_portlet/myfaces_ant_deploy.png" valign="middle"/>
- </imageobject>
- </mediaobject>
- </para>
- </listitem>
- </orderedlist>
- </para>
- <para>
- Note: the directory names will be different for your system.
- </para>
- <para>
- Expanding the <filename>helloworldjsfmyfacesportlet.war</filename> file allows you to deploy the portlet as an expanded directory, which makes development easier. As well, it gives you access to the application descriptors, resource files, JSF, and JSP pages. To expand the <filename>helloworldjsfmyfacesportlet.war</filename> file:
- </para>
- <para>
- <orderedlist>
- <listitem>
- <para>
- If you do not have the <filename>HelloWorldJSFMyFaces42Portlet/helloworldjsfmyfacesportlet.war</filename> file, change into the <filename>HelloWorldJSFMyFaces42Portlet/</filename> directory, and run the <command>ant deploy</command> command. This creates the <filename>helloworldjsfmyfacesportlet.war</filename> file.
- </para>
- </listitem>
- <listitem>
- <para>
- To expand the WAR file, change into the <filename>HelloWorldJSFMyFaces42Portlet/</filename> directory, and run the <command>ant explode</command> command. On Linux, the output will be similar to the following:
- </para>
- <para>
- <mediaobject>
- <imageobject>
- <imagedata align="center" fileref="images/tutorials/jsf_portlet/myfaces_ant_explode.png" valign="middle"/>
- </imageobject>
- </mediaobject>
- </para>
- </listitem>
- </orderedlist>
- </para>
- <para>
- Note: the directory names will be different for your system.
- </para>
- <para>
- The expanded WAR file and the application descriptors are located in the <filename>HelloWorldJSFMyFaces42Portlet/output/lib/exploded/helloworldjsfmyfacesportlet.war/WEB-INF/</filename> directory.
- </para>
- </sect3>
- <sect3>
- <title>Deploying your Apache MyFaces JSF portlet</title>
- <para>
- If you did not expand the <filename>helloworldjsfmyfacesportlet.war</filename> file, copy the <filename>HelloWorldJSFMyFaces42Portlet/helloworldjsfmyfacesportlet.war</filename> file into the correct JBoss AS or JBoss EAP <filename>deploy/</filename> directory. If you expanded the <filename>helloworldjsfmyfacesportlet.war</filename> file, copy the <filename>HelloWorldJSFMyFaces42Portlet/output/lib/exploded/helloworldjsfmyfacesportlet.war/</filename> directory into the correct JBoss AS or JBoss EAP <filename>deploy/</filename> directory. For example, if you are using the <computeroutput>default</computeroutput> JBoss AS profile, copy the WAR file or the expanded directory into the <filename>$JBOSS_HOME/server/default/deploy/</filename> directory.
- </para>
- <para>
- Performing this step on a running instance of JBoss AS or JBoss EAP, and JBoss Portal, triggers a hot-deploy of the portlet.
- </para><para>
- To see the HelloWorldJSFMyFaces42Portlet, navigate to <ulink url="http://localhost:8080/portal/"></ulink>, or, if the default JBoss Portal page is already open, refresh the page. The HelloWorldJSFMyFaces42Portlet is added to the bottom of the default JBoss Portal page:
- </para>
- <para>
- <mediaobject>
- <imageobject>
- <imagedata align="center" fileref="images/tutorials/jsf_portlet/output.png" valign="middle"/>
- </imageobject>
- </mediaobject>
- </para>
- <para>
- To re-deploy the portlet, for example, if you have made changes to any of the application descriptors, touch the <filename>$JBOSS_HOME/server/<replaceable>configuration</replaceable>/deploy/helloworldjsfmyfacesportlet.war/WEB-INF/web.xml</filename> file. This only works if you copied the <filename>HelloWorldJSFMyFaces42Portlet/output/lib/exploded/helloworldjsfmyfacesportlet.war/</filename> directory into the JBoss AS or JBoss EAP <filename>deploy/</filename> directory. On Linux, run the following command to re-deploy the HelloWorldJSFMyFaces42Portlet:
- </para>
- <para>
-<screen>
-touch $JBOSS_HOME/server/<replaceable>configuration</replaceable>/deploy/helloworldjsfmyfacesportlet.war/WEB-INF/web.xml
-</screen>
- </para>
+ <para>
+ The
+ <filename>HelloWorldJSFMyFaces42Portlet.zip</filename>
+ file contains a pre-compiled
+ <filename>helloworldjsfmyfacesportlet.war</filename>
+ file; however, to manually build the
+ <filename>helloworldjsfmyfacesportlet.war</filename>
+ file:
+ </para>
+ <para>
+ <orderedlist>
+ <listitem>
+ <para>
+ Change into the
+ <filename>HelloWorldJSFMyFaces42Portlet/</filename>
+ directory, and remove the existing
+ <filename>helloworldjsfmyfacesportlet.war</filename>
+ file.
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+ If required, edit the
+ <filename>
+ HelloWorldJSFMyFaces42Portlet/src/main/org/jboss/portlet/hello/bean/User.java
+ </filename>
+ file, and the application descriptors in the
+ <filename>
+ HelloWorldJSFMyFaces42Portlet/src/resources/helloworldjsfmyfacesportlet-war/WEB-INF/
+ </filename>
+ directory.
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+ Change into
+ <filename>HelloWorldJSFMyFaces42Portlet/</filename>
+ directory, and run the
+ <command>ant deploy</command>
+ command. On Linux, the output will be similar to the following:
+ </para>
+ <para>
+ <mediaobject>
+ <imageobject>
+ <imagedata align="center"
+ fileref="images/tutorials/jsf_portlet/myfaces_ant_deploy.png"
+ valign="middle" />
+ </imageobject>
+ </mediaobject>
+ </para>
+ </listitem>
+ </orderedlist>
+ </para>
+ <para>Note: the directory names will be different for your system.</para>
+ <para>
+ Expanding the
+ <filename>helloworldjsfmyfacesportlet.war</filename>
+ file allows you to deploy the portlet as an expanded directory, which makes
+ development easier. As well, it gives you access to the application
+ descriptors, resource files, JSF, and JSP pages. To expand the
+ <filename>helloworldjsfmyfacesportlet.war</filename>
+ file:
+ </para>
+ <para>
+ <orderedlist>
+ <listitem>
+ <para>
+ If you do not have the
+ <filename>
+ HelloWorldJSFMyFaces42Portlet/helloworldjsfmyfacesportlet.war
+ </filename>
+ file, change into the
+ <filename>HelloWorldJSFMyFaces42Portlet/</filename>
+ directory, and run the
+ <command>ant deploy</command>
+ command. This creates the
+ <filename>helloworldjsfmyfacesportlet.war</filename>
+ file.
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+ To expand the WAR file, change into the
+ <filename>HelloWorldJSFMyFaces42Portlet/</filename>
+ directory, and run the
+ <command>ant explode</command>
+ command. On Linux, the output will be similar to the following:
+ </para>
+ <para>
+ <mediaobject>
+ <imageobject>
+ <imagedata align="center"
+ fileref="images/tutorials/jsf_portlet/myfaces_ant_explode.png"
+ valign="middle" />
+ </imageobject>
+ </mediaobject>
+ </para>
+ </listitem>
+ </orderedlist>
+ </para>
+ <para>Note: the directory names will be different for your system.</para>
+ <para>
+ The expanded WAR file and the application descriptors are located in the
+ <filename>
+ HelloWorldJSFMyFaces42Portlet/output/lib/exploded/helloworldjsfmyfacesportlet.war/WEB-INF/
+ </filename>
+ directory.
+ </para>
</sect3>
+ <sect3>
+ <title>Deploying your Apache MyFaces JSF portlet</title>
+ <para>
+ If you did not expand the
+ <filename>helloworldjsfmyfacesportlet.war</filename>
+ file, copy the
+ <filename>
+ HelloWorldJSFMyFaces42Portlet/helloworldjsfmyfacesportlet.war
+ </filename>
+ file into the correct JBoss AS or JBoss EAP
+ <filename>deploy/</filename>
+ directory. If you expanded the
+ <filename>helloworldjsfmyfacesportlet.war</filename>
+ file, copy the
+ <filename>
+ HelloWorldJSFMyFaces42Portlet/output/lib/exploded/helloworldjsfmyfacesportlet.war/
+ </filename>
+ directory into the correct JBoss AS or JBoss EAP
+ <filename>deploy/</filename>
+ directory. For example, if you are using the
+ <computeroutput>default</computeroutput>
+ JBoss AS profile, copy the WAR file or the expanded directory into the
+ <filename>$JBOSS_HOME/server/default/deploy/</filename>
+ directory.
+ </para>
+ <para>
+ Performing this step on a running instance of JBoss AS or JBoss EAP, and
+ JBoss Portal, triggers a hot-deploy of the portlet.
+ </para>
+ <para>
+ To see the HelloWorldJSFMyFaces42Portlet, navigate to
+ <ulink url="http://localhost:8080/portal/"></ulink>
+ , or, if the default JBoss Portal page is already open, refresh the page.
+ The HelloWorldJSFMyFaces42Portlet is added to the bottom of the default
+ JBoss Portal page:
+ </para>
+ <para>
+ <mediaobject>
+ <imageobject>
+ <imagedata align="center"
+ fileref="images/tutorials/jsf_portlet/output.png" valign="middle" />
+ </imageobject>
+ </mediaobject>
+ </para>
+ <para>
+ To re-deploy the portlet, for example, if you have made changes to any of
+ the application descriptors, touch the
+ <filename>
+ $JBOSS_HOME/server/
+ <replaceable>configuration</replaceable>
+ /deploy/helloworldjsfmyfacesportlet.war/WEB-INF/web.xml
+ </filename>
+ file. This only works if you copied the
+ <filename>
+ HelloWorldJSFMyFaces42Portlet/output/lib/exploded/helloworldjsfmyfacesportlet.war/
+ </filename>
+ directory into the JBoss AS or JBoss EAP
+ <filename>deploy/</filename>
+ directory. On Linux, run the following command to re-deploy the
+ HelloWorldJSFMyFaces42Portlet:
+ </para>
+ <para>
+ <screen>
+ touch $JBOSS_HOME/server/
+ <replaceable>configuration</replaceable>
+ /deploy/helloworldjsfmyfacesportlet.war/WEB-INF/web.xml
+ </screen>
+ </para>
+ </sect3>
</sect2>
<!-- sect2>
<title>Adapting MyFaces JSF Portlet to work on JBoss AS 4.2.x</title>
<para>We saw in <xref linkend="myfaces_40x"/> how to create a JSF-based portlet using Apache's MyFaces
- JSF implementation on JBoss Application Server 4.0.x. Starting with version 4.2.0 of JBoss Application
- Server, the default bundled JSF implementation is Sun's Reference Implementation (RI). We thus need to
- adapt our MyFaces portlet sightly so that it works in this new environment.
+ JSF implementation on JBoss Application Server 4.0.x. Starting with version 4.2.0 of JBoss Application
+ Server, the default bundled JSF implementation is Sun's Reference Implementation (RI). We thus need to
+ adapt our MyFaces portlet sightly so that it works in this new environment.
</para>
<para>The first step is to provide access to MyFaces as it's not bundled anymore in JBoss AS. This is
- accomplished by adding <literal>myfaces-api.jar</literal> and <literal>myfaces-impl.jar</literal> in
- our portlet <literal>WEB-INF/lib</literal> directory. This can be done automatically via a modification of
- the ant script and is left as an exercise to the reader.
+ accomplished by adding <literal>myfaces-api.jar</literal> and <literal>myfaces-impl.jar</literal> in
+ our portlet <literal>WEB-INF/lib</literal> directory. This can be done automatically via a modification of
+ the ant script and is left as an exercise to the reader.
</para>
<para>
- We also need to need to tell JBoss AS not to use its bundled JSF implementation for our portlet. This
- is accomplished by adding the following to our portlet's <literal>web.xml</literal>:
- <programlisting><![CDATA[<context-param>
- <param-name>org.jboss.jbossfaces.WAR_BUNDLES_JSF_IMPL</param-name>
- <param-value>true</param-value>
-</context-param>]]></programlisting>
- More details on this procedure can be found at <ulink
- url="http://wiki.jboss.org/wiki/Wiki.jsp?page=JBossFaces">http://wiki.jboss.org/wiki/Wiki.jsp?page=JBossFaces</ulink>.
+ We also need to need to tell JBoss AS not to use its bundled JSF implementation for our portlet. This
+ is accomplished by adding the following to our portlet's <literal>web.xml</literal>:
+ <programlisting><![CDATA[<context-param>
+ <param-name>org.jboss.jbossfaces.WAR_BUNDLES_JSF_IMPL</param-name>
+ <param-value>true</param-value>
+ </context-param>]]></programlisting>
+ More details on this procedure can be found at <ulink
+ url="http://wiki.jboss.org/wiki/Wiki.jsp?page=JBossFaces">http://wiki.jboss.org/wiki/Wiki.jsp?page=JBossFaces</ulink>.
</para>
<para>
- We should get the following package content for our portlet:
- <mediaobject>
- <imageobject>
- <imagedata align="center" fileref="images/tutorials/jsf_portlet/package_42x.png" valign="middle"/>
- </imageobject>
- </mediaobject>
+ We should get the following package content for our portlet:
+ <mediaobject>
+ <imageobject>
+ <imagedata align="center" fileref="images/tutorials/jsf_portlet/package_42x.png" valign="middle"/>
+ </imageobject>
+ </mediaobject>
</para>
- </sect2-->
+ </sect2-->
<!-- sect2 id="richfaces">
<title>Portal and RichFaces: A basic demonstration using Ajax4JSF and RichFaces components</title>
<sect3>
- <para>
- RichFaces is currently in technology preview mode and not fully supported in Jboss Portal.
- </para>
+ <para>
+ RichFaces is currently in technology preview mode and not fully supported in Jboss Portal.
+ </para>
</sect3>
<sect3>
- <title>Downloading The Binaries or Project Source</title>
- <para>
- You have 2 options for getting started.
- <-<para>
- For instructions on setting up Subversion and/or Maven 2 see <xref linkend="build_instructions"/>
- </para>->
- <itemizedlist>
- <listitem>
- <para>
- 1) Download the binary distribution in a zip file. This will
- include all the source files along with a deployable war file.
- <sbr/>
- <ulink url="http://anonsvn.jboss.org/repos/portletswap/portlets/2_6/bundles/RichFaces...">http://anonsvn.jboss.org/repos/portletswap/portlets/2_6/bundles/RichFaces...</ulink>.
- <sbr/>
- Once you extract the zip archive, the deployable war file is located in the target/ directory.
- </para>
- </listitem>
- <listitem>
- <para>
- 2) Use subversion to checkout the source code.
- If you plan on making changes to the source or possibly using it as a template for future development,
- it is recommended that you checkout the project and use maven to build the war.
- <sbr/>
- <ulink url="http://anonsvn.jboss.org/repos/portletswap/portlets/src/framework/RichFac...">http://anonsvn.jboss.org/repos/portletswap/portlets/src/framework/RichFac...</ulink>.
- </para>
- </listitem>
- </itemizedlist>
- </para>
+ <title>Downloading The Binaries or Project Source</title>
+ <para>
+ You have 2 options for getting started.
+ <-<para>
+ For instructions on setting up Subversion and/or Maven 2 see <xref linkend="build_instructions"/>
+ </para>->
+ <itemizedlist>
+ <listitem>
+ <para>
+ 1) Download the binary distribution in a zip file. This will
+ include all the source files along with a deployable war file.
+ <sbr/>
+ <ulink url="http://anonsvn.jboss.org/repos/portletswap/portlets/2_6/bundles/RichFaces...">http://anonsvn.jboss.org/repos/portletswap/portlets/2_6/bundles/RichFaces...</ulink>.
+ <sbr/>
+ Once you extract the zip archive, the deployable war file is located in the target/ directory.
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+ 2) Use subversion to checkout the source code.
+ If you plan on making changes to the source or possibly using it as a template for future development,
+ it is recommended that you checkout the project and use maven to build the war.
+ <sbr/>
+ <ulink url="http://anonsvn.jboss.org/repos/portletswap/portlets/src/framework/RichFac...">http://anonsvn.jboss.org/repos/portletswap/portlets/src/framework/RichFac...</ulink>.
+ </para>
+ </listitem>
+ </itemizedlist>
+ </para>
</sect3>
<sect3>
- <title>Project Configuration</title>
- <para>
- The following configurations must be made to use RichFaces in your portlet.
- </para>
- <para>
- Here we use javax.portlet.faces.GenericFacesPortlet which is part of the JSR-301 specification. We also
- must declare the view, edit, and help modes as shown below.
- <itemizedlist>
- <listitem>
- <literal>portlet.xml</literal>
-<programlisting>
- <![CDATA[<portlet-app version="1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://java.sun.com/xml/ns/portlet"
- xmlns="http://java.sun.com/xml/ns/portlet">
- <portlet>
- <portlet-name>ajaxPortlet</portlet-name>
- <portlet-class>
- javax.portlet.faces.GenericFacesPortlet
- </portlet-class>
-
- <init-param>
- <name>javax.portlet.faces.defaultViewId.view</name>
- <value>/jsf/start.xhtml</value>
- </init-param>
-
- <init-param>
- <name>javax.portlet.faces.defaultViewId.edit</name>
- <value>/jsf/edit.xhtml</value>
- </init-param>
-
- <init-param>
- <name>javax.portlet.faces.defaultViewId.help</name>
- <value>/jsf/help.xhtml</value>
- </init-param>
-
- <expiration-cache>-0</expiration-cache>
- <portlet-info>
- <title>Ajax Portlet</title>
- </portlet-info>
- <supports>
- <mime-type>text/html</mime-type>
- <portlet-mode>VIEW</portlet-mode>
- <portlet-mode>EDIT</portlet-mode>
- <portlet-mode>HELP</portlet-mode>
- </supports>
- </portlet>
+ <title>Project Configuration</title>
+ <para>
+ The following configurations must be made to use RichFaces in your portlet.
+ </para>
+ <para>
+ Here we use javax.portlet.faces.GenericFacesPortlet which is part of the JSR-301 specification. We also
+ must declare the view, edit, and help modes as shown below.
+ <itemizedlist>
+ <listitem>
+ <literal>portlet.xml</literal>
+ <programlisting>
+ <![CDATA[<portlet-app version="1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://java.sun.com/xml/ns/portlet"
+ xmlns="http://java.sun.com/xml/ns/portlet">
+ <portlet>
+ <portlet-name>ajaxPortlet</portlet-name>
+ <portlet-class>
+ javax.portlet.faces.GenericFacesPortlet
+ </portlet-class>
+
+ <init-param>
+ <name>javax.portlet.faces.defaultViewId.view</name>
+ <value>/jsf/start.xhtml</value>
+ </init-param>
+
+ <init-param>
+ <name>javax.portlet.faces.defaultViewId.edit</name>
+ <value>/jsf/edit.xhtml</value>
+ </init-param>
+
+ <init-param>
+ <name>javax.portlet.faces.defaultViewId.help</name>
+ <value>/jsf/help.xhtml</value>
+ </init-param>
+
+ <expiration-cache>-0</expiration-cache>
+ <portlet-info>
+ <title>Ajax Portlet</title>
+ </portlet-info>
+ <supports>
+ <mime-type>text/html</mime-type>
+ <portlet-mode>VIEW</portlet-mode>
+ <portlet-mode>EDIT</portlet-mode>
+ <portlet-mode>HELP</portlet-mode>
+ </supports>
+ </portlet>
</portlet-app>]]>
-</programlisting>
- </listitem>
- <listitem>
- <literal>faces-config.xml</literal>
-<programlisting>
- <![CDATA[...
+ </programlisting>
+ </listitem>
+ <listitem>
+ <literal>faces-config.xml</literal>
+ <programlisting>
+ <![CDATA[...
<application>
- <view-handler>
- org.ajax4jsf.portlet.application.PortletViewHandler
- </view-handler>
- <state-manager>
- org.ajax4jsf.portlet.application.PortalStateManager
- </state-manager>
+ <view-handler>
+ org.ajax4jsf.portlet.application.PortletViewHandler
+ </view-handler>
+ <state-manager>
+ org.ajax4jsf.portlet.application.PortalStateManager
+ </state-manager>
</application>
<factory>
- <faces-context-factory>
- org.ajax4jsf.portlet.context.FacesContextFactoryImpl
- </faces-context-factory>
+ <faces-context-factory>
+ org.ajax4jsf.portlet.context.FacesContextFactoryImpl
+ </faces-context-factory>
</factory>
...]]>
-</programlisting>
- </listitem>
- <listitem>
- <literal>web.xml</literal>
-<programlisting>
- <![CDATA[...
+ </programlisting>
+ </listitem>
+ <listitem>
+ <literal>web.xml</literal>
+ <programlisting>
+ <![CDATA[...
<context-param>
- <param-name>org.ajax4jsf.VIEW_HANDLERS</param-name>
- <param-value>org.ajax4jsf.portlet.application.FaceletPortletViewHandler</param-value>
+ <param-name>org.ajax4jsf.VIEW_HANDLERS</param-name>
+ <param-value>org.ajax4jsf.portlet.application.FaceletPortletViewHandler</param-value>
</context-param>
<filter>
- <display-name>Ajax4jsf Filter</display-name>
- <filter-name>ajax4jsf</filter-name>
- <filter-class>org.ajax4jsf.Filter</filter-class>
+ <display-name>Ajax4jsf Filter</display-name>
+ <filter-name>ajax4jsf</filter-name>
+ <filter-class>org.ajax4jsf.Filter</filter-class>
</filter>
-
+
<filter-mapping>
- <filter-name>ajax4jsf</filter-name>
- <servlet-name>FacesServlet</servlet-name>
- <dispatcher>FORWARD</dispatcher>
- <dispatcher>REQUEST</dispatcher>
- <dispatcher>INCLUDE</dispatcher>
+ <filter-name>ajax4jsf</filter-name>
+ <servlet-name>FacesServlet</servlet-name>
+ <dispatcher>FORWARD</dispatcher>
+ <dispatcher>REQUEST</dispatcher>
+ <dispatcher>INCLUDE</dispatcher>
</filter-mapping>
...]]>
-</programlisting>
- </listitem>
- </itemizedlist>
- </para>
+ </programlisting>
+ </listitem>
+ </itemizedlist>
+ </para>
</sect3>
- </sect2-->
+ </sect2-->
</sect1>
</chapter>
\ No newline at end of file
16 years, 3 months
JBoss Portal SVN: r11360 - in docs/branches/JBoss_Portal_Branch_2_7/referenceGuide/en/modules: extras and 1 other directory.
by portal-commits@lists.jboss.org
Author: mmcallis
Date: 2008-07-09 02:22:14 -0400 (Wed, 09 Jul 2008)
New Revision: 11360
Removed:
docs/branches/JBoss_Portal_Branch_2_7/referenceGuide/en/modules/extras/email_mbean.xmlt
Modified:
docs/branches/JBoss_Portal_Branch_2_7/referenceGuide/en/modules/configuration.xml
Log:
- removing .xmlt as it works without para tags (thanks Thomas)
Modified: docs/branches/JBoss_Portal_Branch_2_7/referenceGuide/en/modules/configuration.xml
===================================================================
--- docs/branches/JBoss_Portal_Branch_2_7/referenceGuide/en/modules/configuration.xml 2008-07-09 06:14:53 UTC (rev 11359)
+++ docs/branches/JBoss_Portal_Branch_2_7/referenceGuide/en/modules/configuration.xml 2008-07-09 06:22:14 UTC (rev 11360)
@@ -197,8 +197,7 @@
<para>
The email service is configured using the <filename>$JBOSS_HOME/server/default/deploy/jboss-portal.sar/META-INF/jboss-service.xml</filename> file. The following is an example of the section which is used to configure the email service:
</para>
-<programlisting role="XML"><xi:include href="extras/email_mbean.xmlt" parse="text" xmlns:xi="http://www.w3.org/2001/XInclude"></xi:include></programlisting>
-<!-- <programlisting><![CDATA[
+<programlisting role="XML"><![CDATA[
<mbean
code="org.jboss.portal.core.impl.mail.MailModuleImpl"
name="portal:service=Module,type=Mail"
@@ -216,7 +215,7 @@
<attribute name="SMTPTimeout">10000</attribute>
<attribute name="JNDIName">java:portal/MailModule</attribute>
</mbean>]]>
-</programlisting> -->
+</programlisting>
<para>
A different SMTP server (other than localhost) can be configured, along with a SMTP username and an SMTP password. The following is an example configuration that uses the Gmail SMTP server:
Deleted: docs/branches/JBoss_Portal_Branch_2_7/referenceGuide/en/modules/extras/email_mbean.xmlt
===================================================================
--- docs/branches/JBoss_Portal_Branch_2_7/referenceGuide/en/modules/extras/email_mbean.xmlt 2008-07-09 06:14:53 UTC (rev 11359)
+++ docs/branches/JBoss_Portal_Branch_2_7/referenceGuide/en/modules/extras/email_mbean.xmlt 2008-07-09 06:22:14 UTC (rev 11360)
@@ -1,17 +0,0 @@
-<mbean
-code="org.jboss.portal.core.impl.mail.MailModuleImpl"
-name="portal:service=Module,type=Mail"
-xmbean-dd=""
-xmbean-code="org.jboss.portal.jems.as.system.JBossServiceModelMBean">
-<xmbean/>
-<depends>jboss:service=Mail</depends>
-<depends>portal:service=Module,type=IdentityServiceController</depends>
-<attribute name="QueueCapacity">-1</attribute>
-<attribute name="Gateway">localhost</attribute>
-<attribute name="SmtpUser"></attribute>
-<attribute name="SmtpPassword"></attribute>
-<attribute name="JavaMailDebugEnabled">false</attribute>
-<attribute name="SMTPConnectionTimeout">100000</attribute>
-<attribute name="SMTPTimeout">10000</attribute>
-<attribute name="JNDIName">java:portal/MailModule</attribute>
-</mbean>
16 years, 3 months