[Building Sakai] Entity Broker - REST getEntities - URL longer than max limit allowed

Tania Tritean TTritean at loi.nl
Fri Mar 22 04:53:51 PDT 2013


Hello,

Thanks for the answer.

We tried the solution, but apparently we end up in the same code of EB.

Are we doing something wrong?

This is our code:


@EntityCustomAction(action = "activitiesHistoryElements", viewKey = EntityView.VIEW_NEW)
 public ActionReturn getActivitiesHistoryElements(final EntityReference ref, final Search search) {
final ActionReturn actionReturn = new ActionReturn(this.convertToEntityDataList(myList), "json");
            return actionReturn;
 }

 / * Converts the {@link ActivityHistoryEntity} list to {@link EntityData} list so it can be returned in case of POST
  * request.
  *
  * @param ahList
  *            the list to be converted
  * @param ref
  *            the entity reference
  * @return the converted list
  */
 private List<EntityData> convertToEntityDataList(final List<ActivityHistoryEntity> ahList, final EntityReference ref) {
  final List<EntityData> entityDataList = new ArrayList<EntityData>();
  for (final ActivityHistoryEntity ahEntity : ahList) {
   final EntityData entityData = new EntityData(ref, "");
   entityData.setData(ahEntity);
   entityData.setDisplayTitle(ahEntity.getEntityTitle());
   entityDataList.add(entityData);
  }
  return entityDataList;
 }


Regards,

Tania


________________________________
From: sakai-dev-bounces at collab.sakaiproject.org [mailto:sakai-dev-bounces at collab.sakaiproject.org] On Behalf Of Aaron Zeckoski
Sent: Friday, March 22, 2013 11:42 AM
To: Tania Tritean
Cc: Ioana Mocan; sakai-dev; Dana Puscau
Subject: Re: [Building Sakai] Entity Broker - REST getEntities - URL longer than max limit allowed

This happens because EB is trying to be too smart for its own good. Just change the code from returning the object directly to returning it inside the ActionReturn wrapper and things will work the way you want (you have to change the method signature as well).

From:
return data;
To:
return new ActionReturn(data);

-AZ


On Fri, Mar 22, 2013 at 4:17 AM, Tania Tritean <TTritean at loi.nl<mailto:TTritean at loi.nl>> wrote:
Hello,

I have a question related to the entity broker.

We are trying to get a list of data via EB Restfull capability.
Normally we would use the method getEntities for this, but the method should receive a very long list of arguments so that the URL can be longer than the max limit allowed in different browsers.

What would be the approach to solve this problem?

We tried this:

  1.  To use EntityCustomAction instead of getEntities. This action is mapped with viewKey = entityView.View_NEW to make the action as a post, so that the parameters won't be in the URL.
-         the problem is that for a list with one element we get to the code in EntityHandlerImpl line 447 ( Sakai 2.9, EB 1.4.3)
if (actionReturn.entitiesList.size() > 1) {
       // correct the view key which should be used now
       view.setViewKey(EntityView.VIEW_LIST);
  }

So we end up with the error and no data returned:
Provider: Attempted to access an entity URL path (/loi-activities-history/new.json) using method (POST) for an entity (/loi-activities-history) and view (new) when there is no access provider to handle the request for prefix (loi-activities-history)


Is there another way to solve our problem?

Regards,
Tania

Tania Tritean
Tel.: 035 629 39 23

Leidse Onderwijsinstellingen bv
Leidsedreef 2
2352 BA Leiderdorp
www.loi.nl<http://www.loi.nl>

________________________________

[Nederland wordt steeds slimmer. Leidse Onderwijsinstellingen]

De informatie verzonden met dit e-mailbericht (en bijlagen) is uitsluitend bestemd voor de geadresseerde(n) en zij die van de geadresseerde(n) toestemming hebben dit bericht te lezen. Gebruik door anderen dan geadresseerde(n) is verboden. De informatie in dit e-mailbericht (en de bijlagen) kan vertrouwelijk van aard zijn en kan binnen het bereik vallen van een wettelijke geheimhoudingsplicht. Indien u deze e-mail ten onrechte ontvangen hebt, wordt u verzocht ons daarvan zo spoedig mogelijk per e-mail of telefonisch op de hoogte te stellen, en het ontvangen bericht (en de bijlagen) te wissen zonder deze te lezen, te kopiëren of aan derden bekend te stellen.

P  Denk aan het milieu voordat u dit bericht print


_______________________________________________
sakai-dev mailing list
sakai-dev at collab.sakaiproject.org<mailto:sakai-dev at collab.sakaiproject.org>
http://collab.sakaiproject.org/mailman/listinfo/sakai-dev

TO UNSUBSCRIBE: send email to sakai-dev-unsubscribe at collab.sakaiproject.org<mailto:sakai-dev-unsubscribe at collab.sakaiproject.org> with a subject of "unsubscribe"



--
Aaron Zeckoski - Software Architect - http://tinyurl.com/azprofile
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://collab.sakaiproject.org/pipermail/sakai-dev/attachments/20130322/a0b8ea0a/attachment.html 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image001.gif
Type: image/gif
Size: 4378 bytes
Desc: image001.gif
Url : http://collab.sakaiproject.org/pipermail/sakai-dev/attachments/20130322/a0b8ea0a/attachment.gif 


More information about the sakai-dev mailing list