-
1. Re: Response not of type StateAwareRepsonse
wesleyhales Dec 4, 2009 2:09 PM (in response to gamba)First, you can only set a portlet event on an ActionResponse or EventResponse. The BufferedResourceResponseWrapper gives you a ResourceResponse since this is an ajax request. So, you cannot set an event here.
You will need to change your commandLink or button from being ajaxified to a regular form submit. -
2. Re: Response not of type StateAwareRepsonse
gamba Dec 7, 2009 3:03 AM (in response to gamba)Ok. When I don't use my own portlet-class and use h:command button the class to set the event on is a JBossActionResponse-Object.
Is ajax-response supported in further versions of the bridge? In my case I want to start a scan process and after that the documents should be rendered in another portlet. The process is wrapped by a process bar and runs in an own thread. Thought it could be done by ajax...
Nevertheless, now I'm able to set the event on JBossActionResponse ... but handleEvent in my own BridgeEventHandle is never called ...
I set it as init-param in the sending portlet-config-section ...
and I don't know can I receive the event in another managed bean?
Thx
Gamba -
3. Re: Response not of type StateAwareRepsonse
gamba Dec 7, 2009 8:41 AM (in response to gamba)I have to add some information. Target is the same as above. Scan-Process is started in Portlet A, with a h:commandButton => progressBar is enabled and a server-thread is started in Portlet A for scanning.
After scanning is complete I want to update Portlet B with the scanned files. Following problems occurs for me, when using different technics to achieve this (a4:poll, a4j:push, portlet-events, jsr-168 portlet-application-scope-params, application-scoped-bean):
- With polling I'm able start the polling because starting scanning is an actionResponse. But stopping polling could not be handled. I can not get the facesContext when the server threads ends so I cannot set another application-scope-param (e.g. "false" for scanning). In addition I cannot set a property in my managed-bean, only in application-scope, because session or request-scoped-beans are not reached from portlet B.
- With pushing technic I get an error, that I'm not able to use the HEAD-method in my requests, when sending an new event
So, I don't know how to solve this problem ... maybe one way is to refrefh my portlets on my own. Is it possible to send an render-response after completing ajax-polling or is it generally possible to do that from my own code?
I'm not able to find a suitable solution so far ....
Any help would be appreciated,
Gamba -
4. Re: Response not of type StateAwareRepsonse
wesleyhales Dec 16, 2009 7:23 PM (in response to gamba)Can you post your entire portlet.xml? -
5. Re: Response not of type StateAwareRepsonse
gamba Dec 17, 2009 3:00 AM (in response to wesleyhales)I'm not able to post my code or something which I copied from portlet.xml ....
ERROR: Sie können keine leere Nachricht posten. Geben Sie Ihre Nachricht ein und wiederholen Sie den Vorgang.
-
6. Re: Response not of type StateAwareRepsonse
gamba Dec 17, 2009 3:23 AM (in response to gamba)Sure ... could you please have o look at my newest post in this thread. What possibilities do I have?
My last workaround, when it would not possible to send params during ajax-request with portlet 2.0, is using
an standard POJO out of jsf-lifecycle. It has to store per user some variables or documents ... but I'm not very
delighted about that approach ...
ok, here is my portlet.xml for sending portlet events or public-render-params:
<?xml version="1.0" encoding="utf-8"?>
<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.xsdhttp://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd"
version="2.0"><!-- Portlet A -->
<portlet>
<portlet-name>PA_MenueTab</portlet-name>
<portlet-class>javax.portlet.faces.GenericFacesPortlet</portlet-class>
<init-param>
<name>javax.portlet.faces.defaultViewId.view</name>
<value>/pages/menuTabLayout.xhtml</value>
</init-param>
<init-param>
<name>javax.portlet.faces.preserveActionParams</name>
<value>true</value>
</init-param>
<init-param>
<name>javax.portlet.faces.autoDispatchEvents</name>
<value>true</value>
</init-param>
<init-param>
<name>javax.portlet.faces.bridgeEventHandler</name>
<value>de.handelshof.pis.web.portlets.ScanInProgressEventHandler</value>
</init-param>
<expiration-cache>-0</expiration-cache>
<supports>
<mime-type>text/html</mime-type>
<portlet-mode>VIEW</portlet-mode>
<!-- portlet-mode>HELP</portlet-mode-->
</supports>
<portlet-info>
<title>PA_MenueTab</title>
</portlet-info>
<supported-publishing-event>
<qname xmlns:hmg="urn:hmg:event:scanningEvent">hmg:ScanningEvent</qname>
</supported-publishing-event>
<supported-public-render-parameter>scannerStarted</supported-public-render-parameter>
</portlet>
<!-- Portlet B -->
<portlet>
<portlet-name>PA_PDF-Ansicht</portlet-name>
<portlet-class>javax.portlet.faces.GenericFacesPortlet</portlet-class>
<init-param>
<name>javax.portlet.faces.defaultViewId.view</name>
<value>/pages/renderPDF.xhtml</value>
</init-param>
<init-param>
<name>javax.portlet.faces.preserveActionParams</name>
<value>true</value>
</init-param>
<init-param>
<name>javax.portlet.faces.autoDispatchEvents</name>
<value>true</value>
</init-param>
<init-param>
<name>javax.portlet.faces.bridgeEventHandler</name>
<value>de.handelshof.pis.web.portlets.ScanInProgressEventHandler</value>
</init-param>
<supports>
<mime-type>text/html</mime-type>
<portlet-mode>VIEW</portlet-mode>
</supports>
<portlet-info>
<title>PA_PDF-Ansicht</title>
</portlet-info>
<supported-processing-event>
<qname xmlns:hmg="urn:hmg:event:scanningEvent">hmg:ScanningEvent</qname>
</supported-processing-event>
<supported-public-render-parameter>scannerStarted</supported-public-render-parameter>
</portlet><!-- Portlet-Filter definieren -->
<filter>
<filter-name>JBoss Portlet Filter</filter-name>
<filter-class>org.jboss.portlet.filter.JBossPortletFilter</filter-class>
<lifecycle>ACTION_PHASE</lifecycle>
<lifecycle>RENDER_PHASE</lifecycle>
</filter>
<filter-mapping>
<filter-name>JBoss Portlet Filter</filter-name>
<portlet-name>PA_MenueTab</portlet-name>
<portlet-name>PA_PDF-Ansicht</portlet-name>
</filter-mapping>
</portlet-app>Thx,
Gamba
BTW: How to use code-tags, with code-tags it is not possible for me to save the post ... because an error occurs that the post would be empty???
-
7. Re: Response not of type StateAwareRepsonse
wesleyhales Dec 17, 2009 9:08 PM (in response to gamba)Gamba wrote:
Nevertheless, now I'm able to set the event on JBossActionResponse ... but handleEvent in my own BridgeEventHandle is never called ...
I set it as init-param in the sending portlet-config-section ...
and I don't know can I receive the event in another managed bean?You need to define an event definition in your portlet.xml like:
<event-definition> <qname xmlns:jbp="urn:jboss:portal:samples:event">jbp:BookingEvent</qname> <value-type>org.jboss.seam.example.booking.BookingEvent</value-type> </event-definition>
And what are you using as your payload in your event?
To answer your other problem with the ajax call and creating some kind of event, I am not quite sure. Can you post the code that is closest to working?
btw, to paste code use the "Syntax Highlighting" option in the editor menu.
-
8. Re: Response not of type StateAwareRepsonse
gamba Dec 21, 2009 2:51 AM (in response to wesleyhales)Sorry, forgot this part in portlet.xml
<event-definition> <qname xmlns:hmg="urn:hmg:event:scanningEvent">hmg:ScanningEvent</qname> <value-type>java.lang.String</value-type> </event-definition>