Uploaded image for project: 'Seam REST'
  1. Seam REST
  2. SEAMREST-49

String response not rendered by @ResponseTemplate

    Details

    • Type: Bug
    • Status: Open (View Workflow)
    • Priority: Major
    • Resolution: Unresolved
    • Affects Version/s: 3.0.0.Final, 3.1.0.Beta3, 3.1.0.Final
    • Fix Version/s: None
    • Component/s: Templating
    • Labels:
      None
    • Affects:
      Release Notes
    • Workaround:
      Workaround Exists
    • Workaround Description:
      Hide

      Add the following provider to your application:

      @Provider
      @Dependent
      public class SeamRest49Workaround implements MessageBodyWriter<String> {
       
         @Inject
         private TemplatingMessageBodyWriter delegate;
         
         @Override
         public boolean isWriteable(Class<?> type, Type genericType, Annotation[] annotations, MediaType mediaType) {
            return type.equals(String.class) && delegate.isWriteable(type, genericType, annotations, mediaType);
         }
       
         @Override
         public long getSize(String t, Class<?> type, Type genericType, Annotation[] annotations, MediaType mediaType) {
            return delegate.getSize(t, type, genericType, annotations, mediaType);
         }
       
         @Override
         public void writeTo(String t, Class<?> type, Type genericType, Annotation[] annotations, MediaType mediaType,
               MultivaluedMap<String, Object> httpHeaders, OutputStream entityStream) throws IOException, WebApplicationException {
            delegate.writeTo(t, type, genericType, annotations, mediaType, httpHeaders, entityStream);
         }
      }
      

      Show
      Add the following provider to your application: @Provider @Dependent public class SeamRest49Workaround implements MessageBodyWriter<String> {   @Inject private TemplatingMessageBodyWriter delegate; @Override public boolean isWriteable(Class<?> type, Type genericType, Annotation[] annotations, MediaType mediaType) { return type.equals(String.class) && delegate.isWriteable(type, genericType, annotations, mediaType); }   @Override public long getSize(String t, Class<?> type, Type genericType, Annotation[] annotations, MediaType mediaType) { return delegate.getSize(t, type, genericType, annotations, mediaType); }   @Override public void writeTo(String t, Class<?> type, Type genericType, Annotation[] annotations, MediaType mediaType, MultivaluedMap<String, Object> httpHeaders, OutputStream entityStream) throws IOException, WebApplicationException { delegate.writeTo(t, type, genericType, annotations, mediaType, httpHeaders, entityStream); } }

      Description

          @Path("string")
          @GET
          @Produces("text/plain")
          @ResponseTemplate("/string.ftl")
          public String string()
          {
              return "Jozef";
          }
      

      won't be rendered. "Jozef" is returned instead.

        Gliffy Diagrams

          Issue Links

            Activity

            Hide
            jharting Jozef Hartinger added a comment -

            Caused by a bug in RESTEasy. Works fine with GlassFish.

            Show
            jharting Jozef Hartinger added a comment - Caused by a bug in RESTEasy. Works fine with GlassFish.

              People

              • Assignee:
                jharting Jozef Hartinger
                Reporter:
                jharting Jozef Hartinger
              • Votes:
                0 Vote for this issue
                Watchers:
                2 Start watching this issue

                Dates

                • Created:
                  Updated:

                  Development