jax-rs

403 Status (Forbidden) when PUT and DELETE using AJAX

最后都变了- 提交于 2019-12-18 16:55:36
问题 I've implemented a small REST API using JAX-RS (Jersey 2.0) and I'm using AJAX to call the API, GET and POST work fine but when I get to call any PUT or DELETE methods, all I get is the following error message: Failed to load resource: the server responded with a status of 403 (Forbidden) Here's an example of a DELETE method in Java: @Path("/deleteSomething") @DELETE @Consumes("application/json") public void delete(String json) throws ParseException { JSONParser parser = new JSONParser();

AsynchronousDispatcher error

限于喜欢 提交于 2019-12-18 14:18:48
问题 i am getting the error when i try to upload a file based exactly off the example shown here Sample The error is Allocate exception for servlet com.testapp.rest.JaxRsActivator: java.lang.RuntimeException: Unable to find a public constructor for class org.jboss.resteasy.core.AsynchronousDispatcher What can this mean? 回答1: If deploying to JBoss 7.x you need to change the scope of your resteasy dependencies to provided . This is because those particular libraries are already included in JBoss as

AsynchronousDispatcher error

谁都会走 提交于 2019-12-18 14:17:02
问题 i am getting the error when i try to upload a file based exactly off the example shown here Sample The error is Allocate exception for servlet com.testapp.rest.JaxRsActivator: java.lang.RuntimeException: Unable to find a public constructor for class org.jboss.resteasy.core.AsynchronousDispatcher What can this mean? 回答1: If deploying to JBoss 7.x you need to change the scope of your resteasy dependencies to provided . This is because those particular libraries are already included in JBoss as

Combining Google proto buffers with Jersey/JAX-RS

醉酒当歌 提交于 2019-12-18 12:57:08
问题 Currently I have a RESTful web service with endpoints that are exposed via Jersey/JAX-RS: @Path("/widgets") public class WidgetResource { @GET List<Widget> getAllWidgets() { // gets Widgets somehow } @POST Widget save(Widget w) { // Save widget and return it } } I use Jackson for serializing/deserializing my POJOs into JSON, and my service both responds to and sends back my POJOs as application/json . I am now looking to possibly use Google protocol buffers (or an equivalent technology) to

Can I use @RolesAllowed on RESTful Resources implemented on Apache CXF?

前提是你 提交于 2019-12-18 12:47:06
问题 My question is "Can I use @RolesAllowed on RESTful Resources implemented on CXF ?" . First of all, I explain the context causing this question. I'm working at some projects in which developers have to remake one part of the some web systems into RESTful WEB Apis.This present system has server system built by Spring and Hibernate . And its client application as UI is developed by ActionScript through FLEX framework . Now I'm surveying the proper way to design and remake our present system into

Add Response Header to JAX-RS Webservice

江枫思渺然 提交于 2019-12-18 11:48:43
问题 I am trying add some response headers to some of my webservice calls. I wrote my webservice using CXF 2.1.2 and JAX-RS. I need to return an object and I also want to add some headers to the Response. Without returning a javax.ws.rs.core.Response object , how do I add a header to the response and still return my javabean? 回答1: You can inject a reference to the actual HttpServletResponse via the @Context annotation in your webservice and use addHeader() etc. to add your header. 来源: https:/

Custom HTTP status response with JAX-RS (Jersey) and @RolesAllowed

流过昼夜 提交于 2019-12-18 11:07:52
问题 With my very simple JAX-RS service I'm using Tomcat with JDBC realm for authentication, therefore I'm working the the JSR 250 annotations. The thing is that I want to return a custom message body in the HTTP status response. The status code (403) should stay the same. For example, my service looks like the following: @RolesAllowed({ "ADMIN" }) @Path("/users") public class UsersService { @GET @Produces(MediaType.TEXT_PLAIN) @Consumes({MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML})

Integrating Jetty with JAX-RS-Jersey

Deadly 提交于 2019-12-18 10:24:14
问题 After an exhaustive search of the web and Stackoverflow, I am still stuck with trying to figure out how to integrate a RESTlet style interface provided by Jersey with Jetty. I have my Jetty server up and running and as such Jersey seems pretty easy to use as well, does anyone know how to tie the two together? Any concrete links would help — I am a little new to servlet programming as well. 回答1: I created an app using Jetty and Jersey a while back. It's just a standard webapp really: web.xml:

Spring MVC REST is not JAX-RS compliant. Does it matter? [closed]

孤街浪徒 提交于 2019-12-18 10:21:18
问题 Closed . This question is opinion-based. It is not currently accepting answers. Want to improve this question? Update the question so it can be answered with facts and citations by editing this post. Closed 6 years ago . I've had good experience with Spring MVC REST with a couple of solid projects delivered. My question is about JAX-RS compliance. Does it matter because Spring is here to stay and I don't foresee (nor have a reason to) having to move away from Spring MVC REST to Jersy or any

Case-insensitive URLs with JAX-RS

淺唱寂寞╮ 提交于 2019-12-18 07:45:19
问题 Is there any easy way to provide a case-insensitive URLs in a JAX-RS web service? The goal of this is to produce a web service which is a "lenient acceptor." 1 I imagine it's possible to do this with a filter which .to[Lower|Upper]Case() s all incoming URLs. Unfortunately, this implementation demands programmer discipline/consistency in making sure that all hard-coded URL strings in the application are strictly [lower|upper]case. Also, I don't yet know the JAX-RS analog to a servlet filter.