Entity URLs in RSF
Information
Describes the usage of entity URLs in RSF and how to define where your entity URLs go in your tools and webapps. This will allow you to tie into the direct url system which gives the developer control of their URL space and opens up access to what we call entity worlds.
Implementing Entity URLs in RSF
- Implement the EntityViewParamsInferrer (in Sakai RSF)
- Suggested best practice is to name your inferrer MyEntityNameVPInferrer
- Note: You are defining the View (page) and ViewParameters (get params) which an entity resolves to, this gives the developer full control of direct URLs to their tool space without code crossing over into the service/component layer
- Add implementation as a spring bean to your RSF applicationContext.xml in your tool
Example:<bean class="org.sakaiproject.sample.tool.inferrers.SampleVPInferrer"> </bean>
- Add in the extra spring config files to your tool web.xml if they are not already there:
- contextConfigLocation should have:
classpath:conf/sakai-entitybroker-applicationContext.xml
- requestContextConfigLocation should have:
classpath:conf/sakai-entitybroker-requestContext.xml
- Suggested best practice is to put these lines above the applicationContext.xml and requestContext.xml
- contextConfigLocation should have:
- Add the needed maven dependendencies to the tool maven files
- Maven 1 users will need soemthing like this in the project.xml:
<dependency> <groupId>sakaiproject</groupId> <artifactId>sakai-entitybroker-api</artifactId> <version>${sakai.version}</version> </dependency>
- Maven 2 users will need something like this in the pom.xml:
<dependency> <groupId>org.sakaiproject.entitybroker</groupId> <artifactId>entitybroker-api</artifactId> <version>1.2.0</version> <scope>provided</scope> </dependency>
- Maven 1 users will need soemthing like this in the project.xml:
Usage of Entity URLs
There are methods in EntityBroker which will help you to generate URLs directly to entities. The URLs are like this: http://server:port/direct/prefix/id
More info at Entity URLs defined