Main goal of this project is to provide quickstart for more advanced development using ObjectLedge framework.
Ultimate goal is to turn this into Maven archetype as soon as... it starts working.
TODO it works already so if anyone wishes to make archetype, go ahead.
- Fork ObjectLedge
- Clone it
- Install it into your local repository
- Once you have OL installed into your local maven repository then you can start hacking this one
- Fork & clone it
- Build it
mvn clean install -f objectledge-demo-parent/pom.xml cd objectledge-demo-minimalmkdir workdirIMPORTANT so make workdir in each of the ledge application- Run it
mvn jetty:run -f objectledge-demo-minimal/pom.xml - Open http://localhost:8080/ in your browser
- Contribute
Demonstrates (almost) minimal structure needed for ObjectLedge application
- Shows usage of action, view
- Shows how to create component and put it into container
Run it `mvn jetty:run -f objectledge-demo-minimal/pom.xml`
To run this example you will need my version of ObjectLedge at least at time being because my pull request is not yet merged with dev.
Clone git://github.com/mklew/ledge.git and make sure you install ledge from feature/jersey-pico-integration branch.
Step by step explanation
- In
web.xmlnew LedgeServlet was mapped to path handling rest requests - Name of servlet's dispatcher has to correspond to some Dispatcher component
- In this example
PipelineHttpDispatcherwas used which takes restPipeline and context(provided by pico) as parameters - restPipeline is
SimplePipelinewhich just processes requests with no error handling.ErrorHandlingPipelinecould be used instead. - restPipeline has just one valve and that is
JerseyRestValve JerseyRestValvehas its configuration inorg.objectledge.web.rest.JerseyRestValve.xml- Jersey will scan for rest services in configured packages
- Jersey services (resources in jersey nomenclature must be defined in container.xml)
- There is only one service mapped to
/hellopath which serves Hello World response.
Try it:
1. Run it `mvn jetty:run -f objectledge-demo-rest/pom.xml`
2. http://localhost:8080/rest/hello
This example uses extremely awesome Apache Shiro security framework.
Some light on things:
- In
web.xmlcontext variable, filter and listener for Shiro is added. These are pretty much excerpts from Shiro documentation. webapp/configthere's shiro.ini file which configures simple realm It also configures form based authenticationlogin.jsp(name from shiro.ini) does the authentication job- Every path is secured by Shiro. That's configured in
web.xml
To test:
- Go to any url ( no view template will be thrown after logon but that does not matter)
- Login page should popup
- Login with username:
rootand password:12345 - See that your redirected to desired url
This example is not yet done. TODO
- Create more permissions
- Secure resource with annotations
- Create Valve which added somewhere to pipeline adds Subject to Context