Ticket #863 (closed Task: worksforme)

Opened 5 years ago

Last modified 5 years ago

dm4-webservice: if module not present plugin developers loose provider classes

Reported by: Malte Owned by: jri
Priority: Major Milestone: Release 4.8
Component: DeepaMehta Standard Distribution Version: 4.7
Keywords: Cc:
Complexity: 3 Area: Application Framework / API
Module: deepamehta-webservice

Description

Aim:
Deactivate all DM 4 Core REST endpoints provided through dm4-webservice to have full control over all RESTful I/O to my deepamehta4 application.

Problem:
Provider classes for de/serialization of POJOs to JSON Objects are missing, in example one cannot return a RelatedTopic? or Lists thereof in one custom endpoint.

Question:
Can 3rd-party developers simply create and register their own MessageBodyWriters? or is there another, better way?

Change History

comment:1 Changed 5 years ago by Malte

For the reason of completeness/clearness of thsi ticket-description. When i deactivate the dm4-webservice module via the gogo shell and reload my application the exception is:

Nov 09, 2015 9:18:26 PM com.sun.jersey.spi.container.ContainerResponse logException
SEVERE: Mapped exception to response: 500 (Internal Server Error)
javax.ws.rs.WebApplicationException: com.sun.jersey.api.MessageException: A message body writer for Java class de.deepamehta.core.service.ResultList, and Java type de.deepamehta.core.service.ResultList<de.deepamehta.core.RelatedTopic>, and MIME media type application/json was not found  
        at com.sun.jersey.spi.container.ContainerResponse.write(ContainerResponse.java:285)
        at com.sun.jersey.server.impl.application.WebApplicationImpl._handleRequest(WebApplicationImpl.java:1448)
        at com.sun.jersey.server.impl.application.WebApplicationImpl.handleRequest(WebApplicationImpl.java:1360)
        at com.sun.jersey.server.impl.application.WebApplicationImpl.handleRequest(WebApplicationImpl.java:1350)
        at com.sun.jersey.spi.container.servlet.WebComponent.service(WebComponent.java:416)
        at com.sun.jersey.spi.container.servlet.ServletContainer.service(ServletContainer.java:538)
        at com.sun.jersey.spi.container.servlet.ServletContainer.service(ServletContainer.java:716)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:848)
        at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:684)
        at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:503)
        at org.ops4j.pax.web.service.jetty.internal.HttpServiceServletHandler.doHandle(HttpServiceServletHandler.java:69)
        at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:137)
        at org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:557)
        at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:231)
        at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1086)
        at org.ops4j.pax.web.service.jetty.internal.HttpServiceContext.doHandle(HttpServiceContext.java:240)
        at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:429)
        at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:193)
        at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1020)
        at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:135)
        at org.ops4j.pax.web.service.jetty.internal.JettyServerHandlerCollection.handle(JettyServerHandlerCollection.java:77)
        at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:116)
        at org.eclipse.jetty.server.Server.handle(Server.java:370)
        at org.eclipse.jetty.server.AbstractHttpConnection.handleRequest(AbstractHttpConnection.java:494)
        at org.eclipse.jetty.server.AbstractHttpConnection.headerComplete(AbstractHttpConnection.java:971)
        at org.eclipse.jetty.server.AbstractHttpConnection$RequestHandler.headerComplete(AbstractHttpConnection.java:1033)
        at org.eclipse.jetty.http.HttpParser.parseNext(HttpParser.java:644)
        at org.eclipse.jetty.http.HttpParser.parseAvailable(HttpParser.java:235)
        at org.eclipse.jetty.server.AsyncHttpConnection.handle(AsyncHttpConnection.java:82)
        at org.eclipse.jetty.io.nio.SelectChannelEndPoint.handle(SelectChannelEndPoint.java:696)
        at org.eclipse.jetty.io.nio.SelectChannelEndPoint$1.run(SelectChannelEndPoint.java:53)
        at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:608)
        at org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:543)
        at java.lang.Thread.run(Thread.java:745)
Caused by: com.sun.jersey.api.MessageException: A message body writer for Java class de.deepamehta.core.service.ResultList, and Java type de.deepamehta.core.service.ResultList<de.deepamehta.core.RelatedTopic>, and MIME media type application/json was not found
        ... 34 more


comment:2 in reply to: ↑ description Changed 5 years ago by jri

Replying to Malte:

Aim:
Deactivate all DM 4 Core REST endpoints provided through dm4-webservice to have full control over all RESTful I/O to my deepamehta4 application.

Why would you want to deactivate the dm4-webservice module?
When it's about restricting access you should rather rely on DM's access control mechanisms.

Question:
Can 3rd-party developers simply create and register their own MessageBodyWriters? or is there another, better way?

Yes, plugin developers can provide their own JAX-RS provider classes just by putting them in the plugin's provider package (like dm4-webservice does). They are picked up by DM automatically.

comment:3 Changed 5 years ago by Malte

OK, thanks for the info!

When it's about restricting access you should rather rely on DM's access control mechanisms.

Yes, i am currently getting my hands on that too.
Since yesterday i have a slightly better idea on how i could divide the data of a quite complex application across several workspaces, one workspace for each "access scenario".

comment:4 Changed 5 years ago by Malte

  • Status changed from new to closed
  • Resolution set to worksforme
Note: See TracTickets for help on using tickets.