Questions tagged [jersey]

1

votes
1

answer
829

Views

Maven dependecy for LoggingFilter in Jersey

What dependency must be added to pom.xml for class org.glassfish.jersey.filter.LoggingFilter? I try to add artifactId jersey-common and jersey-client from org.glassfish.jersey.core but in thats not exist this class.
user1929959
1

votes
1

answer
4.2k

Views

How do I render a new .jsp file in the browser using Jersey for java?

My site goes to a login page that I want to redirect to another page when the user logs in. I have a 'POST' method that sends the 'username' and 'password' to the server and the server checks if the username and password exist. Here is my method @POST @Path('logIn') public void signIn(@PathParam('p...
theGuy05
1

votes
1

answer
3k

Views

getting Invalid byte tag in constant pool : 19

i am creating one webservice and getting error like org.apache.tomcat.util.bcel.classfile.ClassFormatException: Invalid byte tag in constant pool: 19. i am using tomcat 8.0 and java versoin is 1.8.0.152.
Vishal
1

votes
1

answer
281

Views

First Dynamic Web Project

I have gone through a tutorial to program a Rest Webservice in Java 8, Jersey and Tomcat 8.5. So far everything has gone smoothly. I was able to build my project in maven. However when I try to deploy it I am getting the following error. Dec 28, 2017 9:11:53 AM org.apache.catalina.core.ApplicationCo...
Kai78
1

votes
1

answer
79

Views

Using GraphQL strictly as a query language

I think that my problem is a common one, and I'm weighing the costs and benefits of GraphQL as a solution. I work on a product whose data is stored by a monolithic CRUD-based REST API. We have components of our application expose a search interface for data, and of course need some kind of server-s...
lyonssp
1

votes
1

answer
230

Views

Maven Dependencies for Jersey @Context

I am trying to get the HttpServletRequest from a jersey ContainerRequestFilter, using @Context as follows: import javax.ws.rs.core.Context; import javax.ws.rs.ext.Provider; @Provider public class MyFilter implements ContainerRequestFilter { @Context protected HttpServletRequest httpRequest; @Overrid...
user1052610
1

votes
1

answer
240

Views

Spring REST equivalent of ContainerRequestContext

What is a Spring equivalent of Jersey's ContainerRequestContext? I am trying to get the SecurityContext (.getSecurityContext()) like we can from a ContainerRequestContext. Does spring-mvc have something similar?
user9176614
1

votes
0

answer
245

Views

Keep Alive Timer called close() error between jersey servers, using TLS

I have a multimodule Jersey project, where at some point in serving a request a Gateway module will talk to another Gateway module (this is the 'service discovery' part of the communication) on another PC. This communication works well, but when the code execution gets to the next request where thes...
Zoltán Umlauf
1

votes
0

answer
21

Views

Jersey SubResource is slow

I've not been able to understand why this sub-resource is taking so much. The problem is that it takes around 2 minutes to pass from EventResource#getAttendeeSession() to AttendeeSessionResource#getAttendeeSessions() Taking a look in debug mode, the time is spent in Stages.class specifically in the...
esteban rincon
1

votes
0

answer
144

Views

HK2 Custom InterceptionService to intercept REST endpoints not working

I have below sample jersey application, where i have used HK2 to intercept rest endpoints having custom annotations to validate header. But it seems REST endpoint is never getting intercepted While debugging i could see the endpoint class is not scanned by MyInterceptionService class. @Target({Elem...
Raghu
1

votes
0

answer
256

Views

Apply filter in the rest services methods with @NameBinding

I am trying to apply authentication to a few methods of rest services. So apply the annotation @NameBinding for reference to the class of the filter that will validate the authentication, but when doing the test the service passes the filter (it never enters to validate) showing 'El msn es...', when...
ssan92
1

votes
0

answer
104

Views

Correct way to instrument a Jersey client

My goal is to instrument a Jersey client to collect data on HTTP response/execution time, and I had thought I had the right approach by implementing a JAX-RS ClientRequestFilter and a ClientResponseFilter with code in each to record the start and end of the request. However when used with code like...
hayduke
1

votes
0

answer
265

Views

Optional path-parameter in jersey 2.6 sub-resource without constant-part-path

I have 2 almost identical sub-resources: @GET @Path('/{device}/{property}') @Produces(MediaType.APPLICATION_JSON) public Response getParameterValue(@PathParam('device') final String device, @PathParam('property') final String property) { ... } and @GET @Path('/{device}/{property}/{field}') @Produce...
Meziane
1

votes
0

answer
287

Views

error deploying Jersey+Weld webapp on Tomcat 8 or Jetty 9

I am getting the following error while deploying a webapp with jersey 2.2.6 and weld 2.4.6-Final Caused by: java.lang.NoSuchMethodError: org.jboss.weld.util.Preconditions.checkNotNull(Ljava/lang/Object;)V at org.jboss.weld.util.collections.ImmutableHashSet.(ImmutableHashSet.java:78) at org.jboss.we...
Saasira
1

votes
0

answer
1.3k

Views

MessageBodyWriter not found for media type=application/octet-stream, type=class java.io.ByteArrayOutputStream

I have a Jersey Server, where I send an OutputStream of data on GET request. The data stream will be consumed on the client side. I am getting the following error on the server side: org.glassfish.jersey.message.internal.WriterInterceptorExecutor$TerminalWriterInterceptor aroundWriteTo SEVERE: Messa...
Yash Shrivastava
1

votes
0

answer
212

Views

PowerMock fails with JerseyTest

We're writing unit tests for a Jersey Java REST service using PowerMock. We have to use PowerMock because we use numerous static methods in a legacy system. We're using PowerMock with EasyMock. Whenever we try to inherit from JerseyTest, the whole framework fails. It's a gradle based project, and th...
Frecklefoot
1

votes
1

answer
285

Views

Jersey ignores unrecognized values in POST request body

Currently when inputting a json object as the body of a POST request, Jersey will ignore any key/value pairs that it does not recognize. Example: public class TestObject{ private String value1; private Integer value2; // appropriate getters and setters } JSON object: { 'value1':'test', 'value2':1,...
Stitch86
1

votes
1

answer
228

Views

Jax RS & Jersey with Junit; Test case is ignored

I can't get Jersey to work with Junit. Can anyone help here? I don't know what else to do. I'm using my tomcat server, and when I run the project, I right-click the folder and select 'run on server.' After this is done, I am able to use a post-client in my web browser to use the web service and it w...
Geth V
1

votes
2

answer
329

Views

Jersey2: Consumes APPLICATION_FORM_URLENCODED and MULTIPART_FORM_DATA together

I'm using Jersey the first time. I just want my service accepts both APPLICATION_FORM_URLENCODED and MULTIPART_FORM_DATA post form, just like that in Django or php. Even better, I want the APPLICATION_JSON can also works. So I tried the code below in my UserResource class: @POST @Consumes({MediaType...
Alfred Huang
1

votes
0

answer
450

Views

Jersey Tomcat CDI dependencies explanation needed

After much trial and error, I was able to create a Jersey application with DI enabled. This is what I have in the pom.xml file: org.glassfish.jersey jersey-bom 2.26 pom import org.glassfish.jersey.inject jersey-hk2 org.glassfish.jersey.containers jersey-container-servlet org.glassfish.jersey.core je...
Jan Bodnar
1

votes
0

answer
102

Views

EclipseLink in Jersey Test Framework blocking test

I'm trying to write some integration tests for a SCIM client implementation and EclipseLink has me blocked. The SCIM User schema includes a nested Email object. Email has a field called 'type'. This is part of the standard and is not a discriminator field. However, EclipseLink apparently has deci...
Chad Vincent
1

votes
1

answer
70

Views

MarkLogic Java API overwrite jersey RuntimeDelegate

When using MarkLogic Java API, Any other piece of code that try to use jersey client will load MockRuntimeDelegate class of MarkLogic package which cause NPE. the ML pom: com.marklogic marklogic-client-api 4.0.3 jersey client use (Scala code): val webResource: WebResource = Client.create(new Default...
Yaniv Hadad
1

votes
0

answer
97

Views

Jersey Jackson DoesNot Serialize Subclass

Hi I am creating a restful service using Jersey. To return the result I need to convert to json format. I have a parent and child class where only parent class values are sent but child class is not getting serialized. Parent Class - @JsonTypeInfo(use = Id.CLASS, include = JsonTypeInfo.As.PROPERTY,...
Mojoy
1

votes
0

answer
355

Views

Glassfish 5, Grave: Exception during lifecycle processing org.glassfish.deployment.common.DeploymentException

he tried to start a jsf application on a glassfish 5.0 server with java 8, but now I try to start the program and this error occurs, I have tried several things even adding some jersey libraries. I do not understand why this error occurs to me, the truth is that I have searched a lot through interne...
1

votes
1

answer
678

Views

Exclude path params from actuator metrics

I have a Spring boot application that uses the actuator metrics and I have the following issue: I have an endpoint like this : GET /users/{userId} So every time I call this endpoint I use a different Id to get the specific user as you can think we can have hundreds of thousands. It is working cor...
1

votes
0

answer
897

Views

Jersey, An I/O error has occurred while writing a response message

I use SpringBoot and Jersey into my project and I often tackle the following error : [ERROR - ServerRuntime$Responder - 2018-02-13 13:16:45,983] An I/O error has occurred while writing a response message entity to the container output stream. org.glassfish.jersey.server.internal.process.MappableExce...
Charly berthet
1

votes
0

answer
71

Views

compress responses in EJB GZip and Jersey 1.6?

I wish to selectively compress responses for certain apis. I found this very nice article explaining exactly what i needed : gzip compression with jax-2x However, my application uses JAX-1.6 (I have worked with Spring, life was easy, until i have to work with EJB-Jersey now). How can I achieve the s...
Sachin Sharma
1

votes
0

answer
222

Views

Create HTML from Velocity vm - how do you use CSS?

I write a REST based webapp (for Tomcat) and return HTML created from a Velocity template through JAX-RS (Jersey). I would like to use CSS in the HTML and do not know how to properly reference the external CSS file (which resides in the war). My Velocity template is in /src/main/webapp in the folder...
JF Meier
1

votes
0

answer
30

Views

How to know the domain:port of a web application on ServletContextListener contextInitialized method?

I need to know the domain:port of a web application made with JSP and jersey on a tomcat server. I need to know it when the application starts, that is on ServletContextListener contextInitialized() method. There is a way to obtain it? Thank you so much
NullPointerException
1

votes
0

answer
36

Views

JSP + JERSEY web aplication… better to use static methods or instances?

I have a jsp java web application which uses jersey on a tomcat server and this app must be live for months/years executing threads and maintaining live some objects. What whould be moren efficient and safe? to use static methods on the jersey calls or to use instanced objects initialized on Servlet...
NullPointerException
1

votes
0

answer
37

Views

NoClassDefFoundError when a method invoked using init() extending HttpServlet on tomcat startup

I have a Jersey Restful webservice which is running on Tomcat 9. My requirement is to execute a method periodically every 2 min; for that I have a class called 'LoadModels' which extends TimerTask and will run every 2 min when I do the below timer.schedule(new LoadModels(), date.getTime(), 1000 * 2...
Hruday
1

votes
1

answer
43

Views

Jersey rest api not working on compute engine tomcat 7

jersey rest api service is working fine on localhost tomcat7 but when i trying to deploy on tomcat8 on google compute engine it is not working i even tried with tomcat7 also but still 404 resource not found (it working fine on localhost tomcat7) plz help me:( here is my web.xml RestTest Hello.jsp ja...
redhilll
1

votes
0

answer
80

Views

404 error with Jersey REST service on Tomcat9

So I am trying to create a REST service using Jersey 2.25 which is to run on Tomcat 9. I am using gradle as build tool. Basically, I am following this vogella tutorial and I did everything as mentioned there. But, when I try to run it on tomcat9 by visiting http://localhost:8080/com.krozona.jersey.f...
Kshitij Tiwari
1

votes
1

answer
454

Views

CORS Error is coming for multipart/form-data in Jersey API

I am trying to upload a excel file but CORS error is coming in Jersey API.I am calling the API from angular 4 with multipart/form-data headers and added a filter for each incoming request to JAVA Rest API. Find the code below and help me out: Angular API CALLING: export class DboperationService { pr...
Nishant Varshney
1

votes
1

answer
231

Views

Custom application class setup for Swagger with a Jersey ResourceConfig

I am following steps as per the Jersey 2.X Project Setup guide(https://github.com/swagger-api/swagger-core/wiki/Swagger-Core-Jersey-2.X-Project-Setup-1.5#using-a-custom-application-subclass). I'm running into a problem with the 'Custom Application' subclass, which provides the sample code below: pub...
Venkateswarlu Raju
1

votes
0

answer
32

Views

Nested time out handler is not working in Jersey AsyncResponse

I am trying to do the following for a Jersey async endpoint: set a timeout and a timeout handler for the response in case of a timeout, set a new handler and attempt to generate the response again finally if the response fails, return a 503 While trying to simulate this scenario, I noticed that the...
zakaria amine
1

votes
0

answer
49

Views

Exception in PortForwarder when adding swagger support to org.glassfish.jersey.server

I am trying to add swagger support to javax rest apis and ended up having the following exception. Any insights will be helpful. Exception in thread 'PortForwarder' java.lang.NoSuchMethodError: org.apache.commons.lang3.Validate.inclusiveBetween(JJJ)V at com.offbynull.portmapper.mappers.upnpigd.exter...
Minisha
1

votes
1

answer
325

Views

Inject value into Jackson converter/deserializer

I'm porting a legacy API to Java from a Ruby app that takes full advantage of not being statically typed. In one such situation, the API accepts from the JSON body a user_id that is either a numeric user ID or the string 'me', (which should be converted to the ID of the user making the request befo...
Matt
1

votes
1

answer
245

Views

How to Upload Multiple files using jQuery to java controller

Hy all, i am trying to create a workaround because of a jersey bug. The jersey truncating the slashes from filename. So i would like to send my files up by another way. For 1 file i found a solution, this: function extractFilename(s){ // returns string containing everything from the end of the stri...
Pető Endre
1

votes
2

answer
697

Views

REST client Content-Type header throws UnsupportedOperationException

I am developing a REST client to connect to an external server, which I do not have access to. I've been able to successfully stablish communication using Postman and SOAPUi, and now I'm trying with Java (org.glassfish.jersey.client.ClientResponse), but to no avail, because whenever I include 'Conte...
Nelson Lopes

View additional questions