-
Feature Request
-
Resolution: Done
-
Minor
-
None
-
None
-
None
here are some lines of code which basicly allow to wrap a dto objet in to a javascript method callback.
@Produces("text/javascript")
public class JsonpProvider implements MessageBodyWriter<Object> {
...
public void writeTo(final Object object, final Class<?> clazz, final Type type, final Annotation[] annotations,
final MediaType mediaType, final MultivaluedMap<String, Object> multivaluedMap, final OutputStream out)
throws IOException, WebApplicationException {
out.write(methodName);
if (clazz != null && !clazz.equals(Object.class)) {
MessageBodyWriter writer = providers.getMessageBodyWriter(clazz, type, annotations,
MediaType.APPLICATION_JSON_TYPE);
if (writer != null)
else
{ .... }} else
{ out.write(emptyJsonObject); } out.write(methodEnd);
}
}
This would work with annotating a method with @Produces(text/javascript). The only problem is the injection of the javascript method name. This could be configured in xml or by additional annotation.
- is related to
-
AEROGEAR-128 Research/Enable JSONP or CORS for the hosted version of the quickstart
- Resolved