[JBoss Seam] - Re: Using Seam for porlet communication
by jarkko@jab.fi
This allows intra/inter portlet to portlet communication inside Seam. Basically everything that goes to Session scope is also put to both PORTLET_SCOPE(portlet private, only the portlet putting has access to it) and APPLICATION_SCOPE (portal wide, every portlet inside portal sees it). A more elegant/resource wise solution might be better, but it is not actually trivial without adding new configuration options.
/*
| * JBoss, Home of Professional Open Source
| *
| * Distributable under LGPL license.
| * See terms of license at gnu.org.
| */
| package org.jboss.seam.portlet;
|
| import java.util.Collections;
| import java.util.Enumeration;
| import java.util.List;
|
| import javax.portlet.PortletSession;
|
| import org.apache.commons.collections.ListUtils;
| import org.jboss.seam.contexts.ContextAdaptor;
|
| /**
| * @author <a href="mailto:theute@jboss.org">Thomas Heute </a>
| * @version $Revision: 1.4 $
| */
| public class PortletSessionImpl extends ContextAdaptor {
|
| private PortletSession session;
|
| public PortletSessionImpl(PortletSession session) {
| this.session = session;
| }
|
| public Object getAttribute(String key) {
| // search for key first in PORTLET_SCOPE
| Object o = session.getAttribute(key);
| Object po = null;
| // if nothing is found there try APPLICATION_SCOPE
| if (o == null) {
| po = session.getAttribute(key, PortletSession.APPLICATION_SCOPE);
| return po;
| } else {
| // TODO: just do some cleaning up or maybe not
| // session.removeAttribute(key, PortletSession.APPLICATION_SCOPE);
| }
|
| return o;
| }
|
| public void removeAttribute(String key) {
| session.removeAttribute(key);
| session.removeAttribute(key, PortletSession.APPLICATION_SCOPE);
| }
|
| public Enumeration getAttributeNames() {
| Enumeration portletAttributeNamesEnum = session.getAttributeNames();
| Enumeration portalAttributeNamesEnum = session
| .getAttributeNames(PortletSession.APPLICATION_SCOPE);
|
| List portletAttributeNames = Collections
| .list(portletAttributeNamesEnum);
| List portalAttributeNames = Collections.list(portalAttributeNamesEnum);
|
| // TODO: Is this correct?
| List allNames = ListUtils.sum(portalAttributeNames,
| portalAttributeNames);
|
| return Collections.enumeration(allNames);
| }
|
| public void setAttribute(String key, Object value) {
| session.setAttribute(key, value);
| session.setAttribute(key, value, PortletSession.APPLICATION_SCOPE);
| }
|
| public void invalidate() {
| session.invalidate();
| }
|
| }
|
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3973176#3973176
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3973176
19 years, 7 months
[JBoss Seam] - Re: Seam + AJAX: Remote problem
by sherkan777
"sherkan777" wrote : Hello,
| I have problem with example HelloWorld method...
| I've implemented those example in my project, on my index.xhtml page it works fine, but when i try to use it or some other AJAX functions on pages in my /pages/ folder (/pages/Person.xhtml) AJAX it could't work..
|
| My Firefox browser throws me an error: "Seam is not defined"
| at line: Seam.Component.getInstance("helloAction").sayHello(name, sayHelloCallback);
|
| Can anyone tell me why this works on my main page, and could't in other pages?
| I have acces to those pages after I log in to my web page, and when User is looged In i start LongRunningConversation (id=2).
|
| I have implemented all same as in Seam documentation.
|
|
| anonymous wrote :
| |
| |
| |
|
| anonymous wrote :
| | function sayHello() {
| | var name = prompt("What is your name?");
| | Seam.Component.getInstance("userAction").sayHello(name, sayHelloCallback);
| | }
| |
| | function sayHelloCallback(result) {
| | alert(result);
| | }
| |
| |
| etc.
|
| Regards!
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3973167#3973167
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3973167
19 years, 7 months
[JBoss Seam] - Seam + AJAX: Remote problem
by sherkan777
Hello,
I have problem with example HelloWorld method...
I've implemented those example in my project, on my index.xhtml page it works fine, but when i try to use it or some other AJAX functions on pages in my /pages/ folder (/pages/Person.xhtml) AJAX it could't work..
My Firefox browser throws me an error: "Seam is not defined"
at line: Seam.Component.getInstance("helloAction").sayHello(name, sayHelloCallback);
Can anyone tell me why this works on my main page, and could't in other pages?
I have acces to those pages after I log in to my web page, and when User is looged In i start LongRunningConversation (id=2).
I have implemented all same as in Seam documentation.
anonymous wrote :
|
|
|
anonymous wrote :
| function sayHello() {
| var name = prompt("What is your name?");
| Seam.Component.getInstance("userAction").sayHello(name, sayHelloCallback);
| }
|
| function sayHelloCallback(result) {
| alert(result);
| }
|
|
etc.
Regards!
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3973166#3973166
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3973166
19 years, 7 months