resteasy

Root element name in collections returned by RESTEasy

风流意气都作罢 提交于 2019-11-30 22:12:24
问题 I'm using JAX-RS via RestEasy in JBoss AS 6. When my JAX-RS resource returns a collection of items (e.g. via a List), RESTEasy always uses the name collection as the root element. E.g. <collection> <item> <description>computer</description> <price>2500</price> </item> <item> <description>tv</description> <price>1500</price> </item> </collection> This XML is generated by e.g.: @Produces("application/xml") @Path("xml") @RequestScoped public class MyResource { @GET @Path("myitems") public List

Hosting Static Content and JAX-RS Services Under the Same Root Context

不问归期 提交于 2019-11-30 21:26:17
We have multiple Java web apps packaged as WARs all packaged in an EAR. Our RESTful services are built using JAX-RS and in version specific WARs. We'd like to add static content for each of these version specific WARs, but use the root context (of the WAR) for both the static content and the RESTful service API calls, such that all of the following URLs will work: {hostname}/v1/swagger.yaml <-- Static Content describing the v1 API {hostname}/v1/orders/{uid} <-- JAX-RS RESTful API (v1) {hostname}/v2/swagger.yaml <-- Static Content describing the v2 API {hostname}/v2/orders/{uid} <-- JAX-RS

How configure Spring-Boot app to continue to use RestEasy?

ぐ巨炮叔叔 提交于 2019-11-30 20:39:53
I have an old web application (pure servlet, without Spring) that I want to run as fat-jar. This app provides a lot of REST services. I don't want to modified old code. How configure Spring-Boot app to continue to use RestEasy? Fabio You can use RESTEasy Spring Boot starter. Here is how you do it: Adding POM dependency Add the Maven dependency below to your Spring Boot application pom file. <dependency> <groupId>com.paypal.springboot</groupId> <artifactId>resteasy-spring-boot-starter</artifactId> <version>2.1.1-RELEASE</version> <scope>runtime</scope> </dependency> Registering JAX-RS

How to make Spring Security application to run behind a proxy?

本小妞迷上赌 提交于 2019-11-30 19:45:10
We have an application build on Java 1.6 with Spring 3.0.3 that use Spring Security 3.0.5 and implements REST API using Spring Web with RestEasy 2.1.0. I need to place this application (server) behind a proxy that would translate HTTPS request traffic from a REST API Client application into HTTP traffic. This change creates a “cross domain” scenario for login request : Client sends HTTPS request for login, and Server answers with redirect URL of HTTP. Currently it responses with: ”http://192.168.0.10:8090/index.html;jsessionid=64FD79...86D” , what I need here is: ”/index.html;jsessionid=64FD79

Using JAXB to pass subclass instances as superclass

只愿长相守 提交于 2019-11-30 18:42:51
What I have is a set of Java classes (close to 25) representing message types. They all inherit from a Message class which I'd like to be abstract. Each message type adds a few additional fields to the set provided by the Message superclass. I'm implementing some RESTful web services using RESTeasy and would like to have methods like this: public Response persist(Message msg) { EntityTransaction tx = em.getTransaction(); tx.begin(); try { em.persist(msg); } catch (Exception e) { e.printStackTrace(); } tx.commit(); em.close(); return Response.created(URI.create("/message/" + msg.getId())).build

Resteasy with Google App Engine

北城以北 提交于 2019-11-30 16:15:35
I have a working Rest web service that use JBoss Resteasy however when I tried to port it to use GAE I'm getting this error when executing: java.lang.ClassNotFoundException: org.jboss.resteasy.plugins.server.servlet.ResteasyBootstrap I used resteasy successfully on GAE. As csturtz mentioned make sure your project has the resteasy dependency. If yo uare using Maven this should be something like: <dependency> <groupId>org.jboss.resteasy</groupId> <artifactId>resteasy-jaxrs</artifactId> <version>${resteasy.version}</version> </dependency> And optionally you also would like to use: <dependency>

Resteasy with Google App Engine

眉间皱痕 提交于 2019-11-30 16:11:21
问题 I have a working Rest web service that use JBoss Resteasy however when I tried to port it to use GAE I'm getting this error when executing: java.lang.ClassNotFoundException: org.jboss.resteasy.plugins.server.servlet.ResteasyBootstrap 回答1: I used resteasy successfully on GAE. As csturtz mentioned make sure your project has the resteasy dependency. If yo uare using Maven this should be something like: <dependency> <groupId>org.jboss.resteasy</groupId> <artifactId>resteasy-jaxrs</artifactId>

RestEasy Jax-RS in Jboss 7.1 doesn't work

南笙酒味 提交于 2019-11-30 15:08:26
问题 I'm trying to deploy a simple web application under JBoss AS 7.1 which comes bundled with resteasy. According to the documentation all that is needed is (at bare minimum) is an empty web.xml , a class with annotated @ApplicationPath("/mypath") and @Path("/other_stuff") for your other classes The documentation I'm following is here: https://docs.jboss.org/author/display/AS7/JAX-RS+Reference+Guide https://docs.jboss.org/author/display/AS7/Java+API+for+RESTful+Web+Services+(JAX-RS) Still, when I

@JsonIgnore and @JsonBackReference are being Ignored

故事扮演 提交于 2019-11-30 14:12:24
问题 I'm working with RestEasy, Jboss 7 and EJB 3.1. I'm creating a RESTful web service that returns data in JSON format. The problem is that I have a @ManyToOne relationship on one of my entities which causes an infinite recursion during serialization. I tried using Jackson's @JsonIgnore and @JsonBackReference annotations to fix the problem but it seems as if they are being totally ignored and the infinite recursion is still occurring. This is my User Class: class User { private String userId;

javax.ws.rs.NotFoundException: Could not find resource for full path

五迷三道 提交于 2019-11-30 13:37:55
Environment Windows 7(64) jdk1.7.0_51(64) RESTEasy3.0.7 apache-tomcat-7.0.50 Project Name: hello RESTEasyHelloWorldService.java: package com.javacodegeeks.enterprise.rest.resteasy; import javax.ws.rs.GET; import javax.ws.rs.Path; import javax.ws.rs.PathParam; import javax.ws.rs.Produces; import javax.ws.rs.core.MediaType; @Path("/RESTEasyHelloWorld") public class RESTEasyHelloWorldService { @GET @Path("/{param}") @Produces(MediaType.TEXT_PLAIN) public String getMsg(@PathParam("param") String name) { String msg = "Rest say: good " + name; return msg; } } web.xml: <web-app xmlns:xsi="http://www