admin@glassfish.java.net

Re: a question on config api

From: Shing Wai Chan <shing.wai.chan_at_oracle.com>
Date: Wed, 02 Feb 2011 12:23:39 -0800

Having "" session file name to indicate disable writing is a feature in
sun-web.xml.
See http://blogs.sun.com/jluehe/entry/how_to_disable_persisting_of

Is it more consistent for ManagerProperties behaving the same way?
Shing Wai Chan

On 2/2/11 12:07 PM, Tom Mueller wrote:
> What does having a value of "" for the session-file-name mean? Does
> is mean to not store session data?
> If so, maybe there should be a boolean flag: enable-session-data-storage.
>
> I haven't verified this by locating the code, but I suspect that
> setSessionFileName("") means return it to the default value.
>
> Tom
>
>
> On 2/2/2011 12:27 PM, Shing Wai Chan wrote:
>> Hi Tom,
>> Let me describe what I need.
>> Out of the box, I want to have a default value "SESSIONS.ser".
>> And that need to be able to set with value "".
>> I try @Attribute(defaultValue="SESSIONS.ser") before.
>> I find that the default value will be provided if I set it "".
>> How can we achieve this?
>> Thanks.
>> Shing Wai Chan
>>
>>
>> On 2/2/11 7:59 AM, Tom Mueller wrote:
>>> Shing Wai,
>>> I'm not sure that I understand the question either.
>>>
>>> I don't understand what you mean by "internally we have a default".
>>> Do you mean that inside your code, you check to see if the value of
>>> the attribute is null, and then use "SESSIONS.ser" instead?
>>>
>>> What actually is the problem?
>>>
>>> Is it that when you have @Attribute(defaultValue="SESSIONS.ser"),
>>> and then someone does setSessionFileName(""), that the value doesn't
>>> go to the empty string but instead goes back to the default value?
>>> Same with calling setSessionFileName(null)?
>>>
>>> Tom
>>>
>>>
>>> On 2/1/2011 9:08 PM, Jennifer Chou wrote:
>>>> Maybe I don't quite understand. Can you check if
>>>> ManagerProperties.getSessionFileName() returns null to distinguish
>>>> that sessionFileName was not set?
>>>> Can you give some specific examples for when defaultValue, "", null
>>>> should be used?
>>>>
>>>> On 2/1/2011 9:27 PM, Shing Wai Chan wrote:
>>>>> If I do not set the default value, then I will get null for
>>>>> ManagerProperties.getSessionFileName() when user does not specify
>>>>> element.
>>>>> In our case, how can distinguish between not set and explicitly
>>>>> set it to "".
>>>>>
>>>>>
>>>>> On 2/1/11 4:48 PM, Jennifer Chou wrote:
>>>>>> Actually, I think if you have a default value it will always
>>>>>> return the default value if you don't set any value (set to "" or
>>>>>> null).
>>>>>> I guess you should not use the defaultValue on the attribute so
>>>>>> you can set it to "" or null.
>>>>>> Then maybe you can add a static field or method to return the
>>>>>> default value? I don't know if that will work for you.
>>>>>>
>>>>>> On 2/1/2011 7:06 PM, Shing Wai Chan wrote:
>>>>>>> cc. Tom
>>>>>>> Any comment?
>>>>>>> Shing Wai Chan
>>>>>>>
>>>>>>> On 2/1/11 3:32 PM, Shing Wai Chan wrote:
>>>>>>>> Hi Jennifer,
>>>>>>>>
>>>>>>>> I have a question on admin backend. Hope that you can help me.
>>>>>>>> There is a attribute in config-api/.../ManagerProperties.java:
>>>>>>>> @Attribute
>>>>>>>> public String getSessionFileName();
>>>>>>>>
>>>>>>>> Right now, the default is null.
>>>>>>>> But internally, we have a default "SESSIONS.ser".
>>>>>>>> There is a bug that we cannot unset this value.
>>>>>>>>
>>>>>>>> What is the best way to do that?
>>>>>>>> I try to change it as follows:
>>>>>>>> - @Attribute
>>>>>>>> + @Attribute(defaultValue="SESSIONS.ser")
>>>>>>>> public String getSessionFileName();
>>>>>>>>
>>>>>>>> and find that the admin backend will provide the default value
>>>>>>>> "SESSIONS.ser"
>>>>>>>> if we don't set a value for sessionFileName.
>>>>>>>>
>>>>>>>> What is the best way to resolve this?
>>>>>>>> Is there anyway we can specify "" or null and has a non-empty
>>>>>>>> default String?
>>>>>>>>
>>>>>>>> Please let me know.
>>>>>>>> Thanks.
>>>>>>>> Shing Wai Chan
>>>>>>>>
>>>>>>>>
>>>>>>>
>>>>>
>>