jax-rs

RSA keys keys static generation

二次信任 提交于 2019-12-25 07:27:24
问题 I'm guiding myself with this answer over here, which explains how to use both AES and RSA. I managed to successfully implement the AES part with an util class in which I use a passphrase to generate keys. This passphrase will not change, the purpose of this is to encrypt a password before encoding it and saving it to a database. Then whenever I need to decrypt this password I can do it with the same passphrase, which should generate the same key. I've got this working. Now my question begins

post json to java server

扶醉桌前 提交于 2019-12-25 06:59:55
问题 I've been googleing a bit around internet looking for a (correctly) way to @Consume an "application/json" file in a web resource on my server. I'm using glassfish app server, so it's a java resource. here is the calling javascvript code: var url="/MBC/pages/lives/"; var mygetrequest=new ajaxRequest(); mygetrequest.onreadystatechange=function(){ if (mygetrequest.readyState==4){ if (mygetrequest.status==200 || window.location.href.indexOf("http")==-1){ var render=""; var JsonIn =JSON.parse

JAX-RS rest services working fine. How to add JSP pages? Stuck with configuration

你离开我真会死。 提交于 2019-12-25 05:24:10
问题 I have some rest services running already, using cxf-rt-frontend-jaxrs 2.7.7 /myservice/customers /myservice/items My rest service provides 2 endpoints: @Component public class CustomerService { @GET @Path("customers") @Produces({MediaType.APPLICATION_JSON}) public ... getCustomers() { ... } @GET @Path("items") @Produces({MediaType.APPLICATION_JSON}) public ... getItems() { ... } } This works great, and now I would like to add some jsp pages. I've read about Redirecting requests and serving

Restlet - Jax-RS 2.0 aware?

匆匆过客 提交于 2019-12-25 05:22:44
问题 I saw that Restlet already has a stable 2.0 Version and even further testing and unstable 2.1 and 2.2 version. Are they already JAX-RS 2.0 aware? If its true, they seem to be further in the JAX-RS implementation than the jersey jax-rs reference framework. 回答1: Restlet Framework (RF) versions are not synced at all with JAX-RS versions. Currently RF 2.1 only supports JAX-RS 1.0. Note however that we have added (non standard) JAX-RS client-side support in RF 2.1 via the org.restlet.ext.jaxrs

Jackson Deserializer not being called for @*Param

做~自己de王妃 提交于 2019-12-25 04:23:14
问题 Im trying to use JsonDeserialzer on a jax path parameter. Here is my @BeanParam object, @BeanParam private CustomerWrapper reference; @QueryParam("select") private String select; @QueryParam("count") private boolean count; @BeanParam PaginationInfo paginationInfo; @BeanParam private SortingInfo sortingInfo; @QueryParam("line") private String line; @QueryParam("typeCode") private String typeCode; class CustomReference { @NotNull @PathParam("profileReferenceId") @Encoded private String

How to use the same ContainerRequestFilter for multiple projects?

谁说我不能喝 提交于 2019-12-25 03:39:10
问题 I have two projects A and B in which B has dependency on A. So all the classes of A are available to B. Now, I've defined a ContainerRequestFilter for intercepting some information from request. This is getting invoked if I call the end points of project A. But it's not getting invoked if I call end points of project B. Obviously, the context roots of project A and project B are different. Example: http://localhost:8080/projecta/..... http://localhost:8080/projectb/..... Both the projects are

how to return json objects from java rest api

冷暖自知 提交于 2019-12-25 03:34:17
问题 I am trying to return a JSON object from a jax-rs but I get an internal server error whenever I try to access. This is my method, I am using javax.ws.rs.GET . @GET @Produces("application/json") public Testy getJson() { return new Testy("hello"); } This is the class: public class Testy { private final String value; public Testy(String value){ this.value = value; } public String getValue(){ return value; } } My Pom.xml has this dependency, I have tried various dependencies, but none work. There

jaxrs variable @Path

可紊 提交于 2019-12-25 02:57:08
问题 I have a method annotated with jax-rs like this @POST @Path("/somepath") public Response testPost(...) I would like to use instead of "/somepath" a java string constant (retrieved from configuration). Is that possible? I know that I can do @Path({somepath}) and then use @PathParam to replace it but that's a different use case where the caller passes a dynamic param. 回答1: In java, annotation parameters must be compile-time constants. Thus, you will not be able to use configuration retrieved

How to send response as JSON in Jersey Rest

前提是你 提交于 2019-12-25 02:48:54
问题 I have Jersey Rest Webservice with server side code as @GET @Produces({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON}) public List<Employee> getEmployees() { return new EmployeeService().getEmployees(); } T I am testing the service from chrome rest client. This works fine with Accept: application/xml ** But when I am requesting this with code Accept: application/json I am getting the following exception:- javax.servlet.ServletException: org.glassfish.jersey.message.internal

JAX-RS compliant implementation on mobile devices

不打扰是莪最后的温柔 提交于 2019-12-25 01:36:11
问题 I'm writing an application that should run on both desktop and mobile and it needs to communicate with a server using REST. I'm Using Gluon Mobile. The code I write on the client side is jax-rs-compliant and looks like this: import javax.ws.rs.client.Client; import javax.ws.rs.client.ClientBuilder; import javax.ws.rs.client.WebTarget; import javax.ws.rs.core.Response; Client client = ClientBuilder.newBuilder().build(); WebTarget target = client.target("http://www...").path("/login/...");