Quick FYI:

Bugs/patches for the REST API can actually be submitted directly to our 
JIRA at:
https://jira.duraspace.org/browse/DS

Just be sure that when you submit the bug/patch, you select the 
"Component" as "REST API (experimental)".

- Tim

On 5/2/2011 1:13 PM, Peter Dietz wrote:
> Hi All,
>
> I was looking at the DSpace REST API module today, and I too had errors
> with getting null when viewing something like:
> http://localhost:8080/restapi/communities/213.xml
>
> *message* _Failure processing entity request (/communities/213.xml): null_
>
> *description* _The server encountered an internal error (Failure
> processing entity request (/communities/4.xml): null) that prevented it
> from fulfilling this request._
>
>
> I don't think it had to do with closing the database connection, but
> instead I think the problem was when you were trying to create a new
> CommunityEntity around the parentCommunity of the current resource,
> without checking if the parentCommunity of the current resource was
> null. I've added a few checks, one for parentCommunity, and another for
> the administrator group, and the rest api is working for me.
>
> Attached is my patch for fixing that. https://gist.github.com/952058
> (I'd prefer not sending files to the mailing list, also I didn't see
> where the rest bug tracker is).
>
> Also, Bojan, I'd like to clean up the "getting-started" wiki page to
> make it easier to use the rest api. I had to change a few things to get
> it going. i.e. change 1.6.0-SNAPSHOT to 1.7.1. And I ran it as a module
> connected to my normal dspace code, so I'd like to add how to run it as
> a module.
>
> For developing the rest api, I would definitely recommend using an IDE
> with a debugger (IntelliJ), it will make exactly what is happening
> crystal clear.
>
> Either way, good luck this summer with the rest api. I imagine you will
> have more support, especially as people would like to use it.
>
> <http://localhost:8080/restapi/communities/213.xml>
> Peter Dietz
>
>
>
> On Tue, Mar 29, 2011 at 11:43 AM, Mark Melia <mark.me...@enovation.ie
> <mailto:mark.me...@enovation.ie>> wrote:
>
>     Hi Bojan,
>
>     Thanks for getting back to me on this. I was having an issue whereby I
>     was loosing the connection to the DB through the context. In
>     investigating this I found the problem was the calling of
>     context.complete() in the ItemEntity constructor as the context.complete
>     nulls the connection and any other Items created after a search in the
>     SearchProvider will no longer have a connection to the Database. I have
>     removed the context.complete() call - which will cause problems if this
>     is used for updating entities I presume but at present all I interested
>     in is search. I think that you may have put this in as a fix to the
>     connection leak problem outlined into a previous mail.
>
>     Does this sound right to you?
>
>     Thanks,
>     Mark
>
>     --
>     Dr. Mark Melia
>     Analyst Programmer
>     Enovation Solutions Ltd.
>     The Friary, Bow Street, Dublin 7.
>     Follow us on Twitter: http://twitter.com/enovationire/
>     See our blog: http://blog.enovation.ie/
>
>     ‘Celebrating 10 years providing high quality solutions to our clients’
>
>
>
>     On 23/03/11 14:39, Bojan Suzic wrote:
>      > Hi Mark,
>      >
>      > sorry for late answer. I think this error is related to number of
>      > database connections opened. As you have already noticed in the code,
>      > for each request it creates new Context object, which maintains
>      > connection to the database. Under some circumstances/conditions, I
>      > think this object is not correctly closed at the end of request. I
>      > believe this is causing an error, as after some time it goes over
>      > limit of connections defined by RDBMS and therefore cannot open new
>      > request.
>      > I noticed that error before in some other segments. After thorough
>      > investigation it has been fixed, but now it seems the bug is present
>      > in some other parts too.
>      >
>      > I would suggest to try to increase number of db connections allowed
>      > and to wait until problem gets fixed and updated in the source code..
>      >
>      > Regards
>      > Bojan
>      >
>      >
>      >
>      >> Hi Steve,
>      >>
>      >> Thanks for the reply - the only thing outputted on the logs when the
>      >> request is made is:
>      >>
>      >> 2011-03-15 10:14:15,017 INFO
>     org.dspace.rest.providers.UserProvider @
>      >> user:anonymous:ip_addr=:entity_exists:29
>      >>
>      >> Thanks,
>      >> Mark
>      >>
>      >> On 15/03/11 10:16, Steve Swinsburg wrote:
>      >>> A 500 is an internal server error, what do the logs say?
>      >>>
>      >>> cheers,
>      >>> Steve
>      >>>
>      >>>
>      >>> On 15/03/2011, at 9:03 PM, Mark Melia wrote:
>      >>>
>      >>>> Hi Bojan,
>      >>>>
>      >>>> I have taken the latest code from the SVN address above and the
>      >>>> authentication issue is still there. I am not sure how you are
>     able to
>      >>>> over come it without changing the code in the
>     AbstractBaseProvider. I
>      >>>> have made the change you suggested - rather than just removing the
>      >>>> exception throw. (I can send you a patch file if you would like?)
>      >>>>
>      >>>> On another note - I am stil trying to get details for a specific
>      >>>> community I am doing this by calling the URL -
>      >>>>
>      >>>> http://localhost:8080/rest/communities/29.xml
>      >>>>
>      >>>>
>      >>>> as outlined below. Can you tell me if I am doing this correct
>     - I am
>      >>>> still getting HTTP Status 500. If I have time I will look more
>     deeply
>      >>>> into this - if you have no ideas on what is causing it?
>      >>>>
>      >>>> Thanks,
>      >>>> Mark
>      >>>>
>      >>>>
>      >>>> On 14/03/11 16:14, Mark Melia wrote:
>      >>>>> Hi Bojan,
>      >>>>>
>      >>>>> Thanks a million for your reply. I am thinking maybe I do have an
>      >>>>> earlier version of the code - Today I tried to get details on one
>      >>>>> particular collection using
>      >>>>>
>      >>>>> http://localhost:8080/rest/communities/29.xml - this resulted in
>      >>>>> an error -
>      >>>>> HTTP Status 500 - Failure processing entity request
>      >>>>> (/communities/29.xml): null
>      >>>>>
>      >>>>> I will have to check the version I am running.
>      >>>>>
>      >>>>> Thanks again for your help.
>      >>>>> Mark
>      >>>>>
>      >>>>> On 14/03/11 15:51, Bojan Suzic wrote:
>      >>>>>> Hi Mark,
>      >>>>>>
>      >>>>>> I have just checked it and tried to reproduce locally.
>      >>>>>> So I tried the following:
>      >>>>>>
>      >>>>>> http://localhost:8080/rest/search.xml?query=test - got normal
>      >>>>>> results
>      >>>>>>
>      >>>>>>
>     http://localhost:8080/rest/search.xml?query=test&user=x...@xxx.com
>     <http://localhost:8080/rest/search.xml?query=test&user=x...@xxx.com>
>      >>>>>> - got
>      >>>>>> exception 403, we have user but password is not provided
>      >>>>>>
>      >>>>>>
>     
> http://localhost:8080/rest/search.xml?query=test&user=x...@xxx.com&pass=correct_password
>     
> <http://localhost:8080/rest/search.xml?query=test&user=x...@xxx.com&pass=correct_password>
>      >>>>>>
>      >>>>>> - got normal results again as the correct password is
>     provided with
>      >>>>>> the user in the query
>      >>>>>>
>      >>>>>> So, the code you are referring to is executed only if user or
>      >>>>>> pass are
>      >>>>>> provided in the query. If they are not provided, it uses
>     anonymous
>      >>>>>> user and further should not execute this code.
>      >>>>>>
>      >>>>>> Maybe you are using some older version from svn? The actual
>      >>>>>> version is
>      >>>>>> available at
>      >>>>>>
>     http://scm.dspace.org/svn/repo/modules/rest/branches/dspace-rest-gsoc10/.
>      >>>>>>
>      >>>>>>
>      >>>>>> Also if this problem still persists, could you then try to
>     change
>      >>>>>> this
>      >>>>>> code to look like this:
>      >>>>>>
>      >>>>>> if (!(user.equals("")) {
>      >>>>>> try {
>      >>>>>> ...
>      >>>>>> } catch () ...
>      >>>>>>
>      >>>>>> }
>      >>>>>>
>      >>>>>> It could be that underlying code treats blank user differently.
>      >>>>>>
>      >>>>>> Kind regards
>      >>>>>> Bojan
>      >>>>>>
>      >>>>>>
>      >>>>>>
>      >>>>>>
>      >>>>>>> The action I am calling is the search rest call I am making is
>      >>>>>>> search -
>      >>>>>>> http://localhost:8080/dspace/search.xml?query=testitem
>      >>>>>>> When this is called it looks like the method refreshParams is
>      >>>>>>> called in
>      >>>>>>> the AbstractBaseProvider class. This method checks if the user
>      >>>>>>> is logged
>      >>>>>>> in and throws an EntityException if the user is not logged in,
>      >>>>>>> which is
>      >>>>>>> the case for my search.
>      >>>>>>>
>      >>>>>>> try {
>      >>>>>>> EPerson eUser = EPerson.findByEmail(context, user);
>      >>>>>>> if ((eUser.canLogIn())&& (eUser.checkPassword(pass))) {
>      >>>>>>> context.setCurrentUser(eUser);
>      >>>>>>> loggedUser = eUser.getName();
>      >>>>>>> } else {
>      >>>>>>> throw new EntityException("Bad username or password", user,
>     403);
>      >>>>>>> }
>      >>>>>>>
>      >>>>>>> Any idea would be much appreciated. We are creating a plug-in
>      >>>>>>> for Moodle
>      >>>>>>> 2.0 so that DSpace can be used as a repository.
>      >>>>>
>     
> ------------------------------------------------------------------------------
>      >>>>>
>      >>>>> Colocation vs. Managed Hosting
>      >>>>> A question and answer guide to determining the best fit
>      >>>>> for your organization - today and in the future.
>      >>>>> http://p.sf.net/sfu/internap-sfd2d
>      >>>>> _______________________________________________
>      >>>>> DSpace-tech mailing list
>      >>>>> DSpace-tech@lists.sourceforge.net
>     <mailto:DSpace-tech@lists.sourceforge.net>
>      >>>>> https://lists.sourceforge.net/lists/listinfo/dspace-tech
>      >>>>
>     
> ------------------------------------------------------------------------------
>      >>>>
>      >>>> Colocation vs. Managed Hosting
>      >>>> A question and answer guide to determining the best fit
>      >>>> for your organization - today and in the future.
>      >>>> http://p.sf.net/sfu/internap-sfd2d
>      >>>> _______________________________________________
>      >>>> DSpace-tech mailing list
>      >>>> DSpace-tech@lists.sourceforge.net
>     <mailto:DSpace-tech@lists.sourceforge.net>
>      >>>> https://lists.sourceforge.net/lists/listinfo/dspace-tech
>      >>
>      >>
>     
> ------------------------------------------------------------------------------
>      >>
>      >> Colocation vs. Managed Hosting
>      >> A question and answer guide to determining the best fit
>      >> for your organization - today and in the future.
>      >> http://p.sf.net/sfu/internap-sfd2d
>      >> _______________________________________________
>      >> DSpace-tech mailing list
>      >> DSpace-tech@lists.sourceforge.net
>     <mailto:DSpace-tech@lists.sourceforge.net>
>      >> https://lists.sourceforge.net/lists/listinfo/dspace-tech
>      >
>
>     
> ------------------------------------------------------------------------------
>     Enable your software for Intel(R) Active Management Technology to
>     meet the
>     growing manageability and security demands of your customers. Businesses
>     are taking advantage of Intel(R) vPro (TM) technology - will your
>     software
>     be a part of the solution? Download the Intel(R) Manageability Checker
>     today! http://p.sf.net/sfu/intel-dev2devmar
>     _______________________________________________
>     DSpace-tech mailing list
>     DSpace-tech@lists.sourceforge.net
>     <mailto:DSpace-tech@lists.sourceforge.net>
>     https://lists.sourceforge.net/lists/listinfo/dspace-tech
>
>
>
>
> ------------------------------------------------------------------------------
> WhatsUp Gold - Download Free Network Management Software
> The most intuitive, comprehensive, and cost-effective network
> management toolset available today.  Delivers lowest initial
> acquisition cost and overall TCO of any competing solution.
> http://p.sf.net/sfu/whatsupgold-sd
>
>
>
> _______________________________________________
> DSpace-tech mailing list
> DSpace-tech@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/dspace-tech

------------------------------------------------------------------------------
WhatsUp Gold - Download Free Network Management Software
The most intuitive, comprehensive, and cost-effective network 
management toolset available today.  Delivers lowest initial 
acquisition cost and overall TCO of any competing solution.
http://p.sf.net/sfu/whatsupgold-sd
_______________________________________________
DSpace-tech mailing list
DSpace-tech@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/dspace-tech

Reply via email to