jersey

How can I integrate Jersey with TomEE?

若如初见. 提交于 2019-12-24 13:57:55
问题 I attempt to deploy a very simple RESTful Web Service using Jersey 1.18 within Tomee 1.5.2 WebProfile. My project is fully inspired from the tomee-jersey-eclipselink example that I further simplified by removing the persistence part: the Web Service simply retuns "Hello, World!" @Path("/hello") @RequestScoped public class HelloService { public HelloService() { } @GET public String test() { return "Hello, World!"; } } My dependencies in my POM: <dependencies> <dependency> <groupId>javax<

Cannot load connection class because of underlying exception: 'java.lang.NumberFormatException: For input string: “OPENSHIFT_MYSQL_DB_PORT”'

天涯浪子 提交于 2019-12-24 13:43:07
问题 I am trying to deploy my Jersey project on openshift. I have implemented this apple class to test the error in the another class since I guess the problem is with the establishing the database connection. in the Tails log I found this error: Connecting to database… com.mysql.jdbc.exceptions.jdbc4.MySQLNonTransientConnectionException: Cannot load connection class because of underlying exception: 'java.lang.NumberFormatException: For input string: "OPENSHIFT_MYSQL_DB_PORT"'. at sun.reflect

load on startup and Jersey

梦想的初衷 提交于 2019-12-24 13:18:50
问题 Possibly duplicate of Servlet not loading on startup, however Im not allowed yet to comment, so I have to start a new question for this... Same setting, having a servlet using Jersey and Tomcat, using load-on-startup for loading the container. However, due to the thread mentioned above, I understand that this only load the Jersey container but not the classes I setup for the servlet. So, related to what is implied in the answer of the thread above, how is it done that not only the contained

404 error, Jersey 2.x on tomcat 8

自闭症网瘾萝莉.ら 提交于 2019-12-24 13:04:24
问题 I'm working on my first RESTful Api with Jersey 2.x and tomcat 8 but when I try to acceed to my Resources I keep getting a 404 errors. this is my web.xml : <?xml version="1.0" encoding="UTF-8"?> <web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://xmlns.jcp.org/xml/ns/javaee" xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd" id="WebApp_ID" version="3.1"> <servlet> <servlet-name>com.pj.api.application.Application<

Jersey HTTP response 200 OK but returning content wrong (username/password incorrect)

六眼飞鱼酱① 提交于 2019-12-24 12:24:21
问题 I was wondering if I wrote the Jersey client side code in the correct way. The log-in page is supposed to redirect to main page after correct username and password input, with server side returning an empty string ( "" ). If either is incorrect, server side code returns "Username or Password are incorrect" . The page functionality worked well but when I was testing using my client side code using a correct pair of username and password, it returns "Username or Password are incorrect" , with

jersey webservice returns a 415 when executing a PUT from Ext.Ajax.request

只谈情不闲聊 提交于 2019-12-24 11:58:44
问题 So, I've got a pretty simple RESTful jersey webservice, and I'm wanting to call it from my javascript code. I have no problem executing a GET request, but for some reason, when I execute a PUT, I get back a "415 Unsupported Media Type" error. Any idea what I'm doing wrong? Here's my webservice : package servlet; import javax.ws.rs.Consumes; import javax.ws.rs.GET; import javax.ws.rs.PUT; import javax.ws.rs.Path; import javax.ws.rs.Produces; import javax.ws.rs.core.MediaType; import javax.xml

ContainerRequestFilter wont run in JavaEE jersey project

好久不见. 提交于 2019-12-24 11:54:11
问题 Am new to JavaEE and have some issues getting custom ContainerRequestFilter to run in Jersey. I read the jersey documentation some more and created a new clean project straight from the ' jersey-quickstart-webapp ', added the filter seen below but no luck (added an empty beans.xml as well). import javax.ws.rs.container.ContainerRequestContext; import javax.ws.rs.container.ContainerRequestFilter; import javax.ws.rs.container.PreMatching; import javax.ws.rs.core.Response; import javax.ws.rs.ext

Unable to retrieve security context from within Spring-Jersey

感情迁移 提交于 2019-12-24 11:45:00
问题 I am trying to retrieve a security context within my spring-jersey bean, however I keep getting Null authentication. When I run the same command from within my spring application it correctly retrieves the current logged in users security context. The configuration of spring-jersey requires creating a separate servlet to the main spring application, thus the web.xml has two servlet's - one for spring app, second for jersey rest api. Assuming the problem is related to this, I tried setting the

Rendering a new .jsp page using JAX-RS UriBuilder

僤鯓⒐⒋嵵緔 提交于 2019-12-24 11:28:03
问题 I am simply trying to send a new .jsp page to be rendered by the client using the URIBuilder. So I have a main.js send a POST to the server which calls logIn(). For now I just want this to send a new .jsp file to the client to be rendered. Nothing happens thus far, I have tried using different file paths - before I just used "Feed.jsp" as the file path. I feel like there is more to this that I am not picking up on. Here is my main.js file. It sends a POST to server successfully via the logIn(

Jersey deserializing JSON when using local jersey HttpServer

纵然是瞬间 提交于 2019-12-24 11:24:53
问题 I'm trying to create a webservice using a Jersey HttpServer instead of Tomcat. The server is working when using simple GET request or plaintext, but when I try to send JSON objects I only get a server answer telling me that the media type is not supported (HTTP Error 415). I think the problem is, that the JSON objects can't be deserialized like it's described in this post. But as I'm using a locally created HttpServer the solution of this answer didn't work for me. So the question is: How can