As promised, I have made a little sample to show how an UI and a RESTful API could be built using Cocoon.
To see it, point your browser to http://www.lucamorandini.it/target/site/index.html
and follow the directions to install it (it is built using Maven, so have it at the ready).
The doc is on the my site (see link above) and in the GSMain module, the source is provided as well (see the bottom of the installation page).
To learn how it works, just follow the order of the pages (introduction, Installation, Using it and Blocks); if you need to probe further, browse the source code (and/or ask me, of course).
Don't expect too much from it: it was meant to be no more than a showcase of Cocoon "things" that may be useful to GeoServer, not a prototype of an admin console.
Regards,
--------------------
Luca Morandini
www.lucamorandini.it
--------------------
Luca Morandini ha scritto:
As promised, I have made a little sample to show how an UI and a RESTful API could be built using Cocoon.
Nice. I've been trying to follow the instructions and the docs (btw, thanks for the detailed docs, I would have been completely lost
without them).
Trying to follow the startup instructions I was greeted by:
Missing:
----------
1) com.mycompany:gslogin:jar:1.0
Try downloading the file manually from the project website.
Then, install it using the command:
mvn install:install-file -DgroupId=com.mycompany -DartifactId=gslogin -Dversion=1.0 -Dpackaging=jar -Dfile=/path/to/file
Alternatively, if you host your own repository you can deploy the file there:
mvn deploy:deploy-file -DgroupId=com.mycompany -DartifactId=gslogin -Dversion=1.0 -Dpackaging=jar -Dfile=/path/to/file -Durl=[url] -DrepositoryId=[id]
Path to dependency:
1) com.mycompany:myWebapp:war:1.0-SNAPSHOT
2) com.mycompany:gsmain:jar:1.0
3) com.mycompany:gslogin:jar:1.0
I then build that jar from the sources and mvn install jetty:run went
fine... but not hitting http://localhost:8888/gsmain. I get redirected to http://localhost:8888/page/gslogin/index.html;jsessionid=1c3cjcmhr8nbs and the following error message appears:
javax.servlet.ServletException: No block for /page/gslogin/index.html
at org.apache.cocoon.servletservice.DispatcherServlet.service(DispatcherServlet.java:84)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:820)
at org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:487)
at org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:367)
And here I'm lost...
Cheers
Andrea
Andrea Aime wrote:
Trying to follow the startup instructions I was greeted by:
Missing:
----------
1) com.mycompany:gslogin:jar:1.0
Try downloading the file manually from the project website.
Then, install it using the command:
mvn install:install-file -DgroupId=com.mycompany -DartifactId=gslogin -Dversion=1.0 -Dpackaging=jar -Dfile=/path/to/file
Alternatively, if you host your own repository you can deploy the file there:
mvn deploy:deploy-file -DgroupId=com.mycompany -DartifactId=gslogin -Dversion=1.0 -Dpackaging=jar -Dfile=/path/to/file -Durl=[url] -DrepositoryId=[id]
Path to dependency:
1) com.mycompany:myWebapp:war:1.0-SNAPSHOT
2) com.mycompany:gsmain:jar:1.0
3) com.mycompany:gslogin:jar:1.0
Hmmm... I should have tried with a "clean" machine before advertising this sample: gslogin was missing from the Maven repo (now I've added it, so it should work).
My bad
I then build that jar from the sources and mvn install jetty:run went
fine... but not hitting http://localhost:8888/gsmain. I get redirected to http://localhost:8888/page/gslogin/index.html;jsessionid=1c3cjcmhr8nbs and the following error message appears:
javax.servlet.ServletException: No block for /page/gslogin/index.html
at org.apache.cocoon.servletservice.DispatcherServlet.service(DispatcherServlet.java:84)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:820)
at org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:487)
at org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:367)
And here I'm lost...
May you try repeating the install procedure as outlined in the docs ? Now that the gslogin is in the repo it should work.
Regards,
--------------------
Luca Morandini
www.lucamorandini.it
--------------------
Luca Morandini ha scritto:
Hmmm... I should have tried with a "clean" machine before advertising this sample: gslogin was missing from the Maven repo (now I've added it, so it should work).
My bad
Ok, cleaned up my local repo (removed all com/MyCompany jars) and trying again with a "mvn clean install jetty:run".
I'm getting exactly the same result as before... this time with full log:
...
[INFO] [jetty:run]
[INFO] Configuring Jetty for project: myWebapp
[INFO] Webapp source directory = C:\progetti\geoserver\projects\cocoon\test\myWebapp\target\myWebapp-1.0-SNAPSHOT
[INFO] web.xml file = C:\progetti\geoserver\projects\cocoon\test\myWebapp\target\myWebapp-1.0-SNAPSHOT\WEB-INF\web.xml
[INFO] Classes = C:\progetti\geoserver\projects\cocoon\test\myWebapp\target\classes
2008-04-14 14:52:51.109::INFO: Logging to STDERR via org.mortbay.log.StdErrLog
[INFO] Context path = /
[INFO] Tmp directory = C:\progetti\geoserver\projects\cocoon\test\myWebapp\target\work
[INFO] Web defaults = jetty default
[INFO] Web overrides = none
[INFO] Webapp directory = C:\progetti\geoserver\projects\cocoon\test\myWebapp\target\myWebapp-1.0-SNAPSHOT
[INFO] Starting jetty 6.1.3 ...
2008-04-14 14:52:51.203::INFO: jetty-6.1.3
2008-04-14 14:52:51.515::INFO: No Transaction manager found - if your webapp requires one, please configure one.
2008-04-14 14:52:51.953:/:INFO: Initializing Spring root WebApplicationContext
log4j:WARN No appenders could be found for logger (org.springframework.web.context.ContextLoader).
log4j:WARN Please initialize the log4j system properly.
2008-04-14 14:52:54.578:/:INFO: Apache Cocoon Spring Configurator v1.0.1 is running in mode 'prod'.
Loading catalog: file:/C:/progetti/geoserver/projects/cocoon/test/myWebapp/target/work/cocoon_xml_resolver_entities/catalog
2008-04-14 14:52:56.828:/:INFO: DispatcherServlet: Block dispatcher was initialized successfully.
2008-04-14 14:52:56.859::INFO: Started SelectChannelConnector @ 0.0.0.0:8888
[INFO] Started Jetty Server
2008-04-14 14:52:59.703::WARN: /page/gslogin/index.html
javax.servlet.ServletException: No block for /page/gslogin/index.html
at org.apache.cocoon.servletservice.DispatcherServlet.service(DispatcherServlet.java:84)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:820)
at org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:487)
at org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:367)
at org.mortbay.jetty.security.SecurityHandler.handle(SecurityHandler.java:216)
at org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:181)
at org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:712)
at org.mortbay.jetty.webapp.WebAppContext.handle(WebAppContext.java:405)
at org.mortbay.jetty.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:211)
at org.mortbay.jetty.handler.HandlerCollection.handle(HandlerCollection.java:114)
at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:139)
at org.mortbay.jetty.Server.handle(Server.java:285)
at org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:502)
at org.mortbay.jetty.HttpConnection$RequestHandler.headerComplete(HttpConnection.java:821)
at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:513)
at org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:208)
at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:378)
at org.mortbay.io.nio.SelectChannelEndPoint.run(SelectChannelEndPoint.java:368)
at org.mortbay.thread.BoundedThreadPool$PoolThread.run(BoundedThreadPool.java:442)
I then build that jar from the sources and mvn install jetty:run went
fine... but not hitting http://localhost:8888/gsmain. I get redirected to http://localhost:8888/page/gslogin/index.html;jsessionid=1c3cjcmhr8nbs and the following error message appears:
javax.servlet.ServletException: No block for /page/gslogin/index.html
at org.apache.cocoon.servletservice.DispatcherServlet.service(DispatcherServlet.java:84)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:820)
at org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:487)
at org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:367)
And here I'm lost...
May you try repeating the install procedure as outlined in the docs ? Now that the gslogin is in the repo it should work.
Ok... yet this seems to imply the linked sources are somewhat incomplete/outdated?
Cheers
Andrea
Andrea Aime wrote:
Ok, cleaned up my local repo (removed all com/MyCompany jars) and trying again with a "mvn clean install jetty:run".
I'm getting exactly the same result as before... this time with full log:
Call off the dogs... I suppose you didn't type the trailing slash at the end of the URI, did you ?
In other words, it should be "http://localhost:8888/gsmain/", not "http://localhost:8888/gsmain"\.
Regards,
--------------------
Luca Morandini
www.lucamorandini.it
--------------------
Luca Morandini ha scritto:
Andrea Aime wrote:
Ok, cleaned up my local repo (removed all com/MyCompany jars) and trying again with a "mvn clean install jetty:run".
I'm getting exactly the same result as before... this time with full log:
Call off the dogs... I suppose you didn't type the trailing slash at the end of the URI, did you ?
In other words, it should be "http://localhost:8888/gsmain/", not "http://localhost:8888/gsmain"\.
Ah yes, that's it... wow, it Cocoon this picky in general?
Cheers
Andrea
Andrea Aime wrote:
Luca Morandini ha scritto:
In other words, it should be "http://localhost:8888/gsmain/", not "http://localhost:8888/gsmain"\.
Ah yes, that's it... wow, it Cocoon this picky in general?
Well, in Cocoon you can slice and dice URIs in a rather sophisticated manner, so I think you can call it pricky... but you can call *me* lazy as well (another match in the sitemap would have solved the issue).
Regards,
--------------------
Luca Morandini
www.lucamorandini.it
--------------------