[Resteasy-users] How to remove headers from resteasy Response
Hi Team, On one of my application I don't want the headers Pragma and Cache- Control but these headers are always coming in Response as below Pragma: No-cache Cache-Control: no-cache How I can remove those? Thanks BBSR -- Open source business process management suite built on Java and Eclipse Turn processes into business applications with Bonita BPM Community Edition Quickly connect people, data, and systems into organized workflows Winner of BOSSIE, CODIE, OW2 and Gartner awards http://p.sf.net/sfu/Bonitasoft ___ Resteasy-users mailing list Resteasy-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/resteasy-users
[Resteasy-users] Help on RESTEASY
Hi Team, I am working on a rest application on which I have model for the following objects customers ,accounts and products. User can access the details of customers,accounts and products using the following uri. [1] GET http://localhost:8080/customers [2] GET http://localhost:8080/accounts [3] GET http://localhost:8080/products Now my requirement is to combine the responses of the above 3 services in one service, i.e. when user will try GET http://localhost:8080/details then he can get all the customers , accounts and products info on the response. Is there any thing on RESTEASY which will help me to implement this functionality.I don't want change anything on the model class or want to add any new model like details. Thanks Ignou -- Rapidly troubleshoot problems before they affect your business. Most IT organizations don't have a clear picture of how application performance affects their revenue. With AppDynamics, you get 100% visibility into your Java,.NET, PHP application. Start your 15-day FREE TRIAL of AppDynamics Pro! http://pubads.g.doubleclick.net/gampad/clk?id=84349831iu=/4140/ostg.clktrk ___ Resteasy-users mailing list Resteasy-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/resteasy-users
Re: [Resteasy-users] Help on RESTEASY
Hi william, Thanks for your response, Sorry for missing out the application context name from the URI but my main question was I don't want to create the Details bean but want the response of products,accounts and customers in GET http://localhost:8080/application_context/details . Not sure if it is possible without the Bean class, Thanks Ignou That's weird you have to bind your resources URI to the root URL. Usually we also have the application context(sometimes also the rest context) before the resource URI: http://localhost:8080/{APP_CONTEXT}/products http://localhost:8080/{APP_CONTEXT}/accounts http://localhost:8080/{APP_CONTEXT}/customers To achieve what you want with details, you can create a bean that aggregate all information and return it from the JAX-RS resource: public class Details{ public ListProduct products; public ListCustomer customers; public ListAccounts accounts; // get and sets } Then expose this bean from a JAX-RS resource: @Path(details)public class DetailsResource{ public Details getDetails(){ Details details; // retrieve Details return details; } } -- William Antônio Siqueira Java Support Analyst http://fxapps.blogspot.comhttp://www.williamantonio.wordpress.com http://williamprogrammer.com 2013/12/19 ignou_mca bbsr_...@cooltoad.com Hi Team, I am working on a rest application on which I have model for the following objects customers ,accounts and products. User can access the details of customers,accounts and products using the following uri. [1] GET http://localhost:8080/customers [2] GET http://localhost:8080/accounts [3] GET http://localhost:8080/products Now my requirement is to combine the responses of the above 3 services in one service, i.e. when user will try GET http://localhost:8080/details then he can get all the customers , accounts and products info on the response. Is there any thing on RESTEASY which will help me to implement this functionality.I don't want change anything on the model class or want to add any new model like details. Thanks Ignou -- Rapidly troubleshoot problems before they affect your business. Most IT organizations don't have a clear picture of how application performance affects their revenue. With AppDynamics, you get 100% visibility into your Java,.NET, PHP application. Start your 15-day FREE TRIAL of AppDynamics Pro! http://pubads.g.doubleclick.net/gampad/clk?id=84349831iu=/4140/ostg.clktr k ___ Resteasy-users mailing list Resteasy-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/resteasy-users -- Rapidly troubleshoot problems before they affect your business. Most IT organizations don't have a clear picture of how application performance affects their revenue. With AppDynamics, you get 100% visibility into your Java,.NET, PHP application. Start your 15-day FREE TRIAL of AppDynamics Pro! http://pubads.g.doubleclick.net/gampad/clk?id=84349831iu=/4140/ostg.clktrk___ Resteasy-users mailing list Resteasy-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/resteasy-users
Re: [Resteasy-users] Help on RESTEASY
Hi William, Thanks for your response, Can we use atom feed in this scenario? If yes if any one can provide some sample that will be great help. Thanks Ignou Hi Ignou, In this case I believe you will have to create the XML manually in the jax-rs resource method body and return it as String, or you can manage to do this using a MessageBodyWriter/Reader. However, I think someone else might have some better alternative to achieve this-- William Antônio Siqueira Java Support Analyst http://fxapps.blogspot.comhttp://www.williamantonio.wordpress.com http://williamprogrammer.com 2013/12/19 ignou_mca bbsr_...@cooltoad.com Hi william, Thanks for your response, Sorry for missing out the application context name from the URI but my main question was I don't want to create the Details bean but want the response of products,accounts and customers in GET http://localhost:8080/application_context/details . Not sure if it is possible without the Bean class, Thanks Ignou That's weird you have to bind your resources URI to the root URL. Usually we also have the application context(sometimes also the rest context) before the resource URI: http://localhost:8080/{APP_CONTEXT}/products http://localhost:8080/{APP_CONTEXT}/accounts http://localhost:8080/{APP_CONTEXT}/customers To achieve what you want with details, you can create a bean that aggregate all information and return it from the JAX-RS resource: public class Details{ public ListProduct products; public ListCustomer customers; public ListAccounts accounts; // get and sets } Then expose this bean from a JAX-RS resource: @Path(details)public class DetailsResource{ public Details getDetails(){ Details details; // retrieve Details return details; } } -- William Antônio Siqueira Java Support Analyst http://fxapps.blogspot.comhttp://www.williamantonio.wordpress.com http://williamprogrammer.com 2013/12/19 ignou_mca bbsr_...@cooltoad.com Hi Team, I am working on a rest application on which I have model for the following objects customers ,accounts and products. User can access the details of customers,accounts and products using the following uri. [1] GET http://localhost:8080/customers [2] GET http://localhost:8080/accounts [3] GET http://localhost:8080/products Now my requirement is to combine the responses of the above 3 services in one service, i.e. when user will try GET http://localhost:8080/details then he can get all the customers , accounts and products info on the response. Is there any thing on RESTEASY which will help me to implement this functionality.I don't want change anything on the model class or want to add any new model like details. Thanks Ignou -- Rapidly troubleshoot problems before they affect your business. Most IT organizations don't have a clear picture of how application performance affects their revenue. With AppDynamics, you get 100% visibility into your Java,.NET, PHP application. Start your 15-day FREE TRIAL of AppDynamics Pro! http://pubads.g.doubleclick.net/gampad/clk?id=84349831iu=/4140/ostg.clktr k ___ Resteasy-users mailing list Resteasy-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/resteasy-users -- Rapidly troubleshoot problems before they affect your business. Most IT organizations don't have a clear picture of how application performance affects their revenue. With AppDynamics, you get 100% visibility into your Java,.NET, PHP application. Start your 15-day FREE TRIAL of AppDynamics Pro! http://pubads.g.doubleclick.net/gampad/clk?id=84349831iu=/4140/ostg.clktr k ___ Resteasy-users mailing list Resteasy-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/resteasy-users -- Rapidly troubleshoot problems before they affect your business. Most IT organizations don't have a clear picture of how application performance affects their revenue. With AppDynamics, you get 100% visibility into your Java,.NET, PHP application. Start your 15-day FREE TRIAL of AppDynamics Pro! http://pubads.g.doubleclick.net/gampad/clk?id=84349831iu=/4140/ostg.clktrk___ Resteasy-users mailing list Resteasy-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/resteasy-users
[Resteasy-users] Query on resteasy Interceptor
Hi folks, I am working on a poc using resteasy framework and resteasy's MessageBodyWriterInterceptor the resource looks like this @GET @Path(/{id}) public Response getUserDetails(@PathParam(id) String id); The business logic is implemented using a stateless ejb below is the implementation @Override public Response getUserDetails(HttpRequest request, String id) { - business logic --- ResponseBuilder builder = Response.ok()); return builder.build(); } The interceptor class code is mentioned below == @Provider @ServerInterceptor public class ResponseInterceptor implements MessageBodyWriterInterceptor{ private static final Logger logger = Logger.getLogger(ResponseInterceptor.class); ResponseBuilder builder = null; @Override public void write(MessageBodyWriterContext context) throws IOException, WebApplicationException { Object entity = context.getEntity(); logger.debug(Response interceptor: +entity.getClass()); if (entity != null) { if ( entity instanceof User){ User entls = (User)entity; if (entls !=null entls.getErrorCode()!=null) { if (entls.getErrorCode() == Status.BAD_REQUEST.getStatusCode()){ logger.debug(Response interceptor: +entls.getErrorCode()); throw new BadRequestException(Bad request,Response.status(400) .entity(entls).header(Bad request, 400) .type(application/xml) .build()); } My question are the following 1. Whether it's good to create all the response from the interceptor class i.e . for htpp 200, 40*, 50* etc..or we should handle only exceptional cases which are then Handel by the Exception mappers 2. What is the advantage of PostProcessorInterceptors over MessageBodyWriterInterceptor ? 3. Could you please provide some sample use case? 4. out of Resteasy interceptor and Ejb interceptor which one is good in terms of performance ? Thanks Regards BBSR -- Master HTML5, CSS3, ASP.NET, MVC, AJAX, Knockout.js, Web API and much more. Get web development skills now with LearnDevNow - 350+ hours of step-by-step video tutorials by Microsoft MVPs and experts. SALE $99.99 this month only -- learn more at: http://p.sf.net/sfu/learnmore_122812 ___ Resteasy-users mailing list Resteasy-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/resteasy-users