1 2 Previous Next 20 Replies Latest reply: May 9, 2012 2:14 PM by Ken Finnigan Go to original post RSS
  • 15. Re: Seam Messages
    Andre Pankraz Newbie

    Concerning the captcha problem...seems like the SeamResourceServlet, which delivers the captcha image doesn't get the same session data (the Captcha component) like the previous portlet render phase.
    (but StandardSession session-id is the same!)

    The Seam Component Captcha is session bound and creates the question and expected answer in the init phase.

    @Name("org.jboss.seam.captcha.captcha")
    @Scope(ScopeType.SESSION)
    @Install(precedence=Install.BUILT_IN)
    @BypassInterceptors
    public class Captcha implements Serializable


    the request queryString:
    windowstate=normal&resourcestate=JBPNS_&type=portlet&resourceid=%2Fseam%2Fresource%2Fcaptcha&resourcecacheability=PAGE&phase=resource&windowid=%2Fsimple-portal%2Fdemo%2Fjsr-301.jsp%2F2&mode=view


    session: org.gatein.pc.portlet.impl.jsr168.DispatchedHttpSession@17a189b

    (ok test was with gatein, but jboss portal doesn't work too)


    Do i need this ScopeType PORTLET_SCOPE(PortletSession.PORTLET_SCOPE), here?
    Have not fully understand, what this should do.

  • 16. Re: Seam Messages
    Andre Pankraz Newbie

    ok this does help:

    package de.init.bakoev.ifos.app.util;
    
    import org.jboss.portletbridge.seam.PortletScope;
    import org.jboss.portletbridge.seam.PortletScope.ScopeType;
    import org.jboss.seam.Component;
    import org.jboss.seam.annotations.Name;
    import org.jboss.seam.captcha.Captcha;
    import org.jboss.seam.contexts.Contexts;
    
    @Name("org.jboss.seam.captcha.captcha")
    @PortletScope(ScopeType.APPLICATION_SCOPE)
    public class PortletCaptcha extends Captcha {
    
     public static Captcha instance() {
     if (!Contexts.isSessionContextActive()) {
     throw new IllegalStateException("No session context active");
     }
     return (Captcha) Component.getInstance(Captcha.class);
     }
    
    }
    



    I think you have another problem here.
    This souldn't be necessary! If a portlet renders a seam ressource link (h:graphicImage here), this link should work in the context of the same portlet session for a transparent usage.

    my solution is really only a workaround...



    so we have two problems remaining, no seam filters and seam ressource links live not in the same portlet session like the link rendering portlet.

  • 17. Re: Seam Messages
    Andre Pankraz Newbie

    i hate to say it...another problem :(((
    who is working with the bridge in production? really beta? sry...frustrated like hell.

    @In
    private FacesMessages facesMessages;

    this.facesMessages.addToControl("verifyPassword",
    StatusMessage.Severity.ERROR, "TEST");

    doesn't work.

    The messages are allways global and not component bound. Reason:

    The Seam Faces messages are translated to JSF Messages her:
    In FacesMessages:

     public void beforeRenderResponse()
     {
     for (StatusMessage statusMessage: getMessages())
     {
     FacesContext.getCurrentInstance().addMessage( null, toFacesMessage(statusMessage) );
     }
     for ( Map.Entry<String, List<StatusMessage>> entry: getKeyedMessages().entrySet() )
     {
     for ( StatusMessage statusMessage: entry.getValue() )
     {
     String clientId = getClientId(entry.getKey());
     FacesContext.getCurrentInstance().addMessage( clientId, toFacesMessage(statusMessage) );
     }
     }
     clear();
     }
    


    The important function:

    private static String getClientId(UIComponent component, String id, FacesContext facesContext)
     {
     String componentId = component.getId();
     if (componentId!=null && componentId.equals(id))
     {
     return component.getClientId(facesContext);
     }
     else
     {
     Iterator iter = component.getFacetsAndChildren();
     while ( iter.hasNext() )
     {
     UIComponent child = (UIComponent) iter.next();
     String clientId = getClientId(child, id, facesContext);
     if (clientId!=null) return clientId;
     }
     return null;
     }
     }
    


    Component is "org.jboss.portletbridge.component.UIPortletAjaxViewRoot@13caa69"

    This doesn't have facets / children, so returns allways null and cannot calculate the proper clientId.

    FacesContext.getCurrentInstance().addMessage( ) with null id creates a global message.


    What i want to get is e.g.:

    FacesContext.getCurrentInstance().addMessage(
    "_G2:_viewRoot:account:verifyPasswordField:verifyPassword",
    new FacesMessage(FacesMessage.SEVERITY_ERROR, "Test", "Test"));


    My "workaround"...static client strings....hmpf

  • 18. Re: Seam Messages
    Wesley Hales Master

    Andre - Thanks again for your troubleshooting. Most of these problems have been fixed in the current trunk, or they are being worked on.

    Please file Jiras for anything that is not working properly. And yes, we are in beta so this stuff is to be expected ;) We should have a production ready version very soon.

  • 19. Re: Seam Messages
    - Pablo - Newbie

    Hi,

    i 'm using porletbridge 2.3.0, gatein 3.2, jsf 1.2, seam 2.2.2

     

    i'm only getting global messages, not component bound, as Andre said,

     

    i' m doing something wrong or the portletbridge version i'm using still has the bug?

     

    is portletbridge version 3.0beta2 fixed?

     

    someone knows a work around for this?

     

    thanks in advance

  • 20. Re: Seam Messages
    Ken Finnigan Master

    Pablo,

     

    Please raise a JIRA if you're experiencing this problem and we will look into it.

     

    If you have a small sample war that can replicate the problem it would be appreciated if you could attach it to the JIRA.

     

    Thanks

    Ken

1 2 Previous Next