slarson / wholebrain

Automatically exported from code.google.com/p/wholebrain
0 stars 0 forks source link

Handle exceptions thrown from server to client #516

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Guys -- I'd like to run this design by you for any client-side implications. In 
particular, I don't know how a Restlet ResourceException is received at the 
client. If  don't hear from you, I'll proceed as described here. Dave.

This is what the code will look like in XxxResource classes for 
- storeRepresentation() - PUT
- acceptRepresentation() - POST but not POSTs or portions of POSTs that are 
read only operations 
- removeRepresentations() - DELETE

***** Example from UserResource.java *****
    @Override
    public void storeRepresentation(Representation entity)
            throws ResourceException {

        if (!constants.canInsertUsers()) {
            throw new ResourceException(Status.CLIENT_ERROR_FORBIDDEN,
                    "This operation is currently disabled on this server.");
        }
         ........

Each constants.canXxxXxx() method is mapped to these properties in the 
wbcserver.properties file in the config directory of a deployed server.

# enable/disable operations that affect server data
can-add-data-files = false
can-change-data-files = false
can-delete-data-files = false
can-insert-datawrappers = false
can-insert-tangibles = false
can-update-tangibles = false
can-delete-tangibles = false
can-insert-users = false
can-update-users = false

Original issue reported on code.google.com by stephen....@gmail.com on 23 Jul 2010 at 6:01

GoogleCodeExporter commented 9 years ago
Closing a whole raft of issues because they are not relevant to the web version 
any more

Original comment by stephen....@gmail.com on 7 Mar 2011 at 10:31