Questions tagged [jax-rs]
JAX-RS: Java API for RESTful Web Services. It is an API that provides support in creating web services according to the REST architectural style.
7,702
questions
1
vote
1
answer
28
views
setting default encoding to utf-8 on OpenLiberty jax-rs for POST requests
I have a REST application that works fine for GET/PUT/DELETE but NOT for POST requests.
GET/DELETE consume @PathParametes, POST consumes APPLICATION_FORM_URLENCODED, and PUT consumes the request body ...
-1
votes
1
answer
32
views
java.lang.NoSuchMethodError: boolean org.glassfish.jersey.internal.config.SystemPropertiesConfigurationModel.hasProperty(java.lang.String)
<dependency>
<groupId>jakarta.platform</groupId>
<artifactId>jakarta.jakartaee-api</artifactId>
<version>9.1.0</version>
<scope>provided</scope>
&...
-1
votes
0
answers
124
views
Wiremock issue when upgrading to java 17
We have our application using Spring Boot 2.7 with Java 8. It's a restful service that uses JAX-RS with Jersey for implementation. I am now trying to move to Java 17 and the Application is working as ...
1
vote
0
answers
51
views
How to configure two separate Jersey servlet containers for individual endpoints
I am implementing the following two Jersey servlets in the server side:
<servlet>
<servlet-name>DocService</servlet-name>
<servlet-class>org.glassfish.jersey....
0
votes
0
answers
37
views
JAX-RS Provider randomly acts server-wide
I need some help understanding how Resteasy messes up my registered Providers
I have 2 services, lets call them Scheduler and Process.
Process has a ClientRequestFilter annotated with @Provider that ...
-1
votes
0
answers
20
views
java.lang.AbstractMethodError: javax.ws.rs.core.UriBuilder.uri(Ljava/lang/String;)Ljavax/ws/rs/core/UriBuilder during API request from front to back
Bonjour,
Lorsque je fais un appel API de mon frontend vers mon backend, j'ai l'erreur suivante :
<html>
<head>
<title>Grails Runtime Exception</title>
<style type=&...
0
votes
0
answers
35
views
Cannot Return CompletableFuture<ResponseEntity> From Spring POST Request
I am trying to return ResponseEntity from a post request after doing an asyncronous operation on spring boot server. This is simplified version of what i am doing:
@POST
@Consumes({ MediaType....
0
votes
1
answer
19
views
How do I restrict acces to all my APIs to one user role and only allow other on a few of them in JAX-RS?
This is my Jersey Application Config:
@ApplicationPath("/ui/v1.0")
@RolesAllowed("admin")
public class AppConfig extends ResourceConfig {
public AppConfig() {
System....
0
votes
0
answers
26
views
RolesAllowedDynamicFeature not invoked in Jersey
My Jakarta Application class is:
@ApplicationPath("/app")
@RolesAllowed("admin")
public class Application extends ResourceConfig {
public Application() {
System.out....
0
votes
0
answers
27
views
JAX-RS: Multiple ExceptionMappers handling the same Exception
We have two version of APIs in a monolith architecture. Each one of them has a GenericExceptionHandler which extends JAX-RS's ExceptionMapper. Once I bind the ExceptionMappers as providers for the ...
0
votes
0
answers
16
views
JAX RS Resource that proxies requests?
How can I build a JAX RS Resource that proxies requests and responses? -- that is I can forward request and response bodies, possibly changing minor details like headers
Have tried forwarding requests ...
-1
votes
0
answers
39
views
Using CDI in JAX-RS resource
I am working on a small app in which i am trying to build a Rest api using JAX-RS.
I have this resource class, i which i am trying to unject the UserPersistenceService using the Inject annotaion from ...
0
votes
0
answers
24
views
Why is Jersey not seeing my new endpoint method?
I have a SpringBoot/JAX-RS service that has been working fine for a while. I'm trying to add a temporary endpoint method to one resource class with existing endpoint methods. For some reason, Jersey ...
0
votes
0
answers
19
views
RESTEazy and text answer for @Valid error instead JSON
I use in my project EJB and RESTEazy. I have fallowing method:
boolean save(@Valid Data data);
in response I get status 400 and body:
[PARAMETER]
[save.arg0.xyz]
[xyz must be 13 characters length and ...
0
votes
1
answer
93
views
Testcontainers JAX-RS integration test not working as expected
I am recently working on a small app in jax-rs just to get familiar with it, and I am trying to write integration tests using test containers.
The app is deployed on a tomcat container having the ...
0
votes
1
answer
45
views
Wildfly returns 405 for all preflight requests
I have a web application deployed on Widfly (27.0.1), and a VueJS client that tries to call a REST endpoint in this application. Because I was getting this error (Access to XMLHttpRequest at 'http://...
0
votes
0
answers
13
views
IllegalStateException: STREAMED when I try to read the POST request body using OSGI's JAX-RS Whiteboard Resource
I have created a JAX-RS Whiteboard resource for a REST API, a Jaxrs Extension which uses Jackson to serialize/deserialize data, and I want to read some data which will be sent using POST method.
In ...
0
votes
0
answers
32
views
Tomee MultipartProvider didn't consider body as readable
During my java migration (8 to 17), I experienced some problems with Tomee plus 8.0.15 (inderectly Apache CXF, cxf shade 3.5.5).
In my application, I use multipart/form-data in some requests, because ...
0
votes
0
answers
43
views
Is there a way to have @Alternate class for an interceptor class implementing ContainerRequestFilter annotated with @Provider in Quarkus?
In Quarkus:
There is class implementing ContainerRequestFilter annotated with @Provider like below:
@Provider
public class RequestInterceptor implements ContainerRequestFilter {
@Override
...
1
vote
1
answer
90
views
javax.ws.rs.ClientErrorException: HTTP 404 Not Found on Websphere 9 using Swagger
I have a JAX-RS application running into Websphere 9.0 using Swagger.
We catch the stacktrace below. Does anyone have any idea on how to resolve?
StackTrace
javax.ws.rs.ClientErrorException: HTTP 404 ...
0
votes
0
answers
19
views
NoSuchMethodFoundException when including a REST API with multipart
I have a Payara server and run a Java EE web application via Intellij on it. I also want to include an API (I did not choose the REST service template, as I want the project to be a web application). ...
0
votes
1
answer
30
views
JAX-RS cannot handle a Authorization header with a JWT
*Possibly a duplicate but cannot find it lol*
I'm using Quarkus with quarkus-resteasy and I'm trying to implement a simple GET method that will syso the headers, but before that, I needed to create a ...
0
votes
0
answers
180
views
Guacamole 1.5.3 on Tomcat 10 throws java.lang.NoSuchMethodError: 'void jakarta.servlet.http.HttpServletResponse.setStatus(int, java.lang.String)'
This is the error in the logs when ran the guacamole
org.apache.catalina.core.StandardWrapperValve.invoke Servlet.service() for >
java.lang.NoSuchMethodError: 'void jakarta.servlet.http....
0
votes
0
answers
63
views
Where to put google-services.json file (that has API keys) in a Spring Boot application?
I am trying to understand the resources directory in a Spring Boot application and if it is the correct place to place my google-services.json file.
Are the files put in the resources folder visible ...
0
votes
0
answers
34
views
Interceptor not wrapping JAX-RS sub-resource endpoint methods
Payara 5, Jersey 2.37, JAX-RS 2.1
I'm attempting to create a logging "transaction," where a REST endpoint (either sub-resource method or terminal endpoint - I'll demonstrate both below) is ...
0
votes
0
answers
39
views
Streaming data - Heap OOM, JAX-RS
I am trying to stream data from a JCR (Jackrabbit) workspace. The data I want to stream is a bunch of file chunks stored in jcr nodes (main node - file, subnodes - chunks). The chunks are base64 ...
0
votes
1
answer
102
views
Using JAX-RS on Tomcat 10.1
I am trying to migrate from Tomcat 9 to Tomcat 10.1 and my RESTful Webservices are not working anymore. I researched and I found out, that jakarta replaced javax. Which is fine, if it would be a quick ...
0
votes
0
answers
21
views
ContainerRequest Response abortWith aborting and not providing response
I have implemented Container Request and created filter method and i am trying to abort in case of authorization failure. I see that the application stops as expected but it is not returning any ...
0
votes
1
answer
220
views
How to make PATCH request using Jersey client?
WebTarget target = client.target(url); client.property(HttpUrlConnectorProvider.SET_METHOD_WORKAROUND,true);
Response response = target
.request(MediaType....
0
votes
1
answer
42
views
Shared class with @Provider annotation
I have three quarkus apps:
MyApplesRestApp
MyBananasRestApp
MyTomatoesRestApp
Those apps reuse some of the classes in a shared common library FruitServicesLib.
In MyApplesRestApp, I have a ...
1
vote
1
answer
53
views
JAX-RS Apache CXF vs Jersey implementations. Encoding
Just wondering if such a code shouldn't return the same using different implementation of JAX-RS? I'm not really into Java.
import java.util.*;
import javax.ws.rs.client.Client;
import javax.ws.rs....
0
votes
0
answers
36
views
Getting request entity in Jersey's ClientRequestFilter
My application is using Jersey client and I want to deploy it on AWS and access resources that require request authentication using AWS SigV4.
I have looked at client code examples specific to the ...
0
votes
0
answers
12
views
How to find the complete local url of a Jaxrs API in Springboot?
I have implemented an API but no matter what url I have tried it does not work. Here is a related post of this API. Is there any way I can make SpringBoot to print me the url of this API?
What the ...
0
votes
0
answers
109
views
Jersey 3 does not work with Tomcat 10 and return 404
I am having application that use Tomcat 10.
Java 17
My build System is Gradle.
I am trying to use Jersey 3 Servlet
My web.xml config:
<servlet>
<servlet-name>jersey-servlet</...
0
votes
0
answers
27
views
CDI dependency injection not working in JAX-RS resource
I'm building a REST API using JAX-RS framework for a school project but for some reason the CDI doesn't work, when I manually create a new instance of a class everything works as it should but when I ...
1
vote
0
answers
17
views
How to do integration testing of Jaxrs Resource?
I am designing Rest API using jax-rs and want to do integration testing of end point.
For that, I am using following piece of code.
Service Layer
public class TimeService {
public long time() {
...
0
votes
0
answers
45
views
Apache CXF Jaxrs Webclient, GET request JSON Payload
According to the API documentation, the request should be structured as follows:
{
"productType": "string"
}
which is I believe,
"{\"productType\": \"string\&...
0
votes
1
answer
120
views
java.lang.IllegalArgumentException: The implementation class org.glassfish.jersey.inject.hk2.RequestContext must be in the Singleton scope
I am upgrading a Tomcat web applications from Tomcat 9.0.78 to 10.0.14 and moved all my imports from the javax.servelet name space to jakarta.servelt name space and have also upgraded hibernate.
While ...
0
votes
1
answer
263
views
Howto map a given external type with Openapi codegen into a generated model class
I'm using Openapi 3.0.3 with openapi-generator-maven-plugin 6.6.0 and the jaxrs-spec generator.
I have to map a given type external to the API from a given external library in my schema definition, I ...
0
votes
2
answers
28
views
Cannot get the name of zip file created by jersy api
I created jersey rest post api with spring boot to return a zip file with such a filename, with postman i can download the zip file but not with real filename and in the response headers i can't find ...
0
votes
0
answers
43
views
Custom enpoint dont work in Keycloak v 21.1.2
How to make custom endpoints for a keyclock? I did as in this project from the Key clock developers: https://github.com/keycloak/keycloak/tree/main/examples/providers/rest
Then I put the jar in the ...
0
votes
1
answer
48
views
JAX-RS (or Quarkus) reverse routing with subresources
I have a ContainerRequestFilter that gathers some metrics for each endpoint invoked in my JAX-RS/Quarkus application. This requires access to the URI patterns as specified in the @Path annotations on ...
0
votes
1
answer
77
views
jakarta.ws.rs.core.SecurityContext throws exception when testing in Quarkus
Custom class that has jakarta core @Context SecurityContext throws following exception:
Method threw 'java.lang.IllegalStateException' exception. Cannot evaluate jakarta.ws.rs.core....
0
votes
1
answer
70
views
Should I reuse SseEventSink or leave it open in JAX-RS?
I have a JAX-RS SSE endpoint:
@Path("/")
@ApplicationScoped
public class RestRepo {
@Context
private Sse sse;
// Would it be possible to share an EventSink from different ...
0
votes
0
answers
17
views
How to obtain query arg from Dropwizard's /healthcheck HTTP call?
Dropwizard's doc shows how a service can define a healthcheck that can be called with :
https://<hostname>:<port>/health-check?type=<type>&name=<name>
But I can not find in ...
0
votes
3
answers
75
views
ExceptionHandler does not handle exception
I'm making a RestApi in Spring boot. I tried to add exception handling so the client gets meaningful response other than 404.
This is my RestController:
@Path("/v1")
@Consumes(MediaType....
0
votes
0
answers
9
views
Running a REST service on a different port as part of same server
I have application server using guice for dependency injection and jaxrs for REST.
public final class MyWebServer {
public void start() {
...
}
public static void main(String[] args) {
/...
0
votes
0
answers
101
views
@ApplicationPath not recognized in spring boot 3 + jakarta
I'm using Spring boot 3.1.2. I try to extend jakarta.ws.rs.core.Application with custom implementation but the @ApplicationPath is not recognized.
Also the controller with @Path (jakarta.ws.rs.Path) ...
0
votes
0
answers
76
views
Swagger with OpenApi
I have a project with 2 parts of request / WS, part1 and part2
I wrote 2 yamel part1 and part2 with Swagger Editor, and now I would like to host my Swagger on the tomcat on local until production, ...
0
votes
2
answers
52
views
Cannot deserialize value of type `java.lang.Long` from Object value (token `JsonToken.START_OBJECT`) in JAX-RS PUT Endpoint
I'm getting an error that no matter what I try doesn't seem to get fixed. In my eyes everything looks correct. This is my service for the endpoint
@PUT
@Path("/{bookId}")
public ...