I tried with both 0.9.2 and 0.9.1, neither works for me, here is my code could you please take a look and point me what I am doing wrong here?
*pom.xml:* <?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <groupId>com.test</groupId> <artifactId>dt</artifactId> <version>1.0-SNAPSHOT</version> <properties> <dropwizard.version>0.9.1</dropwizard.version> </properties> <dependencies> <dependency> <groupId>io.dropwizard</groupId> <artifactId>dropwizard-core</artifactId> <version>${dropwizard.version}</version> </dependency> <dependency> <groupId>org.glassfish.jersey.ext</groupId> <artifactId>jersey-entity-filtering</artifactId> <version>2.23.1</version> </dependency> </dependencies> </project> *Application:* public class DApplication extends Application<DConfiguration> { public static void main(String[] args) throws Exception { new DApplication().run(args); } @Override public void initialize(Bootstrap<DConfiguration> bootstrap) { super.initialize(bootstrap); } @Override public void run(DConfiguration dConfiguration, Environment environment) throws Exception { // Does not work with the line below commented or uncommented //environment.jersey().property( // EntityFilteringFeature.ENTITY_FILTERING_SCOPE, // new Annotation[] { // Detail.Factory.get() // } //); environment.jersey().register(EntityFilteringFeature.class); environment.jersey().register(MyResource.class); } } *Resource :* @Path("hello") @Produces({ MediaType.APPLICATION_JSON}) public class MyResource { @GET //@Detail public Model getModel() { Model model = new Model(); model.setTest("abcd"); model.setDetail("efgh"); return model; } } *Model:*public class Model { private String test; @Detail private String detail ; // getters and setters } *Annotation :*@Target({ ElementType.TYPE, ElementType.METHOD ,ElementType.FIELD}) @Retention(RetentionPolicy.RUNTIME) @Documented @EntityFiltering public @interface Detail { /** * Factory class for creating instances of the annotation. */ public static class Factory extends AnnotationLiteral<Detail> implements Detail { private Factory() { } public static Detail get() { return new Factory(); } } } On Wednesday, June 22, 2016 at 1:24:32 AM UTC-4, Vaibhav Dhawan wrote: > > I am using 0.9.2 but worked well on 0.9.1 as well. Although, i moved on > from this to a different solution where in i am deciding the view on basis > of the user role. > > > > On Tue, Jun 21, 2016 at 8:31 PM, Ashish <[email protected] <javascript:>> > wrote: > >> What drop wizard version are you using ?, It is not working for me >> with 0.9.3 >> >> >> On Friday, January 29, 2016 at 11:06:44 AM UTC-5, Vaibhav Dhawan wrote: >>> >>> I was able to get through this. Jersey entity filter dependency was >>> missing from my pom and i though dw core would have it covered. >>> >>> Still surprised why wont it throw a compilation error. >>> >>> On Friday, 29 January 2016 13:48:14 UTC+5:30, Vaibhav Dhawan wrote: >>>> >>>> Hello, >>>> >>>> I am trying to configure EntityFilteringFeature in my DW application >>>> but it doesnt seem to filter out fields. here is what i have done >>>> >>>> *Entity is listed as * >>>> >>>> public class Cities { >>>> >>>> private int cityId; >>>> private String cityName; >>>> @ProjectDetailedView >>>> private int cityStatus; >>>> >>>> //.. setters and getters >>>> >>>> *ProjectDetailedView is listed as * >>>> >>>> @Target({ElementType.TYPE, ElementType.METHOD, ElementType.FIELD}) >>>> @Retention(RetentionPolicy.RUNTIME) >>>> @Documented >>>> @EntityFiltering >>>> public @interface ProjectDetailedView { >>>> >>>> public static class Factory extends >>>> AnnotationLiteral<ProjectDetailedView> implements ProjectDetailedView { >>>> private Factory() { >>>> } >>>> public static ProjectDetailedView get() { >>>> return new Factory(); >>>> }}} >>>> >>>> *Added following lines in app * >>>> >>>> environment.jersey().register(EntityFilteringFeature.class); >>>> environment.jersey().register(JacksonFeatures.class); //Probably not >>>> needed >>>> >>>> *Resource is listed as following. * >>>> >>>> GET >>>> @UnitOfWork >>>> @Produces(MediaType.APPLICATION_JSON) >>>> //@ProjectDetailedView >>>> public List<Cities> getCities() { >>>> return citiesDAO.findAll(); >>>> } >>>> >>>> I am expecting limited response when the annotation is commented out. >>>> However i get the full response in both the cases. >>>> >>>> Am i missing anything. Any pointers are much appreciated. >>>> >>>> Thanks >>>> Vaibhav >>>> >>> -- >> You received this message because you are subscribed to a topic in the >> Google Groups "dropwizard-user" group. >> To unsubscribe from this topic, visit >> https://groups.google.com/d/topic/dropwizard-user/9i5tdMHUDk0/unsubscribe >> . >> To unsubscribe from this group and all its topics, send an email to >> [email protected] <javascript:>. >> For more options, visit https://groups.google.com/d/optout. >> > > > > -- > Thanks > > Vaibhav Dhawan > +919871488896 > -- You received this message because you are subscribed to the Google Groups "dropwizard-user" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/d/optout.
