I am seeking clarification on the role of the <url-pattern> specification in the <servlet-mapping> descriptor for the Push Servlet, and the relationship, if any, between the url-pattern and the names of channels used in eventBus publishing. I have built a proof-of-concept PF Push example that works fine, and, following examples seen elsewhere, used the following <servlet-mapping> descriptor for the Push Servlet:
Code: Select all
<servlet-mapping>
<servlet-name>Push Servlet</servlet-name>
<url-pattern>/primepush/*</url-pattern>
</servlet-mapping>
In my application code I publish Push messages using the following kind of call:
Code: Select all
EventBus eventBus = EventBusFactory.getDefault().eventBus();
eventBus.publish("/clock", clock_val);
and the receiving xhtml page specifies the same "/clock" channel:
Code: Select all
<p:socket onMessage="handleMessage" channel="/clock" />
This all works fine. What I don't understand is the role, if any, of the "/primepush/*" url-pattern. It seems like I could specify any pattern here, and it would have no impact on the functioning of my small proof-of-concept app, where I am just pushing short String messages to a web page from a background thread to get asynchronous updates. In what situations does the url-pattern matter?