Hi Isomorphic,
weeks becoming 1.5 years, but I finally started with my RESTHandler-subclass, hitting some roadblocks (using latest 6.1p).
I had a look at your RESTHandler.processRequest() implementation.
For now, I was using a request like in the example, but amended two fields:
I did @override handleDSRequest() and checked the username and token there, then did setUserId() and setUserRoles() on the RPCManager.
Here the first problem arises:
If the user does not exists, the token does not match, etc... I return new DSResponse.setFailure("Some useful errormessage").
handleDSRequest() is called by your processRequest()-implementation for every request in the call.
Returning setFailure() makes the processRequest() stop the transactions and returns only -1 or -10 as status and no status message.
While I realize that I probably should do the check on the user not in the request, but before though querystring parameters, I do have some problems here, the biggest being "How do I show an error message to the developer using my API". Is it correct that the message from DSResponse.setFailure("Some useful message") is not displayed in the response sent to the browser?
If I do the users check not in handleDSRequest(), but before in processRequest() or even doPost(), how do I set username and roles?
If a request fails because of declarative security (e.g. missing role), how do I display this error message?
I think I know this problem from the normal application and IDACall, where the error messages for queues (not single requests!) are also not displayed, but I might be wrong here.
Do you suggest overriding handleDSRequest() or processRequest()? I'd very much prefer handleDSRequest(), if I can solve the issues above.
Also I had a look at your processRequest() implementation (using JD Eclipse) and tried to @override it with just the same code in my Subclass. This fails, as many needed constants are private and not protected. Is this correct?
Do you have the same minimal override-pseudocode processRequest() you offer for IDACall here in the docs?
It are many questions, but aggregated as 1st pointers these would suffice:
Blama
weeks becoming 1.5 years, but I finally started with my RESTHandler-subclass, hitting some roadblocks (using latest 6.1p).
I had a look at your RESTHandler.processRequest() implementation.
For now, I was using a request like in the example, but amended two fields:
Code:
<request> <userName>myUsername</userName> <userToken>1111111111111111111111111111111111111111</userToken> <dataSource>T_ROLE</dataSource> <operationType>fetch</operationType> <startRow>0</startRow> <endRow>2</endRow> <textMatchStyle>exact</textMatchStyle> </request>
Here the first problem arises:
If the user does not exists, the token does not match, etc... I return new DSResponse.setFailure("Some useful errormessage").
handleDSRequest() is called by your processRequest()-implementation for every request in the call.
Returning setFailure() makes the processRequest() stop the transactions and returns only -1 or -10 as status and no status message.
Code:
<?xml version="1.0" ?> <response> <status>-1</status> <queueStatus>-1</queueStatus> </response>
If I do the users check not in handleDSRequest(), but before in processRequest() or even doPost(), how do I set username and roles?
If a request fails because of declarative security (e.g. missing role), how do I display this error message?
I think I know this problem from the normal application and IDACall, where the error messages for queues (not single requests!) are also not displayed, but I might be wrong here.
Do you suggest overriding handleDSRequest() or processRequest()? I'd very much prefer handleDSRequest(), if I can solve the issues above.
Also I had a look at your processRequest() implementation (using JD Eclipse) and tried to @override it with just the same code in my Subclass. This fails, as many needed constants are private and not protected. Is this correct?
Do you have the same minimal override-pseudocode processRequest() you offer for IDACall here in the docs?
It are many questions, but aggregated as 1st pointers these would suffice:
- Is it OK that error messages from setFailure() are not displayed. If so, how to communicate to the API-user?
- @Override handleDSRequest() or processRequest()?
- If override processRequest(), how exactly? Perhaps you can add pseudocode for this in the docs like you do for IDACall.
Blama
Comment