[Building Sakai] Custom POST Entity Broker

Aaron Zeckoski azeckoski at unicon.net
Tue Nov 13 03:51:25 PST 2012


In general, you probably don't want to attempt to use batch processing
with POST. Especially when sending a file since you can really only
send one in your request anyway. You should just post directly to the
endpoint:
POST http://elearn-dev.wits.ac.za/direct/addsiteresource/site/OCCT1000_2012

-AZ


On Tue, Nov 13, 2012 at 6:12 AM, Paul Wando Mungai <paulwando at gmail.com> wrote:
>
> I write an entity broker that will add resources to sakai site resource.
> This works when using a get. I then converted it to handle post ( VIEW_NEW
> ). I create a http post request with the necessary parameters appended to
> it:
>
> POST
> http://elearn-dev.wits.ac.za/direct/batch?_refs=/direct/addsiteresource/site/OCCT1000_2012
> HTTP/1.1
>
> However, I get the error bellow and am not sure of the cause;
>
> Failure attempting to process reference
> (\/direct\/addsiteresource\/site\/OCCT1000_2012) for url
> (\/direct\/addsiteresource\/site\/OCCT1000_2012): Could not parse the
> incoming path (\/addsiteresource\/site\/OCCT1000_2012) and no entity
> provider could be found to handle the
> prefix:org.sakaiproject.entitybroker.exception.EntityException: Could not
> parse the incoming path (\/addsiteresource\/site\/OCCT1000_2012) and no
> entity provider could be found to handle the prefix
>
>
> My implementation is as follows:
> -----------------------------------------------------------------------------------------------------------------------------------------------------------
> public interface WitsEAddSiteResourceEntityProvider extends EntityProvider {
>
>     public final static String ENTITY_PREFIX = "addsiteresource";
> }
> -----------------------------------------------------------------------------------------------------------------------------------------------------------
> public class WitsEAddSiteResourceEntityProviderImpl implements
>         WitsEAddSiteResourceEntityProvider, CoreEntityProvider, CRUDable,
>         CollectionResolvable, Outputable, Inputable, Describeable,
> ActionsExecutable {
>
>     private ContentHostingService contentHostingService;
>     private SessionManager sessionManager;
>
>
> @Override
>     public String getEntityPrefix() {
>         return ENTITY_PREFIX;
>     }
>
>     /**
>      * site/siteId
>      */
>     @EntityCustomAction(action = "site", viewKey = EntityView.VIEW_NEW)
>     public List<SiteResource> addSiteResource(EntityView view,
> EntityReference ref,
>             String prefix, Search search, OutputStream out,
>             Map<String, Object> params) {
>         //Get site Id
>         String siteId = view.getPathSegment(2); //check if null
>
>         List<SiteResource> siteResources = new ArrayList<SiteResource>();
>         //Get post params
>         String userId = params.get("userId").toString(); // check if null...
>         .............................
>         return siteResources;
>     }
>
> -----------------------------------------------------------------------------------------------------------------------------------------------------------
>
>
> --
> Regards,
> Paul Mungai
>
> "Ability is what youre capable of doing. Motivation determines what you do.
> Attitude determines how well you do it" By Lou Holtz, Notre Dame Football
> Coach
>
> _______________________________________________
> sakai-dev mailing list
> 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
> with a subject of "unsubscribe"



-- 
Aaron Zeckoski - Software Architect - http://tinyurl.com/azprofile


More information about the sakai-dev mailing list