dev@glassfish.java.net

Re: Using HK2 _at_Configured... how can I read "body content"?

From: Tim Quinn <Timothy.Quinn_at_Sun.COM>
Date: Mon, 29 Jun 2009 15:16:42 -0500

One brief follow-up to this...

1. The names in the in-body example I gave in my earlier message were
not very helpful; the EnvEntry (or ContextParam in the same module) will
be clearer. You probably get the idea anyway.

2. I am not sure of the state of affairs with CDATA in hk2 configured
interfaces. In some early work with app management we placed an xml
snippet inside CDATA. We discovered some bugs in hk2 that I think were
fixed. We've since moved away from that approach so I cannot vouch for
CDATA support in hk2 today.

In EnvEntry and ContextParam, setting the value does not automatically
create the CDATA wrapper around the text in the domain.xml file. I'd
expect the caller would need to provide the CDATA wrapper itself in the
string argument to the "set" method.

- Tim

Tim Quinn wrote:
> Hi, Ken.
>
> For an example, look at web/gui-plugin-common EnvEntry. It has
> subelements EnvEntryName, EnvEntryType, EnvEntryValue and Description
> all of which expose their values as the text body.
>
> Basically,
>
> @Configured
> interface KensElement {
>
> @Element
> String getContent();
> void setContent(String content);
> }
>
> should do it.
>
> - Tim
>
> Ken Paulsen wrote:
>>
>> Can someone point me in the right direction to read body content
>> using HK2's @Configured/_at_Attribute/etc infrastructure? Or is this
>> not possible?
>>
>> Specifically, I want to read "Hello World!" from something like:
>>
>> <Content type="html">
>> <![CDATA[
>> Hello, world!
>> ]]>
>> </Content>
>>
>> Thanks in advance!
>>
>> Ken
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: dev-unsubscribe_at_glassfish.dev.java.net
>> For additional commands, e-mail: dev-help_at_glassfish.dev.java.net
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe_at_glassfish.dev.java.net
> For additional commands, e-mail: dev-help_at_glassfish.dev.java.net
>