You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@shindig.apache.org by "Kai Feng Zhang (JIRA)" <ji...@apache.org> on 2010/11/08 07:52:05 UTC

[jira] Created: (SHINDIG-1465) set userPrefs key with wrong default value in DefaultIframeUriManager for new common container

set userPrefs key with wrong default value in DefaultIframeUriManager for new common container
----------------------------------------------------------------------------------------------

                 Key: SHINDIG-1465
                 URL: https://issues.apache.org/jira/browse/SHINDIG-1465
             Project: Shindig
          Issue Type: Bug
          Components: Java
    Affects Versions: 3.0.0
            Reporter: Kai Feng Zhang
             Fix For: 3.0.0
         Attachments: userPrefs_20101108.patch

When using new common container to render gadget, the ifr request url will be from gadget metadata request. At the back end,  method makeRenderingUri() will be called on DefaultIframeUriManager class to generate the ifr url. In this method, there are following code snippet to add default user prefs into url.

    // Add all UserPrefs
    UserPrefs prefs = context.getUserPrefs();
    for (UserPref up : gadget.getSpec().getUserPrefs().values()) {
      String name = up.getName();
      String data = prefs.getPref(name);
      if (data == null) {
        data = up.getDefaultValue();
      }

      boolean upInFragment = !view.needsUserPrefSubstitution();
      addParam(uri, UriCommon.USER_PREF_PREFIX + up.getName(), data, useTpl, upInFragment);
    }

Such as if gadget spec xml defined a pref named "mycolor" with default value "Green", but the addParam method will change the "mycolor" value to "%up_mycolor%" because useTpl is true. Thus, ifr url will be requested with all invalid user prefs values. And when you try to get some default value from user prefs, it return invalid value.



-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Resolved: (SHINDIG-1465) set userPrefs key with wrong default value in DefaultIframeUriManager for new common container

Posted by "Paul Lindner (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/SHINDIG-1465?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Paul Lindner resolved SHINDIG-1465.
-----------------------------------

    Resolution: Fixed

> set userPrefs key with wrong default value in DefaultIframeUriManager for new common container
> ----------------------------------------------------------------------------------------------
>
>                 Key: SHINDIG-1465
>                 URL: https://issues.apache.org/jira/browse/SHINDIG-1465
>             Project: Shindig
>          Issue Type: Bug
>          Components: Java
>    Affects Versions: 3.0.0
>            Reporter: Kai Feng Zhang
>             Fix For: 3.0.0
>
>         Attachments: userPrefs_20101108.patch
>
>
> When using new common container to render gadget, the ifr request url will be from gadget metadata request. At the back end,  method makeRenderingUri() will be called on DefaultIframeUriManager class to generate the ifr url. In this method, there are following code snippet to add default user prefs into url.
>     // Add all UserPrefs
>     UserPrefs prefs = context.getUserPrefs();
>     for (UserPref up : gadget.getSpec().getUserPrefs().values()) {
>       String name = up.getName();
>       String data = prefs.getPref(name);
>       if (data == null) {
>         data = up.getDefaultValue();
>       }
>       boolean upInFragment = !view.needsUserPrefSubstitution();
>       addParam(uri, UriCommon.USER_PREF_PREFIX + up.getName(), data, useTpl, upInFragment);
>     }
> Such as if gadget spec xml defined a pref named "mycolor" with default value "Green", but the addParam method will change the "mycolor" value to "%up_mycolor%" because useTpl is true. Thus, ifr url will be requested with all invalid user prefs values. And when you try to get some default value from user prefs, it return invalid value.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (SHINDIG-1465) set userPrefs key with wrong default value in DefaultIframeUriManager for new common container

Posted by "Paul Lindner (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/SHINDIG-1465?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12929904#action_12929904 ] 

Paul Lindner commented on SHINDIG-1465:
---------------------------------------

useTpl relies on the javascript side to make the substitutions. This allows for cached responses to the metadata request.

I'll see if I can find a definitive answer for you.


> set userPrefs key with wrong default value in DefaultIframeUriManager for new common container
> ----------------------------------------------------------------------------------------------
>
>                 Key: SHINDIG-1465
>                 URL: https://issues.apache.org/jira/browse/SHINDIG-1465
>             Project: Shindig
>          Issue Type: Bug
>          Components: Java
>    Affects Versions: 3.0.0
>            Reporter: Kai Feng Zhang
>             Fix For: 3.0.0
>
>         Attachments: userPrefs_20101108.patch
>
>
> When using new common container to render gadget, the ifr request url will be from gadget metadata request. At the back end,  method makeRenderingUri() will be called on DefaultIframeUriManager class to generate the ifr url. In this method, there are following code snippet to add default user prefs into url.
>     // Add all UserPrefs
>     UserPrefs prefs = context.getUserPrefs();
>     for (UserPref up : gadget.getSpec().getUserPrefs().values()) {
>       String name = up.getName();
>       String data = prefs.getPref(name);
>       if (data == null) {
>         data = up.getDefaultValue();
>       }
>       boolean upInFragment = !view.needsUserPrefSubstitution();
>       addParam(uri, UriCommon.USER_PREF_PREFIX + up.getName(), data, useTpl, upInFragment);
>     }
> Such as if gadget spec xml defined a pref named "mycolor" with default value "Green", but the addParam method will change the "mycolor" value to "%up_mycolor%" because useTpl is true. Thus, ifr url will be requested with all invalid user prefs values. And when you try to get some default value from user prefs, it return invalid value.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (SHINDIG-1465) set userPrefs key with wrong default value in DefaultIframeUriManager for new common container

Posted by "Kai Feng Zhang (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/SHINDIG-1465?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12930932#action_12930932 ] 

Kai Feng Zhang commented on SHINDIG-1465:
-----------------------------------------

There is mergeDefaults invocation in prefs.js:

  function mergeDefaults() {
    for (var name in defaultPrefs) {
      if (typeof prefs[name] === 'undefined') {
        prefs[name] = defaultPrefs[name];
      }
    }
  }

This will merge prefs from custom prefs with default prefs. Custom prefs is from ifr url parameter which is from gadgetInfo(gadget metadata request). If the prefs is "mycolor": "%up_mycolor%", the prefs value "%up_mycolor%" is not "undefined" then can not be merged by default prefs value.

> set userPrefs key with wrong default value in DefaultIframeUriManager for new common container
> ----------------------------------------------------------------------------------------------
>
>                 Key: SHINDIG-1465
>                 URL: https://issues.apache.org/jira/browse/SHINDIG-1465
>             Project: Shindig
>          Issue Type: Bug
>          Components: Java
>    Affects Versions: 3.0.0
>            Reporter: Kai Feng Zhang
>             Fix For: 3.0.0
>
>         Attachments: userPrefs_20101108.patch
>
>
> When using new common container to render gadget, the ifr request url will be from gadget metadata request. At the back end,  method makeRenderingUri() will be called on DefaultIframeUriManager class to generate the ifr url. In this method, there are following code snippet to add default user prefs into url.
>     // Add all UserPrefs
>     UserPrefs prefs = context.getUserPrefs();
>     for (UserPref up : gadget.getSpec().getUserPrefs().values()) {
>       String name = up.getName();
>       String data = prefs.getPref(name);
>       if (data == null) {
>         data = up.getDefaultValue();
>       }
>       boolean upInFragment = !view.needsUserPrefSubstitution();
>       addParam(uri, UriCommon.USER_PREF_PREFIX + up.getName(), data, useTpl, upInFragment);
>     }
> Such as if gadget spec xml defined a pref named "mycolor" with default value "Green", but the addParam method will change the "mycolor" value to "%up_mycolor%" because useTpl is true. Thus, ifr url will be requested with all invalid user prefs values. And when you try to get some default value from user prefs, it return invalid value.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] [Commented] (SHINDIG-1465) set userPrefs key with wrong default value in DefaultIframeUriManager for new common container

Posted by "Isaiah Billingsley (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/SHINDIG-1465?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13010693#comment-13010693 ] 

Isaiah Billingsley commented on SHINDIG-1465:
---------------------------------------------

I am running into this issue as well.
How exactly did you work around this? Is there a way to set useTemplates to false without changing the source?
Alternatively, I was thinking about changing the mergeDefaults() function in prefs.js to

  function mergeDefaults() {
    for (var name in defaultPrefs) {
      if (typeof prefs[name] === 'undefined' || prefs[name] === '%up_' + name + '%') {
        prefs[name] = defaultPrefs[name];
      }
    }
  }

Or is the provided patch for DefaultIframeUriManager a better approach?

> set userPrefs key with wrong default value in DefaultIframeUriManager for new common container
> ----------------------------------------------------------------------------------------------
>
>                 Key: SHINDIG-1465
>                 URL: https://issues.apache.org/jira/browse/SHINDIG-1465
>             Project: Shindig
>          Issue Type: Bug
>          Components: Java
>    Affects Versions: 3.0.0
>            Reporter: Kai Feng Zhang
>             Fix For: 3.0.0
>
>         Attachments: userPrefs_20101108.patch
>
>
> When using new common container to render gadget, the ifr request url will be from gadget metadata request. At the back end,  method makeRenderingUri() will be called on DefaultIframeUriManager class to generate the ifr url. In this method, there are following code snippet to add default user prefs into url.
>     // Add all UserPrefs
>     UserPrefs prefs = context.getUserPrefs();
>     for (UserPref up : gadget.getSpec().getUserPrefs().values()) {
>       String name = up.getName();
>       String data = prefs.getPref(name);
>       if (data == null) {
>         data = up.getDefaultValue();
>       }
>       boolean upInFragment = !view.needsUserPrefSubstitution();
>       addParam(uri, UriCommon.USER_PREF_PREFIX + up.getName(), data, useTpl, upInFragment);
>     }
> Such as if gadget spec xml defined a pref named "mycolor" with default value "Green", but the addParam method will change the "mycolor" value to "%up_mycolor%" because useTpl is true. Thus, ifr url will be requested with all invalid user prefs values. And when you try to get some default value from user prefs, it return invalid value.

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

[jira] Commented: (SHINDIG-1465) set userPrefs key with wrong default value in DefaultIframeUriManager for new common container

Posted by "Kai Feng Zhang (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/SHINDIG-1465?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12929477#action_12929477 ] 

Kai Feng Zhang commented on SHINDIG-1465:
-----------------------------------------

code review: http://codereview.appspot.com/2977041/

> set userPrefs key with wrong default value in DefaultIframeUriManager for new common container
> ----------------------------------------------------------------------------------------------
>
>                 Key: SHINDIG-1465
>                 URL: https://issues.apache.org/jira/browse/SHINDIG-1465
>             Project: Shindig
>          Issue Type: Bug
>          Components: Java
>    Affects Versions: 3.0.0
>            Reporter: Kai Feng Zhang
>             Fix For: 3.0.0
>
>         Attachments: userPrefs_20101108.patch
>
>
> When using new common container to render gadget, the ifr request url will be from gadget metadata request. At the back end,  method makeRenderingUri() will be called on DefaultIframeUriManager class to generate the ifr url. In this method, there are following code snippet to add default user prefs into url.
>     // Add all UserPrefs
>     UserPrefs prefs = context.getUserPrefs();
>     for (UserPref up : gadget.getSpec().getUserPrefs().values()) {
>       String name = up.getName();
>       String data = prefs.getPref(name);
>       if (data == null) {
>         data = up.getDefaultValue();
>       }
>       boolean upInFragment = !view.needsUserPrefSubstitution();
>       addParam(uri, UriCommon.USER_PREF_PREFIX + up.getName(), data, useTpl, upInFragment);
>     }
> Such as if gadget spec xml defined a pref named "mycolor" with default value "Green", but the addParam method will change the "mycolor" value to "%up_mycolor%" because useTpl is true. Thus, ifr url will be requested with all invalid user prefs values. And when you try to get some default value from user prefs, it return invalid value.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] [Closed] (SHINDIG-1465) set userPrefs key with wrong default value in DefaultIframeUriManager for new common container

Posted by "Paul Lindner (Closed) (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/SHINDIG-1465?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Paul Lindner closed SHINDIG-1465.
---------------------------------


part of 2.5.0-beta1 release.

                
> set userPrefs key with wrong default value in DefaultIframeUriManager for new common container
> ----------------------------------------------------------------------------------------------
>
>                 Key: SHINDIG-1465
>                 URL: https://issues.apache.org/jira/browse/SHINDIG-1465
>             Project: Shindig
>          Issue Type: Bug
>          Components: Java
>    Affects Versions: 2.5.0-beta1
>            Reporter: Kai Feng Zhang
>             Fix For: 2.5.0-beta1
>
>         Attachments: userPrefs_20101108.patch
>
>
> When using new common container to render gadget, the ifr request url will be from gadget metadata request. At the back end,  method makeRenderingUri() will be called on DefaultIframeUriManager class to generate the ifr url. In this method, there are following code snippet to add default user prefs into url.
>     // Add all UserPrefs
>     UserPrefs prefs = context.getUserPrefs();
>     for (UserPref up : gadget.getSpec().getUserPrefs().values()) {
>       String name = up.getName();
>       String data = prefs.getPref(name);
>       if (data == null) {
>         data = up.getDefaultValue();
>       }
>       boolean upInFragment = !view.needsUserPrefSubstitution();
>       addParam(uri, UriCommon.USER_PREF_PREFIX + up.getName(), data, useTpl, upInFragment);
>     }
> Such as if gadget spec xml defined a pref named "mycolor" with default value "Green", but the addParam method will change the "mycolor" value to "%up_mycolor%" because useTpl is true. Thus, ifr url will be requested with all invalid user prefs values. And when you try to get some default value from user prefs, it return invalid value.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (SHINDIG-1465) set userPrefs key with wrong default value in DefaultIframeUriManager for new common container

Posted by "madhuka udantha (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/SHINDIG-1465?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13470239#comment-13470239 ] 

madhuka udantha commented on SHINDIG-1465:
------------------------------------------

In shindig 2.5.0-beta4 release uerPrefs is not working in default mode "&up_mychoice=%25up_mychoice%25" where is to be "&up_mychoice=home". It contain %25 and showing key name where is to show value

eg url:
http://localhost:8080/gadgets/ifr?url=http%3A%2F%2Flocalhost%3A8080%2Fsamplecontainer%2Fexamples%2FActivityStreams%2Fprefs-example.xml&container=default&view=default&lang=en&country=US&debug=1&nocache=1&sanitize=%25sanitize%25&v=c6c9850553726469f045c60800491252&testmode=0&parent=http%3A%2F%2Flocalhost%3A8080&mid=0#up_myname=%25up_myname%25&up_myphoto=%25up_myphoto%25&up_mychoice=%25up_mychoice%25&up_mycolor=%25up_mycolor%25&rpctoken=717010535

                
> set userPrefs key with wrong default value in DefaultIframeUriManager for new common container
> ----------------------------------------------------------------------------------------------
>
>                 Key: SHINDIG-1465
>                 URL: https://issues.apache.org/jira/browse/SHINDIG-1465
>             Project: Shindig
>          Issue Type: Bug
>          Components: Java
>    Affects Versions: 2.5.0-beta1
>            Reporter: Kai Feng Zhang
>             Fix For: 2.5.0-beta1
>
>         Attachments: userPrefs_20101108.patch
>
>
> When using new common container to render gadget, the ifr request url will be from gadget metadata request. At the back end,  method makeRenderingUri() will be called on DefaultIframeUriManager class to generate the ifr url. In this method, there are following code snippet to add default user prefs into url.
>     // Add all UserPrefs
>     UserPrefs prefs = context.getUserPrefs();
>     for (UserPref up : gadget.getSpec().getUserPrefs().values()) {
>       String name = up.getName();
>       String data = prefs.getPref(name);
>       if (data == null) {
>         data = up.getDefaultValue();
>       }
>       boolean upInFragment = !view.needsUserPrefSubstitution();
>       addParam(uri, UriCommon.USER_PREF_PREFIX + up.getName(), data, useTpl, upInFragment);
>     }
> Such as if gadget spec xml defined a pref named "mycolor" with default value "Green", but the addParam method will change the "mycolor" value to "%up_mycolor%" because useTpl is true. Thus, ifr url will be requested with all invalid user prefs values. And when you try to get some default value from user prefs, it return invalid value.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

[jira] Commented: (SHINDIG-1465) set userPrefs key with wrong default value in DefaultIframeUriManager for new common container

Posted by "Kai Feng Zhang (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/SHINDIG-1465?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12980028#action_12980028 ] 

Kai Feng Zhang commented on SHINDIG-1465:
-----------------------------------------

Request to close this issue, not a problem for me any more.
Thanks.

> set userPrefs key with wrong default value in DefaultIframeUriManager for new common container
> ----------------------------------------------------------------------------------------------
>
>                 Key: SHINDIG-1465
>                 URL: https://issues.apache.org/jira/browse/SHINDIG-1465
>             Project: Shindig
>          Issue Type: Bug
>          Components: Java
>    Affects Versions: 3.0.0
>            Reporter: Kai Feng Zhang
>             Fix For: 3.0.0
>
>         Attachments: userPrefs_20101108.patch
>
>
> When using new common container to render gadget, the ifr request url will be from gadget metadata request. At the back end,  method makeRenderingUri() will be called on DefaultIframeUriManager class to generate the ifr url. In this method, there are following code snippet to add default user prefs into url.
>     // Add all UserPrefs
>     UserPrefs prefs = context.getUserPrefs();
>     for (UserPref up : gadget.getSpec().getUserPrefs().values()) {
>       String name = up.getName();
>       String data = prefs.getPref(name);
>       if (data == null) {
>         data = up.getDefaultValue();
>       }
>       boolean upInFragment = !view.needsUserPrefSubstitution();
>       addParam(uri, UriCommon.USER_PREF_PREFIX + up.getName(), data, useTpl, upInFragment);
>     }
> Such as if gadget spec xml defined a pref named "mycolor" with default value "Green", but the addParam method will change the "mycolor" value to "%up_mycolor%" because useTpl is true. Thus, ifr url will be requested with all invalid user prefs values. And when you try to get some default value from user prefs, it return invalid value.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] [Issue Comment Edited] (SHINDIG-1465) set userPrefs key with wrong default value in DefaultIframeUriManager for new common container

Posted by "Isaiah Billingsley (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/SHINDIG-1465?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13010693#comment-13010693 ] 

Isaiah Billingsley edited comment on SHINDIG-1465 at 3/24/11 2:44 PM:
----------------------------------------------------------------------

I am running into this issue as well.
How exactly did you work around this? Is there a way to set useTemplates to false without changing the source?
Or is the provided patch for DefaultIframeUriManager a better approach?

      was (Author: iza):
    I am running into this issue as well.
How exactly did you work around this? Is there a way to set useTemplates to false without changing the source?
Alternatively, I was thinking about changing the mergeDefaults() function in prefs.js to

  function mergeDefaults() {
    for (var name in defaultPrefs) {
      if (typeof prefs[name] === 'undefined' || prefs[name] === '%up_' + name + '%') {
        prefs[name] = defaultPrefs[name];
      }
    }
  }

Or is the provided patch for DefaultIframeUriManager a better approach?
  
> set userPrefs key with wrong default value in DefaultIframeUriManager for new common container
> ----------------------------------------------------------------------------------------------
>
>                 Key: SHINDIG-1465
>                 URL: https://issues.apache.org/jira/browse/SHINDIG-1465
>             Project: Shindig
>          Issue Type: Bug
>          Components: Java
>    Affects Versions: 3.0.0
>            Reporter: Kai Feng Zhang
>             Fix For: 3.0.0
>
>         Attachments: userPrefs_20101108.patch
>
>
> When using new common container to render gadget, the ifr request url will be from gadget metadata request. At the back end,  method makeRenderingUri() will be called on DefaultIframeUriManager class to generate the ifr url. In this method, there are following code snippet to add default user prefs into url.
>     // Add all UserPrefs
>     UserPrefs prefs = context.getUserPrefs();
>     for (UserPref up : gadget.getSpec().getUserPrefs().values()) {
>       String name = up.getName();
>       String data = prefs.getPref(name);
>       if (data == null) {
>         data = up.getDefaultValue();
>       }
>       boolean upInFragment = !view.needsUserPrefSubstitution();
>       addParam(uri, UriCommon.USER_PREF_PREFIX + up.getName(), data, useTpl, upInFragment);
>     }
> Such as if gadget spec xml defined a pref named "mycolor" with default value "Green", but the addParam method will change the "mycolor" value to "%up_mycolor%" because useTpl is true. Thus, ifr url will be requested with all invalid user prefs values. And when you try to get some default value from user prefs, it return invalid value.

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

[jira] Updated: (SHINDIG-1465) set userPrefs key with wrong default value in DefaultIframeUriManager for new common container

Posted by "Kai Feng Zhang (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/SHINDIG-1465?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Kai Feng Zhang updated SHINDIG-1465:
------------------------------------

    Attachment: userPrefs_20101108.patch

upload the patch to change the "useTpl" to *false*.

> set userPrefs key with wrong default value in DefaultIframeUriManager for new common container
> ----------------------------------------------------------------------------------------------
>
>                 Key: SHINDIG-1465
>                 URL: https://issues.apache.org/jira/browse/SHINDIG-1465
>             Project: Shindig
>          Issue Type: Bug
>          Components: Java
>    Affects Versions: 3.0.0
>            Reporter: Kai Feng Zhang
>             Fix For: 3.0.0
>
>         Attachments: userPrefs_20101108.patch
>
>
> When using new common container to render gadget, the ifr request url will be from gadget metadata request. At the back end,  method makeRenderingUri() will be called on DefaultIframeUriManager class to generate the ifr url. In this method, there are following code snippet to add default user prefs into url.
>     // Add all UserPrefs
>     UserPrefs prefs = context.getUserPrefs();
>     for (UserPref up : gadget.getSpec().getUserPrefs().values()) {
>       String name = up.getName();
>       String data = prefs.getPref(name);
>       if (data == null) {
>         data = up.getDefaultValue();
>       }
>       boolean upInFragment = !view.needsUserPrefSubstitution();
>       addParam(uri, UriCommon.USER_PREF_PREFIX + up.getName(), data, useTpl, upInFragment);
>     }
> Such as if gadget spec xml defined a pref named "mycolor" with default value "Green", but the addParam method will change the "mycolor" value to "%up_mycolor%" because useTpl is true. Thus, ifr url will be requested with all invalid user prefs values. And when you try to get some default value from user prefs, it return invalid value.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] [Commented] (SHINDIG-1465) set userPrefs key with wrong default value in DefaultIframeUriManager for new common container

Posted by "Ryan Baxter (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/SHINDIG-1465?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13470299#comment-13470299 ] 

Ryan Baxter commented on SHINDIG-1465:
--------------------------------------

You can set shindig.urlgen.use-templates-default to false in shindig.properties and the URL will not use templated preferences.
                
> set userPrefs key with wrong default value in DefaultIframeUriManager for new common container
> ----------------------------------------------------------------------------------------------
>
>                 Key: SHINDIG-1465
>                 URL: https://issues.apache.org/jira/browse/SHINDIG-1465
>             Project: Shindig
>          Issue Type: Bug
>          Components: Java
>    Affects Versions: 2.5.0-beta1
>            Reporter: Kai Feng Zhang
>             Fix For: 2.5.0-beta1
>
>         Attachments: userPrefs_20101108.patch
>
>
> When using new common container to render gadget, the ifr request url will be from gadget metadata request. At the back end,  method makeRenderingUri() will be called on DefaultIframeUriManager class to generate the ifr url. In this method, there are following code snippet to add default user prefs into url.
>     // Add all UserPrefs
>     UserPrefs prefs = context.getUserPrefs();
>     for (UserPref up : gadget.getSpec().getUserPrefs().values()) {
>       String name = up.getName();
>       String data = prefs.getPref(name);
>       if (data == null) {
>         data = up.getDefaultValue();
>       }
>       boolean upInFragment = !view.needsUserPrefSubstitution();
>       addParam(uri, UriCommon.USER_PREF_PREFIX + up.getName(), data, useTpl, upInFragment);
>     }
> Such as if gadget spec xml defined a pref named "mycolor" with default value "Green", but the addParam method will change the "mycolor" value to "%up_mycolor%" because useTpl is true. Thus, ifr url will be requested with all invalid user prefs values. And when you try to get some default value from user prefs, it return invalid value.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira