myfaces-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Mario Ivankovits <ma...@ops.co.at>
Subject Re: [Orchestra] Orchestra and ajax
Date Wed, 27 Jun 2007 12:51:38 GMT
Hi Michael!
> But now I have a problem with orchestra when using partial submits (we use
> ICEFaces by the way).
> As there is no page refresh the request attribute CONVERSATION_CONTEXT_REQ
> is not set.
>   
I tried the following with the latest ICEFaces (1.6.0-DR5) and it works
as expected. Though, I have to admit I am wondering WHY it works as as
you stated Icefaces do not add the conversationContext= url parameter.
It looks like it somehow captures the request map and provides the same
map for the partial submit request (through the
CopyingRequestAttributesMap).

Could you explain a little bit in detail what exactly you try to do ...
or even  better ... could you provide some sort of war which shows the
problem - would be great.

What I tried was to have a simple conversation scope bean and a form
printing some conversation debugging stuff. If the output of the partial
submit matches with the output above we were able find our conversation
again.


THE JSPX:

<!--@elvariable id="icefacesTest"
type="org.apache.myfaces.orchestraTests.backings.IcefacesTest"-->
<f:view
        xmlns:f="http://java.sun.com/jsf/core"
        xmlns:t="http://myfaces.apache.org/tomahawk"
        xmlns:h="http://java.sun.com/jsf/html"
        xmlns:ice="http://www.icesoft.com/icefaces/component">
    <t:document>
        <t:documentHead>

        </t:documentHead>

        <t:documentBody>
            <ice:outputConnectionStatus
                activeLabel="active"
                disconnectedLabel="disconnected"
                inactiveLabel="inactive"
                cautionLabel="caution"/>

            <ice:outputText value="just an icefaces test" />

            <ice:panelGrid
                    columns="2">
                <f:facet name="header">
                    <ice:outputText value="current conversation state -
you should see the same after clicking the button" />
                </f:facet>
                <ice:outputText value="context id:" />
                <ice:outputText
value="#{icefacesTest.currentConversationContextId}" />

                <ice:outputText value="conversation id:" />
                <ice:outputText
value="#{icefacesTest.currentConversationIdentifier}" />
            </ice:panelGrid>

            <ice:form>

                <ice:panelGrid
                        columns="2">
                    <f:facet name="header">
                        <ice:outputText value="check values" />
                    </f:facet>
                    <ice:outputText value="request count:" />
                    <ice:outputText value="#{icefacesTest.requestCount}" />

                    <ice:outputText value="current time::" />
                    <ice:outputText value="#{icefacesTest.currentTime}">
                        <f:convertDateTime type="both"
dateStyle="medium" timeStyle="long" />
                    </ice:outputText>

                    <ice:outputText value="context id:" />
                    <ice:outputText
value="#{icefacesTest.currentConversationContextId}" />

                    <ice:outputText value="conversation id:" />
                    <ice:outputText
value="#{icefacesTest.currentConversationIdentifier}" />
                </ice:panelGrid>

                <ice:commandButton value="partial refresh"
                    partialSubmit="true"/>
            </ice:form>

        </t:documentBody>
    </t:document>
</f:view>


THE BEAN:

package org.apache.myfaces.orchestraTests.backings;

import org.apache.myfaces.orchestra.conversation.Conversation;
import org.apache.myfaces.orchestra.conversation.ConversationManager;

import java.util.Date;

public class IcefacesTest
{
    private int requestCount = 0;

    public Long getCurrentConversationContextId()
    {
        return ConversationManager.getInstance().getConversationContextId();
    }

    public int getCurrentConversationIdentifier()
    {
        Conversation conv = Conversation.getCurrentInstance();
        if (conv == null)
        {
            return -1;
        }

        return System.identityHashCode(conv);
    }

    public int getRequestCount()
    {
        return requestCount++;
    }

    public Date getCurrentTime()
    {
        return new Date();
    }
}

THE MANAGED-BEAN CONFIG IN SPRING:
    <bean
        name="icefacesTest"
        class="org.apache.myfaces.orchestraTests.backings.IcefacesTest"
        scope="conversation" />


Ciao,
Mario


Mime
View raw message