resteasy

Resteasy and fileupload: get no content-disposition error

本秂侑毒 提交于 2019-12-06 13:50:08
问题 I have a rest resource to which files can be uploaded. @Path("/rest/input") public class InputResourceBean { @POST @Path("{directory: .*}") @Consumes("multipart/form-data") public void post(final String directory, final MultipartFormDataInput input) { } I've used SOAPUI, curl and a HTML form to test this code and for all of them I get the same error: Could find no Content-Disposition header within part 12:55:19,739 WARN [org.jboss.resteasy.core.SynchronousDispatcher] Failed executing POST

Accessing @Local Session Bean from an exposed RESTeasy interface

烂漫一生 提交于 2019-12-06 13:32:19
What I am trying to do should be very straight forward BUT thus far has been impossible. Can someone tell me how to access a @Local Session Bean from an exposed RESTeasy interface? I have trawled the length and breadth of the internet and all I can find is variations of the same example I am trying to find out how I can access a session bean in the normal way using RESTeasy. This is what things look like so far: USING: EJB 3 RESTeasy 2.1 PUBLISHED EJB INTERFACE: @Local @Path("RequestReport") public interface EReport { @GET @Produces({"application/xml"}) @Path("request") public String

Unable to find contextual data of type: java.ws.rs.container.ContainerRequest (Wildfly error)

烂漫一生 提交于 2019-12-06 13:19:48
I am using wildfly 9.0.1.Final I am deploying a REST application which has an endpoint defined like this: @GET @Path("/view/products") @Produces(MediaType.APPLICATION_JSON) @CORSEnabled @Protected public String getConfiguredProducts( @Context ContainerRequestContext request) { if (request != null) { Integer companyId = (Integer) request.getProperty("company"); if (companyId != null) { //do stuff } } // ... more staff } When the application runs, the context is injected, i.e. 'request' is non null. When I try though to retrieve the property I get back the error: executing GET /complaints/view

How to develop authentication with resteasy?

試著忘記壹切 提交于 2019-12-06 12:14:32
问题 I'm making small web service(1) and I decided to use resteasy to make it. But I need to know what would be best practise to develop authentication with resteasy. And what kind of responses webservice should send? Are responses usually in XML or what format, and what format of XML response should be? Btw. I use jboss 4 and Java 5. http://www.assertionerror.com/2009/02/26/restful-web-services-with-resteasy/ (1) What technology I should use to develop small Java webservice? 回答1: Authentication:

Resteasy destroys filename encoding on multipart/form-data POST requests

寵の児 提交于 2019-12-06 11:47:15
问题 I do a fileupload to the following annotated Restservice @POST @Path("/uploadFile") @Consumes("multipart/form-data") public Response uploadFile(MultipartFormDataInput input) When special characters in the filename like "äÄöÖüÜß" are used, the filename gets corrupted during processing of Resteasy subsystem. I verified this by creating a Logginginterceptor @Provider @ServerInterceptor public class LoggingInterceptor implements PreProcessInterceptor Inside this interceptor, the http fileupload

Implementing a Locale provider that works in JSF and JAX-RS

荒凉一梦 提交于 2019-12-06 11:37:56
I've been joyfully using omnifaces' Faces.getLocale() to aquire the locale used by the currently logged in user (which in turn gets this from a <f:view> definition). I really like the fallback approach from view to client to system default locale as it fits the requirements for locale selection in my application: If a user is logged in, use his language preference (obtained from the backend entity) If no user preference can be found, use the highest ranking language from the Accept-Languages HTTP header If no locale has been selected by now, use the system default. Now I've started using JAX

should all dependencies be explicitily mentioned in child pom if the parent pom has Java EE BOM dependency?

自作多情 提交于 2019-12-06 10:59:24
问题 In our project, we have separate modules for REST layer, EJB layer and domain (Entity) layer. Here is the dependency on our REST layer: <dependency> <groupId>org.jboss.resteasy</groupId> <artifactId>resteasy-jaxrs</artifactId> <dependency> <groupId>org.jboss.resteasy</groupId> <artifactId>resteasy-jettison-provider</artifactId> </dependency> <dependency> <groupId>org.jboss.resteasy</groupId> <artifactId>resteasy-multipart-provider</artifactId> </dependency> <!-- Resteasy Server Cache -->

RESTEasy - Response with duplicated Cache-Control - Wildfly10

試著忘記壹切 提交于 2019-12-06 09:56:40
I have a GET response with an image: @GET @Path("{id}/thumbnail") public Response readThumbnailById(@PathParam("id") String id, @QueryParam("serviceContext") EIServiceContext serviceContext) throws BadRequestRestException { try { serviceContextServices.setFullContext(serviceContext); byte[] thumbnail = documentClientWebServices.readThumbnailById(id); CacheControl cc = new CacheControl(); cc.setMaxAge(2592000); cc.setPrivate(true); ResponseBuilder builder = Response.ok(thumbnail,"image/png"); builder.cacheControl(cc); return builder.build(); } catch (XECMException ex) { throw new

JAX-RS: Request validation using XSD, JAXB

三世轮回 提交于 2019-12-06 08:53:08
问题 Tech Stack : Java 1.6, JAXB, Spring 3, JAX-RS (RESTEasy) I've written a web service (REST) and now I want to validate the request using a schema. I've a working code as seen here for validation. My code looks like this: public abstract class AbstractValidatingReader<T> implements MessageBodyReader<T> { @Context protected Providers providers; private Schema schema; public AbstractValidatingReader() { .... } @SuppressWarnings("unchecked") @Override public boolean isReadable(Class<?> arg0, Type

JAX-RS + JBoss 7.1.1 + RESTEasy: NullPointException using CDI

流过昼夜 提交于 2019-12-06 06:48:36
问题 I'm developing a Java EE 6 solution and also trying to figure out the root cause of why the dependency injection is not working...NullPointerException inside my service (userDao line): REST Service @Path("rest") public class UserRESTService { @EJB UserDAO userDao; @GET @Produces({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON}) @Path("{type}") public String getJqGridData(@PathParam("type") String type) { System.out.println("type: " + type); List<USUARIO> usuarios = userDao.findAll();