Questions tagged [javax.ws.rs]

54 questions
55
votes
2 answers

What are the default values for @QueryParam when @DefaultValue is not specified?

For example, having the following Java rest definition: @GET @Path("/something") public String somthing( @QueryParam("valString") String valString, @QueryParam("valInt") int valInt, @QueryParam("valBool") boolean valBool ) { ... } And…
AlikElzin-kilaka
  • 34,335
  • 35
  • 194
  • 277
9
votes
5 answers

Spring request mapping with regex like in javax.ws.rs

I'm trying rewrite this Google App Engine maven server repository to Spring. I have problem with URL mapping. Maven repo server standard looks like this: URL with slash at the end, points to a folder,…
Artur Węgrzyn
  • 171
  • 1
  • 2
  • 7
7
votes
1 answer

Passing @Context argument to method in class

I have an existing class I'm trying to hook into to get some header parameters to SSO a user into our system. The class is as follows. import java.util.Map; import javax.ws.rs.GET; import javax.ws.rs.Path; import javax.ws.rs.Produces; import…
Matt Busche
  • 14,216
  • 5
  • 36
  • 61
4
votes
1 answer

uri.getQueryParameters() method converting "+" Character with space

Problem is like uri.getQueryParameters() method is converting Character(+) into space which I am trying to avoid. Below is the uri before "http://localhost:8081/service/linear/test/?id=test+QYY" after uri.getQueryParameters() will remove the +…
3
votes
1 answer

semicolon in the restful service URL truncate the characters after it

I have the below code as my restful service operation. @GET @UnitOfWork @Timed(name = "get-requests") @Path("/{referenceId}") public Response get(@Auth @ApiParam(access = "internal") UserPrincipal user, @ApiParam(name…
Laodao
  • 1,547
  • 3
  • 17
  • 39
3
votes
1 answer

How to allow slashes in path param in jax-rs endpoint

I have an endpoint as: @Path("/products") @Produces({ MediaType.APPLICATION_JSON }) public interface Products { @PUT @Path("/{productId}") .... } I have a jax-rs client implemented for this service and have it…
San Kay
  • 91
  • 2
  • 8
3
votes
1 answer

How to model the representation of the REST spec in java classes?

I'm not talking about using the REST classes, like @Path or @POST. I'm talking about how to translate any REST definition into a model of classes - A model from which many things can be done, like generating client code or parsing incoming data. A…
AlikElzin-kilaka
  • 34,335
  • 35
  • 194
  • 277
2
votes
3 answers

How start my application as server from console?

In IntellIJ IDEA I start my Kotlin project like server. Here my run config: Nice. It's start on port 3333. I use this classes for server import javax.ws.rs.GET import javax.ws.rs.Path import javax.ws.rs.Produces import javax.ws.rs.QueryParam import…
Alexei
  • 14,350
  • 37
  • 121
  • 240
2
votes
2 answers

How test javax Response.readEntity(Class type)?

We're using javax.ws.rs.core.Response.readEntity(Class type) to parse JSON responses into POJOs. I want to write tests to assure that the entity is correctly mapped into the POJO - so if a boolean "valid" is true in the json, it is also true in the…
oyvind.s
  • 232
  • 1
  • 15
2
votes
1 answer

How to get plain XML from javax.ws.rs Entity on client side

I have a REST client that creates a XML entity via Entity.entity(myObject, MediaType.APPLICATION_XML_TYPE). After that, I call webTarget.request().buildPost(... How can I get the request body XML that my client will send to the server? (I need it…
Sebastian
  • 5,721
  • 3
  • 43
  • 69
2
votes
1 answer

Request to web services restful with pojo object and method post

I created a restful web service: @POST @Path("grd") @Consumes("application/json") @Produces("text/plain") public String guardarDato(PostParams jsonObject) { /* something here } PostParams is a pojo: public class PostParams { private final …
2
votes
2 answers

Convert InboundJaxrsResponse to json string

I am trying to serialize a jax-rs Response to json string. The response from the server is json, and I get it from jersey client with: Response resp = target.request().method("PUT", Entity.json(payloadBean)) where payloadBean is my json request.…
stelios
  • 2,679
  • 5
  • 31
  • 41
2
votes
1 answer

@QueryParam boolean gets false even though 'true' was passed

Invoking a REST with a boolean parameter receives the value false even though passing true on the client…
AlikElzin-kilaka
  • 34,335
  • 35
  • 194
  • 277
1
vote
1 answer

Sending Text/CSV file by an POST API call from Java using Jersey

I want to send a file as part of my request Body by making a POST request. The content-type of file is text/csv. I am creating a MultiPart but there is no option to send a text/csv file. I tried creating a custom content-type - text/csv but it is…
1
vote
1 answer

Response is NULL when calling response.getStatus, is client not targeting what's in the webservice?

My webservice resource that expects a GET: @GET @Produces(MediaType.APPLICATION_JSON) @Path("/status") public Response checkNode() { boolean status = !NlpHandler.getHandlerQueue().isEmpty(); status = status ||…
resolute
  • 171
  • 2
  • 11
1
2 3 4