resteasy

RestEasy open html/jsp page

时光总嘲笑我的痴心妄想 提交于 2019-12-24 01:55:18
问题 There is a RestEasy method, which handles @GET requests. How is it possible to open a jsp/html page from that method? @GET @Path("/") public void getMainPage(){ //... } 回答1: HtmlEasy is a great tool to render jsp files through RestEasy. @Path("/") public class Welcome { @GET @Path("/welcome/{name}") public View sayHi(@PathParm("name") String name) { return new View("/welcome.jsp", name); } } See documents for all options. 回答2: Using org.jboss.resteasy.resteasy-html version 3.0.6.Final you can

How to manage state in JAX-RS?

送分小仙女□ 提交于 2019-12-24 01:46:54
问题 How do I configure JAX-RS 2 implementation (RESTEasy 3) to send the state of the application to the client? In JSF I am able to do it using the STATE_SAVING_METHOD parameter. Is there a standard way of doing it using JAX-RS? <context-param> <param-name>javax.faces.STATE_SAVING_METHOD</param-name> <param-value>client</param-value> </context-param> Just an example to illustrate my problem, I would like to configure the JAX-RS provider to return the cart variable state to the client, in that way

JBoss AS 7 Restful Webservices not auto deploying

我与影子孤独终老i 提交于 2019-12-24 00:49:06
问题 I'm trying to use the built in Restful WebServices with JBoss AS 7. My web.xml is.. <?xml version="1.0" encoding="UTF-8"?> <web-app xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" version="2.5"> </web-app> My application class is... package com.robert; import javax.ws.rs.ApplicationPath; import javax.ws.rs.core.Application; import java.util

java.lang.ClassCastException:Jboss resteasy logging

谁都会走 提交于 2019-12-23 21:19:37
问题 I am using Jboss7.0.1 Final to deploy my web application, But I don't want to use default Resteasy jar provided by Jboss so I made the changes in jboss-deployment-structure.xml <jboss-deployment-structure> <deployment> <!-- Exclusions allow you to prevent the server from automatically adding some dependencies --> <dependencies> <module name="javaee.api"> <imports> <exclude path="org/apache/xml/security/**" /> </imports> </module> <module name="com.mrf.portal.configuration" /> <module name=

Resteasy client in Jboss AS 7.1 throws java.lang.ClassNotFoundException: com.sun.ws.rs.ext.RuntimeDelegateImpl

一笑奈何 提交于 2019-12-23 20:09:37
问题 I have a RestEasyClient which initialize as follows and uses the Jboss AS 7.1 resteasy module @PostConstruct public void initializeClient() { log.info("In initializeClient"); HttpClient httpClient = new DefaultHttpClient(); ClientExecutor executor = new ApacheHttpClient4Executor(httpClient); ResteasyProviderFactory.getInstance().registerProvider( ServiceExecutionInterceptor.class); clientService = ProxyFactory.create(MyProjectClientService.class, getWebserviceURL(), executor); } This throws

How to set CORS headers into internal server error responses?

邮差的信 提交于 2019-12-23 14:42:08
问题 I have a java application server with a REST interface provided by resteasy and I have the CORS filter bellow @Provider public class CORSFilter implements ContainerResponseFilter { public void filter(ContainerRequestContext cReq, ContainerResponseContext cResp) { cResp.getHeaders().add("Access-Control-Allow-Origin", "*"); cResp.getHeaders().add("Access-Control-Allow-Headers", "origin, content-type, accept, authorization, auth-token"); cResp.getHeaders().add("Access-Control-Allow-Credentials",

How to set CORS headers into internal server error responses?

纵然是瞬间 提交于 2019-12-23 14:41:48
问题 I have a java application server with a REST interface provided by resteasy and I have the CORS filter bellow @Provider public class CORSFilter implements ContainerResponseFilter { public void filter(ContainerRequestContext cReq, ContainerResponseContext cResp) { cResp.getHeaders().add("Access-Control-Allow-Origin", "*"); cResp.getHeaders().add("Access-Control-Allow-Headers", "origin, content-type, accept, authorization, auth-token"); cResp.getHeaders().add("Access-Control-Allow-Credentials",

Jackson 2.3.2: Issue with deserializing a Date despite of setting the date format to ObjectMapper

僤鯓⒐⒋嵵緔 提交于 2019-12-23 08:07:57
问题 I am using rest easy and want to serialize and deserialize dates. After creating my json provider, Serializing is working fine but deserializing is still not working. My JsonProvider class: @Provider @Produces(MediaType.APPLICATION_JSON) public class JsonProvider extends JacksonJaxbJsonProvider { public JsonProvider() { ObjectMapper mapper = new ObjectMapper(); mapper.setSerializationInclusion(JsonInclude.Include.NON_NULL); mapper.configure(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS,

Autowiring a spring managed bean in the resteasy providers

假如想象 提交于 2019-12-23 04:55:05
问题 I have a developing a webservice where in i need to validate a particular httpheader sent in the request against the database. I want to use RestEasy provider for doing the same as the same functionality needs to be applied to all the service. @Provider @ServerInterceptor public class TestValidationInterceptor implements PreProcessInterceptor { @Autowired DetailsDelegate detailsDelegate; @Override public ServerResponse preProcess(HttpRequest request, ResourceMethod method) throws Failure,

Getting Spring 4 dependency injection working with RESTeasy 3 validator

末鹿安然 提交于 2019-12-23 04:46:00
问题 I have been running into a lot of trouble trying to get custom Bean Validation constraints to successfully leverage Spring's dependency injection. For example I might define a constraint: @Constraint(validatedBy = { CustomConstraintValidator.class }) @Documented @Target({ ElementType.METHOD, ElementType.FIELD, ElementType.CONSTRUCTOR, ElementType.PARAMETER }) @Retention(RetentionPolicy.RUNTIME) public @interface CustomConstraint { String message() default "custom.constraint.error"; Class<?>[]