[seam-issues] [JBoss JIRA] Updated: (SEAMREST-49) String response not rendered by @ResponseTemplate

Jozef Hartinger (JIRA) jira-events at lists.jboss.org
Wed Aug 24 03:49:17 EDT 2011


     [ https://issues.jboss.org/browse/SEAMREST-49?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Jozef Hartinger updated SEAMREST-49:
------------------------------------

    Workaround Description: 
Add the following provider to your application:

{code:JAVA}
@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);
   }
}
{code}
                Workaround: [Workaround Exists]
           Forum Reference: http://seamframework.org/Community/SeamRESTJAXRSResponseTemplate#comment165171  (was: http://seamframework.org/Community/SeamRESTJAXRSResponseTemplate#comment165171)


> String response not rendered by @ResponseTemplate
> -------------------------------------------------
>
>                 Key: SEAMREST-49
>                 URL: https://issues.jboss.org/browse/SEAMREST-49
>             Project: Seam REST
>          Issue Type: Bug
>          Components: Templating
>    Affects Versions: 3.0.0.Final
>            Reporter: Jozef Hartinger
>            Assignee: Jozef Hartinger
>
> {code:JAVA}
>     @Path("string")
>     @GET
>     @Produces("text/plain")
>     @ResponseTemplate("/string.ftl")
>     public String string()
>     {
>         return "Jozef";
>     }
> {code}
> won't be rendered. "Jozef" is returned instead.

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

        


More information about the seam-issues mailing list