Details

    • Type: New Feature New Feature
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 4.0
    • Component/s: MOBI-Components
    • Labels:
      None
    • Environment:
      ICEfaces, BridgeIt
    • Assignee Priority:
      P1
    • Affects:
      Documentation (User Guide, Ref. Guide, etc.), Sample App./Tutorial

      Description

      The geotrack component allows geotracking to be initiated through the bridgeit.js api.

        Activity

        Ted Goddard created issue -
        Ken Fyten made changes -
        Field Original Value New Value
        Summary Geotrack component New mobi:geotrack component
        Fix Version/s 4.0 [ 10770 ]
        Affects Version/s 4.0 [ 10770 ]
        Affects Documentation (User Guide, Ref. Guide, etc.),Sample App./Tutorial [ 10003, 10001 ]
        Hide
        Ted Goddard added a comment -

        <mobi:geotrack strategy="significant|continuous" />

        This component will also require a ResourceHandler to accept the location updates in geoJSON format. These are uploaded outside the JSF lifecycle, so a mechanism for propagating these into the application beans will need to be determined.

        Show
        Ted Goddard added a comment - <mobi:geotrack strategy="significant|continuous" /> This component will also require a ResourceHandler to accept the location updates in geoJSON format. These are uploaded outside the JSF lifecycle, so a mechanism for propagating these into the application beans will need to be determined.
        Ken Fyten made changes -
        Assignee Arturo Zambrano [ artzambrano ]
        Fix Version/s 4.0 [ 11382 ]
        Fix Version/s 4.0.BETA [ 10770 ]
        Ken Fyten made changes -
        Assignee Priority P1 [ 10010 ]
        Hide
        Arturo Zambrano added a comment -

        There are a couple of challenges in making this component work as described above.

        The first problem is that at the moment it's not possible to read the body of the request sent by bridgeit to the auxiliary resource.

        So far, this component renders a button that calls the geoTrack bridgeit function when clicked. This works as expected, like other bridgeit components. After clicking the button, bridgeit launches and begins to send geotracking data to the postURL. While it has been verified that this works as expected, there's no way to read the body of this request that contains the geotracking information.

        Specifically, the problem is that JSF doesn't provide a way to read the body of this request. When retrieving the request parameter map from the ResourceHandler for this auxiliary resource, the parameter map contains no entries. The request sent to the server by bridgeit is of content type 'application/json', as can be seen by calling externalContext.getRequestContentType(). I suppose that since this is not of type 'application/x-www-form-urlencoded', JSF doesn't bother in parsing the body of the request. Since the request is neither of type 'multipart/form-data', no Part objects can be retrieved from it. If we get the actual HttpServletRequest object (by calling externalContext.geyRequest()), and if on it we invoke getInputStream() (which contains the body of the request), we actually get nothing, no bytes, because the input stream can only be read once, and JSF already did that, without saving the contents of the body anywhere.

        So, we would need to either create a special servlet or a filter just for this use case to obtain the body content of this request done by bridgeit of type 'application/json', with geotracking data. Alternatively, we could instead modify bridgeit to make this request of type 'multipart/form-data' or 'application/x-www-form-urlencoded', so that it could be processed by JSF and the data be available at the moment the ResourceHandler is invoked. We could also make this an option in the bridgeit call.

        Assuming that we make this work somehow, the other challenge would be to evaluate an EL expression from the ResourceHandler. This EL expression would correspond to the EL expression specified in the component to write the geotracking data to directly. Since this is done outside of the regular JSF lifecycle, we would write this data directly to the bean property corresponding to this EL expression. Beans in this case could only be session- or application- scoped. The approach I have in mind is to create a custom implementation of Resource that recieves some sort of callback object with the EL expression to evaluate. Then, this resource is registered via ResourceRegistry, so that a random name is generated. This would become the postURL for bridgeit. So that when this resource is accessed, the geotracking data from the bridgeit request is extracted in the ResourceHandler and then the EL expression associated with this resource is evaluated and the geotracking data is written to this bean property.

        Show
        Arturo Zambrano added a comment - There are a couple of challenges in making this component work as described above. The first problem is that at the moment it's not possible to read the body of the request sent by bridgeit to the auxiliary resource. So far, this component renders a button that calls the geoTrack bridgeit function when clicked. This works as expected, like other bridgeit components. After clicking the button, bridgeit launches and begins to send geotracking data to the postURL. While it has been verified that this works as expected, there's no way to read the body of this request that contains the geotracking information. Specifically, the problem is that JSF doesn't provide a way to read the body of this request. When retrieving the request parameter map from the ResourceHandler for this auxiliary resource, the parameter map contains no entries. The request sent to the server by bridgeit is of content type 'application/json', as can be seen by calling externalContext.getRequestContentType(). I suppose that since this is not of type 'application/x-www-form-urlencoded', JSF doesn't bother in parsing the body of the request. Since the request is neither of type 'multipart/form-data', no Part objects can be retrieved from it. If we get the actual HttpServletRequest object (by calling externalContext.geyRequest()), and if on it we invoke getInputStream() (which contains the body of the request), we actually get nothing, no bytes, because the input stream can only be read once, and JSF already did that, without saving the contents of the body anywhere. So, we would need to either create a special servlet or a filter just for this use case to obtain the body content of this request done by bridgeit of type 'application/json', with geotracking data. Alternatively, we could instead modify bridgeit to make this request of type 'multipart/form-data' or 'application/x-www-form-urlencoded', so that it could be processed by JSF and the data be available at the moment the ResourceHandler is invoked. We could also make this an option in the bridgeit call. Assuming that we make this work somehow, the other challenge would be to evaluate an EL expression from the ResourceHandler. This EL expression would correspond to the EL expression specified in the component to write the geotracking data to directly. Since this is done outside of the regular JSF lifecycle, we would write this data directly to the bean property corresponding to this EL expression. Beans in this case could only be session- or application- scoped. The approach I have in mind is to create a custom implementation of Resource that recieves some sort of callback object with the EL expression to evaluate. Then, this resource is registered via ResourceRegistry, so that a random name is generated. This would become the postURL for bridgeit. So that when this resource is accessed, the geotracking data from the bridgeit request is extracted in the ResourceHandler and then the EL expression associated with this resource is evaluated and the geotracking data is written to this bean property.
        Hide
        Ted Goddard added a comment -

        The request body can be read as long as this is done before request.getParts() is invoked. So, a GeoTrackingResourceHandler should be created that makes use of its own

        tokenResource = createResource("geotracking.txt");

        and invokes

        request.getInputStream()

        rather than

        request.getParts();

        Rather than a custom URL for the upload (which makes resource registration difficult) it is better to include an identifier with the geotrack POST. For instance, an arbitrary value can be included as long as its name starts with "_" (as is the case with the _jguid).

        Show
        Ted Goddard added a comment - The request body can be read as long as this is done before request.getParts() is invoked. So, a GeoTrackingResourceHandler should be created that makes use of its own tokenResource = createResource("geotracking.txt"); and invokes request.getInputStream() rather than request.getParts(); Rather than a custom URL for the upload (which makes resource registration difficult) it is better to include an identifier with the geotrack POST. For instance, an arbitrary value can be included as long as its name starts with "_" (as is the case with the _jguid).
        Hide
        Ken Fyten added a comment -

        mobi:geotrack should also support the optional "fallback" facet that will be rendered by the component if the BridgeIt app. cannot be used, either due to running on an unsupported platform (such as desktop OS), or the BridgeIt app. not being installed on the device.

        Show
        Ken Fyten added a comment - mobi:geotrack should also support the optional "fallback" facet that will be rendered by the component if the BridgeIt app. cannot be used, either due to running on an unsupported platform (such as desktop OS), or the BridgeIt app. not being installed on the device.
        Ken Fyten made changes -
        Summary New mobi:geotrack component New mobi:geoTrack component
        Repository Revision Date User Message
        ICEsoft Public SVN Repository #41614 Wed Jul 09 15:12:07 MDT 2014 art.zambrano ICE-9780 added mobi:geotrack component
        Files Changed
        Commit graph ADD /icefaces4/trunk/icefaces/mobi/component/src/org/icefaces/mobi/component/geotrack/Geotrack.java
        Commit graph ADD /icefaces4/trunk/icefaces/mobi/component/resources/org.icefaces.component.geotrack
        Commit graph ADD /icefaces4/trunk/icefaces/mobi/component/src/org/icefaces/mobi/component/geotrack/GeotrackRenderer.java
        Commit graph ADD /icefaces4/trunk/icefaces/mobi/component/src/org/icefaces/mobi/component/geotrack/GeotrackMeta.java
        Commit graph ADD /icefaces4/trunk/icefaces/mobi/component/src/org/icefaces/mobi/component/geotrack/GeotrackResourceHandler.java
        Commit graph ADD /icefaces4/trunk/icefaces/mobi/component/src/org/icefaces/mobi/component/geotrack
        Commit graph ADD /icefaces4/trunk/icefaces/mobi/component/resources/org.icefaces.component.geotrack/geotrack.txt
        Commit graph MODIFY /icefaces4/trunk/icefaces/mobi/component/resources/icefaces.mobi/META-INCLUDE/faces-config.xml
        Repository Revision Date User Message
        ICEsoft Public SVN Repository #41615 Wed Jul 09 15:27:11 MDT 2014 art.zambrano ICE-9780 changing mobi:geoTrack component capitalization 1/2
        Files Changed
        Commit graph DEL /icefaces4/trunk/icefaces/mobi/component/src/org/icefaces/mobi/component/geotrack/Geotrack.java
        Commit graph DEL /icefaces4/trunk/icefaces/mobi/component/src/org/icefaces/mobi/component/geotrack/GeotrackRenderer.java
        Commit graph DEL /icefaces4/trunk/icefaces/mobi/component/src/org/icefaces/mobi/component/geotrack/GeotrackMeta.java
        Commit graph DEL /icefaces4/trunk/icefaces/mobi/component/src/org/icefaces/mobi/component/geotrack/GeotrackResourceHandler.java
        Repository Revision Date User Message
        ICEsoft Public SVN Repository #41616 Wed Jul 09 15:29:26 MDT 2014 art.zambrano ICE-9780 changing mobi:geoTrack component capitalization 2/2
        Files Changed
        Commit graph ADD /icefaces4/trunk/icefaces/mobi/component/src/org/icefaces/mobi/component/geotrack/GeoTrack.java
        Commit graph ADD /icefaces4/trunk/icefaces/mobi/component/src/org/icefaces/mobi/component/geotrack/GeoTrackMeta.java
        Commit graph ADD /icefaces4/trunk/icefaces/mobi/component/src/org/icefaces/mobi/component/geotrack/GeoTrackResourceHandler.java
        Commit graph ADD /icefaces4/trunk/icefaces/mobi/component/src/org/icefaces/mobi/component/geotrack/GeoTrackRenderer.java
        Commit graph MODIFY /icefaces4/trunk/icefaces/mobi/component/resources/icefaces.mobi/META-INCLUDE/faces-config.xml
        Hide
        Arturo Zambrano added a comment -

        Added mobi:geotrack component at revision 41616.

        The component only works with application-scoped beans. I tried different approaches to support session-scoped beans, but not matter what I tried bridgeit didn't send any cookies in the request (so no JSESSIONID cookie). Using jsessionid in the URL didn't work either.

        The JS call looked like this:
        bridgeit.geoTrack('geotrack', '', {postURL:'/showcase/javax.faces.resource/geotrack.txt.jsf?ln=org.icefaces.component.geotrack&id=B25FA2D5F610D870216F351AEB3CE1D6/showcase-mobile.xhtml_geotrack', strategy:'continuous', duration:1, cookies: {JSESSIONID: 'B25FA2D5F610D870216F351AEB3CE1D6'}});

        So, the component works only with application-scoped beans at the moment. The basic usage is <mobi:geoTrack strategy="continuous" publish="#

        {geotrackBean.data}

        "/>, where 'publish' is an application-scoped bean property where the geoJSON data is written to. Of course, this way it's not possible to distinguish among different users using the application. Perhaps a better solution would be to allow app developers to define an event handler method that receives a GeoTrackingEvent with more information, such as the session id that originated the geotracking, view id, component id, the data itself, and possibly some other information.

        Show
        Arturo Zambrano added a comment - Added mobi:geotrack component at revision 41616. The component only works with application-scoped beans. I tried different approaches to support session-scoped beans, but not matter what I tried bridgeit didn't send any cookies in the request (so no JSESSIONID cookie). Using jsessionid in the URL didn't work either. The JS call looked like this: bridgeit.geoTrack('geotrack', '', {postURL:'/showcase/javax.faces.resource/geotrack.txt.jsf?ln=org.icefaces.component.geotrack& id=B25FA2D5F610D870216F351AEB3CE1D6 /showcase-mobile.xhtml_geotrack', strategy:'continuous', duration:1, cookies: {JSESSIONID: 'B25FA2D5F610D870216F351AEB3CE1D6'}}); So, the component works only with application-scoped beans at the moment. The basic usage is <mobi:geoTrack strategy="continuous" publish="# {geotrackBean.data} "/>, where 'publish' is an application-scoped bean property where the geoJSON data is written to. Of course, this way it's not possible to distinguish among different users using the application. Perhaps a better solution would be to allow app developers to define an event handler method that receives a GeoTrackingEvent with more information, such as the session id that originated the geotracking, view id, component id, the data itself, and possibly some other information.
        Hide
        Carmen Cristurean added a comment -

        Showcase testing with IF4 trunk rev. 41617 found styling issues and browser console errors (image attached).

        Show
        Carmen Cristurean added a comment - Showcase testing with IF4 trunk rev. 41617 found styling issues and browser console errors (image attached).
        Carmen Cristurean made changes -
        Attachment showcase.png [ 17286 ]
        Repository Revision Date User Message
        ICEsoft Public SVN Repository #41620 Thu Jul 10 11:50:45 MDT 2014 art.zambrano ICE-9780 fix to ensure geotrack resource is initialized when handling the resource request, in order to prevent issues with loading other resources
        Files Changed
        Commit graph MODIFY /icefaces4/trunk/icefaces/mobi/component/src/org/icefaces/mobi/component/geotrack/GeoTrackResourceHandler.java
        Hide
        Arturo Zambrano added a comment -

        r41620: committed fix to ensure the geotrack resource is initialized when handling the resource request, in order to prevent issues with loading other resources.

        Show
        Arturo Zambrano added a comment - r41620: committed fix to ensure the geotrack resource is initialized when handling the resource request, in order to prevent issues with loading other resources.
        Hide
        Carmen Cristurean added a comment -

        Showcase issues are resolved (rev.41621).

        Show
        Carmen Cristurean added a comment - Showcase issues are resolved (rev.41621).
        Repository Revision Date User Message
        ICEsoft Public SVN Repository #41784 Tue Jul 15 12:05:25 MDT 2014 art.zambrano ICE-9780 added ability to specify custom parameters
        Files Changed
        Commit graph MODIFY /icefaces4/trunk/icefaces/mobi/component/src/org/icefaces/mobi/component/geotrack/GeoTrackMeta.java
        Commit graph MODIFY /icefaces4/trunk/icefaces/mobi/component/src/org/icefaces/mobi/component/geotrack/GeoTrackResourceHandler.java
        Commit graph MODIFY /icefaces4/trunk/icefaces/mobi/component/src/org/icefaces/mobi/component/geotrack/GeoTrackRenderer.java
        Repository Revision Date User Message
        ICEsoft Public SVN Repository #41801 Thu Jul 17 10:32:50 MDT 2014 art.zambrano ICE-9780 mobi:geoTrack added custom parameters feature and fallback facet
        Files Changed
        Commit graph MODIFY /icefaces4/trunk/icefaces/mobi/component/src/org/icefaces/mobi/component/geotrack/GeoTrackMeta.java
        Commit graph MODIFY /icefaces4/trunk/icefaces/mobi/component/src/org/icefaces/mobi/component/geotrack/GeoTrackResourceHandler.java
        Commit graph MODIFY /icefaces4/trunk/icefaces/mobi/component/src/org/icefaces/mobi/component/geotrack/GeoTrackRenderer.java
        Hide
        Arturo Zambrano added a comment -

        r41801: added custom parameters feature and fallback facet.

        Note that at the moment the custom parameters feature doesn't work on Android because of a Bridgeit app issue.

        Show
        Arturo Zambrano added a comment - r41801: added custom parameters feature and fallback facet. Note that at the moment the custom parameters feature doesn't work on Android because of a Bridgeit app issue.
        Arturo Zambrano made changes -
        Status Open [ 1 ] Resolved [ 5 ]
        Resolution Fixed [ 1 ]
        Repository Revision Date User Message
        ICEsoft Public SVN Repository #41802 Thu Jul 17 10:46:29 MDT 2014 art.zambrano ICE-9780 fixed button client id that prevented button from receiving Themeroller styling
        Files Changed
        Commit graph MODIFY /icefaces4/trunk/icefaces/mobi/component/src/org/icefaces/mobi/component/geotrack/GeoTrackRenderer.java
        Hide
        Ted Goddard added a comment - - edited

        BridgeIt App feature in http://jira.icesoft.org/browse/MOBI-657

        now target BridgeIt 1.0.5.

        Show
        Ted Goddard added a comment - - edited BridgeIt App feature in http://jira.icesoft.org/browse/MOBI-657 now target BridgeIt 1.0.5.
        Repository Revision Date User Message
        ICEsoft Public SVN Repository #41846 Wed Jul 23 13:08:16 MDT 2014 art.zambrano ICE-9780 added mobi:geotrack demo to showcase
        Files Changed
        Commit graph ADD /icefaces4/trunk/icefaces/samples/showcase/showcase/src/main/webapp/resources/examples/mobi/geotrack
        Commit graph MODIFY /icefaces4/trunk/icefaces/samples/showcase/showcase/src/main/webapp/showcase-mobile.xhtml
        Commit graph ADD /icefaces4/trunk/icefaces/samples/showcase/showcase/src/main/webapp/resources/examples/mobi/geotrack/geotrack-desc.xhtml
        Commit graph ADD /icefaces4/trunk/icefaces/samples/showcase/showcase/src/main/java/org/icefaces/samples/showcase/example/mobi/geotrack/GeotrackBean.java
        Commit graph ADD /icefaces4/trunk/icefaces/samples/showcase/showcase/src/main/webapp/resources/examples/mobi/geotrack/geotrack-example.xhtml
        Commit graph ADD /icefaces4/trunk/icefaces/samples/showcase/showcase/src/main/java/org/icefaces/samples/showcase/example/mobi/geotrack
        Hide
        Arturo Zambrano added a comment -

        r41846: added geotrack demo to showcase.

        Show
        Arturo Zambrano added a comment - r41846: added geotrack demo to showcase.
        Repository Revision Date User Message
        ICEsoft Public SVN Repository #41850 Wed Jul 23 15:15:49 MDT 2014 art.zambrano ICE-9780 added 'stop tracking' button to geotrack demo
        Files Changed
        Commit graph MODIFY /icefaces4/trunk/icefaces/samples/showcase/showcase/src/main/webapp/resources/examples/mobi/geotrack/geotrack-example.xhtml
        Repository Revision Date User Message
        ICEsoft Public SVN Repository #41851 Wed Jul 23 15:23:27 MDT 2014 ken.fyten ICE-9780 added 'stop tracking' button to geotrack demo
        Files Changed
        Commit graph MODIFY /icefaces4/tags/icefaces-4.0.0.RC1/icefaces/samples/showcase/showcase/src/main/webapp/resources/examples/mobi/geotrack/geotrack-example.xhtml
        Repository Revision Date User Message
        ICEsoft Public SVN Repository #41854 Wed Jul 23 16:25:49 MDT 2014 art.zambrano ICE-9780 modified demo to start tracking and stop tracking using the same button
        Files Changed
        Commit graph MODIFY /icefaces4/trunk/icefaces/samples/showcase/showcase/src/main/java/org/icefaces/samples/showcase/example/mobi/geotrack/GeotrackBean.java
        Commit graph MODIFY /icefaces4/trunk/icefaces/samples/showcase/showcase/src/main/webapp/resources/examples/mobi/geotrack/geotrack-example.xhtml
        Commit graph ADD /icefaces4/trunk/icefaces/samples/showcase/showcase/src/main/java/org/icefaces/samples/showcase/example/mobi/geotrack/GeotrackDataBean.java
        Repository Revision Date User Message
        ICEsoft Public SVN Repository #41855 Wed Jul 23 16:26:32 MDT 2014 art.zambrano ICE-9780 modified component to set duration to 0 when strategy is 'stop'
        Files Changed
        Commit graph MODIFY /icefaces4/trunk/icefaces/mobi/component/src/org/icefaces/mobi/component/geotrack/GeoTrackRenderer.java
        Hide
        Arturo Zambrano added a comment -

        r41854: modified demo to toggle label and strategy when clicking button.
        r41855: modified component to set duration to 0 when strategy is 'stop'.

        Show
        Arturo Zambrano added a comment - r41854: modified demo to toggle label and strategy when clicking button. r41855: modified component to set duration to 0 when strategy is 'stop'.
        Repository Revision Date User Message
        ICEsoft Public SVN Repository #41856 Wed Jul 23 16:36:27 MDT 2014 ken.fyten ICE-9780 modified component to set duration to 0 when strategy is 'stop'
        Files Changed
        Commit graph MODIFY /icefaces4/tags/icefaces-4.0.0.RC1/icefaces/mobi/component/src/org/icefaces/mobi/component/geotrack/GeoTrackRenderer.java
        Repository Revision Date User Message
        ICEsoft Public SVN Repository #41857 Wed Jul 23 16:36:50 MDT 2014 ken.fyten ICE-9780 modified demo to start tracking and stop tracking using the same button
        Files Changed
        Commit graph MODIFY /icefaces4/tags/icefaces-4.0.0.RC1/icefaces/samples/showcase/showcase/src/main/webapp/resources/examples/mobi/geotrack/geotrack-example.xhtml
        Commit graph MODIFY /icefaces4/tags/icefaces-4.0.0.RC1/icefaces/samples/showcase/showcase/src/main/java/org/icefaces/samples/showcase/example/mobi/geotrack/GeotrackBean.java
        Commit graph ADD /icefaces4/tags/icefaces-4.0.0.RC1/icefaces/samples/showcase/showcase/src/main/java/org/icefaces/samples/showcase/example/mobi/geotrack/GeotrackDataBean.java
        Repository Revision Date User Message
        ICEsoft Public SVN Repository #43326 Mon Nov 03 18:02:47 MST 2014 art.zambrano ICE-9780 changed type of duration property from int to double
        Files Changed
        Commit graph MODIFY /icefaces4/trunk/icefaces/mobi/component/src/org/icefaces/mobi/component/geotrack/GeoTrackMeta.java
        Hide
        Arturo Zambrano added a comment -

        r43326: changed type of duration property from int to double.

        Show
        Arturo Zambrano added a comment - r43326: changed type of duration property from int to double.
        Repository Revision Date User Message
        ICEsoft Public SVN Repository #43327 Mon Nov 03 19:47:33 MST 2014 art.zambrano ICE-9780 changed type of duration property from int to double
        Files Changed
        Commit graph MODIFY /icefaces4/tags/icefaces-4.0.0/icefaces/mobi/component/src/org/icefaces/mobi/component/geotrack/GeoTrackMeta.java
        Hide
        Carmen Cristurean added a comment - - edited

        ICEfaces-4.0.0. Jenkins Build#6 (r. 43337):
        Verified showcase > Geotrack demo, with Safari/iOS7/iPhone4S and Chrome38/Nexus5/Android4.4.4.

        Show
        Carmen Cristurean added a comment - - edited ICEfaces-4.0.0. Jenkins Build#6 (r. 43337): Verified showcase > Geotrack demo, with Safari/iOS7/iPhone4S and Chrome38/Nexus5/Android4.4.4.
        Ken Fyten made changes -
        Status Resolved [ 5 ] Closed [ 6 ]

          People

          • Assignee:
            Arturo Zambrano
            Reporter:
            Ted Goddard
          • Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: