You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cxf.apache.org by Kaleb Walton <kd...@us.ibm.com> on 2007/08/27 18:57:48 UTC
How to define which properties to expose per class using simple server
I don't want to expose all of the properties of my Person object through
web services. Is there a way to define the exposed properties via Spring
using the simple server?
My server has the following config:
<lang:groovy id="personServiceImpl"
script-source="classpath:a/b/c/services/PersonServiceImpl.groovy"
refresh-check-delay="3000"/>
<simple:server id="personServer"
serviceClass="a.b.c.services.PersonService"
serviceBean="#personServiceImpl" address="/Person"/>
My hypothetical Person object contains an id, name, address and password.
Let's say that I'd like to expose the "id", "name" and "address" properties
of the Person but not the "password" - is there an easy way to define that
through Spring configuration? I'm assuming I could make the property
transient but I may not want to do that for internal serializations.
Regards,
Kaleb
Re: How to define which properties to expose per class using simple server
Posted by Kaleb Walton <kd...@us.ibm.com>.
Does the Simple Server default to using Aegis bindings?
I created Person.aegis.xml in a.b.c.entity package (a.b.c.entity.Person is
my bean) which contains:
<mappings>
<mapping>
<property name="password" ignore="true"/>
</mapping>
</mappings>
My service still outputs the 'password' field. Do I need to use something
other than Simple Server?
Regards,
Kaleb
|------------>
| From: |
|------------>
>--------------------------------------------------------------------------------------------------------------------------------------------------|
|"Dan Diephouse" <da...@envoisolutions.com> |
>--------------------------------------------------------------------------------------------------------------------------------------------------|
|------------>
| To: |
|------------>
>--------------------------------------------------------------------------------------------------------------------------------------------------|
|cxf-user@incubator.apache.org |
>--------------------------------------------------------------------------------------------------------------------------------------------------|
|------------>
| Date: |
|------------>
>--------------------------------------------------------------------------------------------------------------------------------------------------|
|08/27/2007 01:41 PM |
>--------------------------------------------------------------------------------------------------------------------------------------------------|
|------------>
| Subject: |
|------------>
>--------------------------------------------------------------------------------------------------------------------------------------------------|
|Re: How to define which properties to expose per class using simple server |
>--------------------------------------------------------------------------------------------------------------------------------------------------|
Probably the easiest way is to add an @IgnoreProperty annotation to the
property. Or you can supply an XML mapping file for your bean as well.
mapping files are named after your bean - so something along the lines of
MyBean.aegis.xml if your bean is named MyBean. They reside on the classpath
in the same package as your bean.
<mappings>
<mapping>
<property name="password" ignore="true"/>
</mapping>
</mappings>
Another option is to read the email I just wrote to Tog. He had pretty much
the exact same question, but he was looking for a programmatic way to do
it.
(BTW, Tog (aka Guillaume) is working on the Groovy web services stuff. If
you're trying to ignore the properties on the base groovy class, hopefully
he'll roll this into the Groovy WS source code so you don't have to have it
in your own. If you have no idea what I'm talking about here... nevermind
:-) ).
- Dan
On 8/27/07, Kaleb Walton <kd...@us.ibm.com> wrote:
>
>
>
> I don't want to expose all of the properties of my Person object through
> web services. Is there a way to define the exposed properties via Spring
> using the simple server?
>
> My server has the following config:
>
> <lang:groovy id="personServiceImpl"
> script-source="classpath:a/b/c/services/PersonServiceImpl.groovy"
> refresh-check-delay="3000"/>
> <simple:server id="personServer"
> serviceClass="a.b.c.services.PersonService"
> serviceBean="#personServiceImpl" address="/Person"/>
>
> My hypothetical Person object contains an id, name, address and password.
>
> Let's say that I'd like to expose the "id", "name" and "address"
> properties
> of the Person but not the "password" - is there an easy way to define
that
> through Spring configuration? I'm assuming I could make the property
> transient but I may not want to do that for internal serializations.
>
> Regards,
> Kaleb
--
Dan Diephouse
Envoi Solutions
http://envoisolutions.com | http://netzooid.com/blog
Re: How to define which properties to expose per class using simple server
Posted by Dan Diephouse <da...@envoisolutions.com>.
Probably the easiest way is to add an @IgnoreProperty annotation to the
property. Or you can supply an XML mapping file for your bean as well.
mapping files are named after your bean - so something along the lines of
MyBean.aegis.xml if your bean is named MyBean. They reside on the classpath
in the same package as your bean.
<mappings>
<mapping>
<property name="password" ignore="true"/>
</mapping>
</mappings>
Another option is to read the email I just wrote to Tog. He had pretty much
the exact same question, but he was looking for a programmatic way to do it.
(BTW, Tog (aka Guillaume) is working on the Groovy web services stuff. If
you're trying to ignore the properties on the base groovy class, hopefully
he'll roll this into the Groovy WS source code so you don't have to have it
in your own. If you have no idea what I'm talking about here... nevermind
:-) ).
- Dan
On 8/27/07, Kaleb Walton <kd...@us.ibm.com> wrote:
>
>
>
> I don't want to expose all of the properties of my Person object through
> web services. Is there a way to define the exposed properties via Spring
> using the simple server?
>
> My server has the following config:
>
> <lang:groovy id="personServiceImpl"
> script-source="classpath:a/b/c/services/PersonServiceImpl.groovy"
> refresh-check-delay="3000"/>
> <simple:server id="personServer"
> serviceClass="a.b.c.services.PersonService"
> serviceBean="#personServiceImpl" address="/Person"/>
>
> My hypothetical Person object contains an id, name, address and password.
>
> Let's say that I'd like to expose the "id", "name" and "address"
> properties
> of the Person but not the "password" - is there an easy way to define that
> through Spring configuration? I'm assuming I could make the property
> transient but I may not want to do that for internal serializations.
>
> Regards,
> Kaleb
--
Dan Diephouse
Envoi Solutions
http://envoisolutions.com | http://netzooid.com/blog