resteasy

Display available REST resources in development stage

半腔热情 提交于 2019-12-24 07:35:16
问题 I was wondering wheather it's possible to output the available REST paths of a Java EE web app (war deplopyment) as a summary on a page. Of course, for security reasons only in development mode. Is there something available for this? Thanks 回答1: Here is a quick + dirty example which will return all paths for the scanned ResourceClasses: Path("/paths") public class PathResource { @GET @Produces(MediaType.TEXT_PLAIN) public Response paths(@Context HttpServletRequest request) { StringBuilder out

Compiler doesn't find a class I have as maven dependency

强颜欢笑 提交于 2019-12-24 07:25:39
问题 I have a code that has a dependency on the RESTEasy JAX RS Client I added it as a dependency to my project like this: <dependency> <groupId>org.jboss.resteasy</groupId> <artifactId>resteasy-client</artifactId> <version>3.0.8.Final</version> </dependency> I can write the code normally, but when I try to compile, I get these errors: java: cannot access javax.ws.rs.client.ClientBuilder class file for javax.ws.rs.client.ClientBuilder not found java: cannot access javax.ws.rs.core.Link class file

How to show browser login form for basic authentication using RESTEasy

十年热恋 提交于 2019-12-24 06:37:49
问题 I´m currently messing around with JAX-RS specifically Resteasy, because it "just works" with Wildfly and I don´t have to configure anything. That´s really the only reason I use that. I did already implement Basic Authentication, looking forward to replacing it with OAuth2 later, just did this now for simplicity reasons. The ContainerRequestFilter looks like this @Provider public class SecurityFilter implements ContainerRequestFilter { private static final String AUTHORIZATION_HEADER_KEY =

Max file size with resteasy and multipart/form-data request

隐身守侯 提交于 2019-12-24 04:23:45
问题 How can I control the max file size and/or the max request size when using resteasy to handle a multipart/form-data request ? My code looks like this: @POST @Path("/somerestresource") @Consumes(MediaType.MULTIPART_FORM_DATA) public Response handleForm(@MultipartForm MyForm form) { ... } With a Servlet I can control stuff with the @MultipartConfig annotation. So I'm thinking about bypassing resteasy and using @Context to inject a HttpServletRequest and having my servlet configured inside the

How to serve already gzipped content in JAX-RS?

余生长醉 提交于 2019-12-24 03:38:06
问题 I'm developing a small JAX-RS application with Resteasy. I wanted the application to serve some static content for Javascript and CSS files, etc. and I would like to take advantage of the already gzipped version of the resources packaged in the jars of webjars.org. Thus, I need to handle the Accept-Encoding header and check if the .gz is there (or not). So far, what I have is: @Path("res/{path:.*}") @GET public Response webjars(@PathParam("path") String path, @HeaderParam("Accept-Encoding")

Rest Services conventions

旧街凉风 提交于 2019-12-24 03:25:34
问题 In Rest Services,we normally use 'GET' requests when we want to retrieve some data from the server, however we can also retrieve data using a 'POST' request. We use 'POST' to create, 'PUT' to update, and 'DELETE' to delete, however we can even create new data using a 'DELETE' request. So I was just wondering what is the real reason behind for that, why these conventions are used? 回答1: So I was just wondering what is the real reason behind for that, why these conventions are used? So the world

how to set cookie for requests built via Resteasy Client API

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-24 03:22:38
问题 I am working on writing integration tests against web services that are annotated with JAX-RS annotations and secured with Spring Security. I use Resteasy Client proxy framework to generate proxies, from which I can invoke methods on to test the web services. For example, ResteasyClient client = new ResteasyClientBuilder().connectionPoolSize(10).connectionTTL(10, TimeUnit.SECONDS).build(); ResteasyWebTarget target = client.target(properties.getRestWebBaseUrl()); ProxyBuilder<UserClient>

Unable to startup RESTEasy Maven project through Tomcat7 Maven plugin (ExecutionException)

依然范特西╮ 提交于 2019-12-24 03:16:04
问题 I am working on a Maven Java project that uses RESTEasy 3.0.6.Final as its REST provider framework. Because this application will be deployed to AWS Elastic Beanstalk through its Tomcat 7 container, I have set up the project to use the Tomcat Maven Plugin as its local web container. I have the following relevant dependencies and plugins in my pom.xml file: <dependency> <groupId>org.jboss.resteasy</groupId> <artifactId>resteasy-jaxrs</artifactId> <version>${resteasy.version}</version> <

Rest back-end, Angular.js front-end lots of questions

非 Y 不嫁゛ 提交于 2019-12-24 02:56:10
问题 Okey, so time to build an webapplication using Jboss, restEasy as backend and i wanted to go for some MVC front-end framework like Angular.js. Never done this before so here is a million questions: Should i be using security roles in java or have my own security authentication and declare my own roles? J_security_check is wierd, it only prompts you to log in if you try to access a forbidden resource. Then it reroutes you to the login page. How can i use this with Angular? seems to me this can

JAX-RS + RESTEasy service return JSON String without double quote

喜你入骨 提交于 2019-12-24 02:16:06
问题 I'm new to JAX-RS + RESTEasy What is impeding me is that the service return the JSON String without double quotes. @Path("/hello") public class HelloService { @GET @Path("say") @Produces(MediaType.APPLICATION_JSON) public String say() { return "Hello"; } } When I call "/hello/say" it just returns Hello but what I'm expecting is "Hello" Googled for several days. I have a piece of Javascript using JQuery which calls the service like this: $(function(){ $.ajax({ url : "services/hello/say",