jersey

App-engine: JAX-RS with Jersey no working

眉间皱痕 提交于 2019-12-11 23:25:38
问题 I created a standard google app engine project. I added Jersey for REST support. For some reason that dont works. I added to WEB-INF/lib and the classpath: jersey-bundle-1.17.1.jar my web.xml is: <servlet> <servlet-name>Jersey Web Application</servlet-name> <servlet-class>com.sun.jersey.spi.container.servlet.ServletContainer</servlet-class> <init-param> <param-name>com.sun.jersey.config.property.packages</param-name> <param-value>com.co.traelo.servicios.cotizacion</param-value> </init-param>

Java REST - Correct parameters for JQuery multipart/form-data file upload?

人盡茶涼 提交于 2019-12-11 23:20:37
问题 We've come across a problem in our websites file upload functionality for Safari 5.x. JQuery normally sends the file to the REST service as a File with the correct Content-Type (e.g. image/png) assigned, however with Safari 5.x it appears it can only send it as "multipart/form-data" I've tried adding the new endpoint to accept this via both Jersey and RestEasy, but I have had no success. I believe the problem is simply that I'm having trouble determining what the parameters should be. No

Log Jersey entity as JSON as response

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-11 23:20:15
问题 I'm a Jersey newbie and I need to log the JSON response. I wish to take the entity and convert it to JSON exactly as done by the Jersey framework does (same mapper, etc.). Is there a way to extract its mapper (and call, for example, its writeValueAsString)? 回答1: You don't specify which package you use for producing the JSON response (neither you explain much about your jersey server), but I will assume you use Jackson . You have some tracing in Jersey, take a look here, but as fas as I know

How to communicate to a RESTful Webservice in Android Client

妖精的绣舞 提交于 2019-12-11 23:09:21
问题 I have developed a rest webservice using ( Java + Jersey )... the service needs to communicate with the user i.e. the user needs to fill a form in android client app and send it back to rest webservice where it will be processed and accordingly the user will get the output... When i first made the rest webservice i had used a webclient...and so was able to send and recieve request in form parameters as "post" and "get"... But how to do the same in android as there is no form tags which have

jQuery not POSTing URL arguments to Jersey service?

被刻印的时光 ゝ 提交于 2019-12-11 22:54:24
问题 This seems so simple, but I can't figure out why it doesn't work. I have a Jersey service defined: @POST public SomeObject createSomeObject( @QueryParam("firstParam") String firstParam, @QueryParam("secondParam") String secondParam) { // Does stuff, returns the object. } Now, if I do a simple curl , it works fine: curl -X POST "http://localhost:8080/path/to/service?firstParam=Bleh&secondParam=Blah However, the following results in null for firstParam and secondParam in the Java: $.ajax({ url:

HIbernate doesn't throw exception or show errors

*爱你&永不变心* 提交于 2019-12-11 22:41:49
问题 I'm developing a small REST web server with Jersey and Hibernate. Along the way I've encountered some weird behaviour on behalf of Hibernate. Namely, when trying to Session.save() an object after POST request from curl, the server replies with 500, but I don't see any error in the command window. But when I toggle a breakpoint and do a step over the cursor runs inside some of the jars in the dependencies, where I eventually track down the error message. Still it doesn't show it anywhere. How

Java swagger with JaxRS throwing errors

自作多情 提交于 2019-12-11 21:19:01
问题 I followed the guide found here: https://github.com/wordnik/swagger-core/wiki/Java-JAXRS-Quickstart Here is my POM: <!-- SWAGGER --> <dependency> <groupId>com.wordnik</groupId> <artifactId>swagger-jersey-jaxrs_2.10</artifactId> <version>1.3.0</version> </dependency> The Annotations are found fine, so i am assuming the POM is working OK For WEB.xml, I tried doing multiple things, following the guide: <servlet> <servlet-name>jersey-serlvet</servlet-name> <servlet-class> com.sun.jersey.spi

How to set Accept header on the server side in Jersey 1.x for an incoming request

随声附和 提交于 2019-12-11 20:22:50
问题 I would like to know if there is a way to set the "Accept" headers for an incoming request on server side. This is possible to do in Jersey 2.x by implementing and registering a @prematching ContainerRequestFilter but I have not found a way to achieve the same in Jersey 1.x versions. The idea is to set an "Accept" header that is understood by '@Produces' annotation on a resource method. I am trying to handle a use case where the client cannot set an "Accept" header. So he specifies the kind

Embedded jetty & jersey, works with Jersey 2.7, exception with 2.9

▼魔方 西西 提交于 2019-12-11 20:15:56
问题 I'm trying the examples on: How to embed Jetty and Jersey into my Java application https://nikolaygrozev.wordpress.com/2014/10/16/rest-with-embedded-jetty-and-jersey-in-a-single-jar-step-by-step If I run this with Jersey 2.7 (and Jetty 9.2.5.v20141112), it works. If I update Jersey to 2.9 (or 2.14), it fails on startup with: WARN 2015-01-18 17:02:13,076 e.jetty.util.component.AbstractLifeCycle:212 - FAILED org.eclipse.jetty.server.Server@1741055a: java.lang.NoSuchMethodError: org.glassfish

How to route JAX-RS request conditionally, depending on the suffix?

走远了吗. 提交于 2019-12-11 20:14:27
问题 This is what I'm trying to do: @Path("/finder") public class Finder { @Path("/{name}") public Proxy find(@PathParam("name") String name) { Object found = /* some object found by name */ return new Proxy(found); } } public class Proxy { private Object obj; public Proxy(Object found) { this.obj = found; } @GET @Path("/") public String info() { return /* some meta-information about the object */ } @Path("/") public Object passthru() { return this.obj; } } I'm trying to enable: GET /finder/alpha