Three days at Devoxx'08 have really refueled the engine with new creative ideas for the (near) future. The conference was well organized at an excellent location: MetroPolis, just off the Antwerpen city center. We didn't make it to the opening keynote on Wednesday so we missed the JavaFX commercial but by lunch time we arrived and could listen to Brian Goetzke explain the concurrency API and how we should stop thinking in Threads and move on to multi core parallelism. The same afternoon we saw the future of rich internet applications or at least Adobe's version of it; saw a bloke from New Zealand explain the wonders of easyb and behavior driven development; were slightly disappointed by the filthy rich android clients talk because of its very dry nature and lack of cool effects and finished up with a great talk by Peter Kriens, one of the founding fathers of OSGi. As it turned out OSGi was quite hot because of the new directions SUN is taking with java and modularity in project Jigsaw.
Thursday was my personal big day with my BOF scheduled for 20:00 at night. The day started with a great keynote by Josh Bloch who showed some excerpts from his book Effective Java. We got in early so we also got to see the dancing girls, as opposed to those who watched the keynote from adjacent rooms :-). Next up Ivar Jacobson, Mr. Use Case who explained how to be smart on software projects. Later that day I came across the book The Mythical Man-Month by F.P. Brooks; quite interesting how such a relatively 'old' book can still be up to date as exemplified by Ivar Jacobson's talk. Next up more talks on JavaFX, a weird live video connection talk by javaposse.com with free beer, and a boring overview of jBoss SEAM.
My own talk on DSL and GWT went really well; the hour of day was not one to attract large audiences but those who had ventured into my room all stayed until the end. Some really good questions also during the talk and a few interested people at the end while we were gently being shoveled out of the room by the next speaker. A big sigh of relief after two months of preparations and we took the first tram back to Antwerpen city center to taste a few Belgian beers.
Friday morning three concluding talks: a pretty impressive live demo of the new Spring DM server demonstrating how one OSGi could real-time be replaced by another while the main application kept running. Java + XSLT 2.0 was a bit too high level but the final presentation was a really good presentation on EJB 3.1 and why we should reconsider the idea of never ever doing EJBs again. Good stuff.
So all in all three days well spent; I bumped into a few people I'd worked with years ago, made some new friends, scored three new (black) t-shirts, bought two new books one of them signed by The Josh Bloch himself and just generally enjoyed being immersed in Java for three days on end! I'll try to summarize my own talk on DSL and GWT in a later posting.
maandag 15 december 2008
woensdag 8 oktober 2008
Talk on DSL and GWT at Devoxx'08
So this weekend the people from Devoxx sent me a mail with confirmation for me to present a Birds Of a Feather session at their next conference! Wow, that's certainly something I didn't really expect when I submitted the proposal two weeks ago. My presentation is about how I designed and used a Domain Specific Language to generate a Google Web Toolkit based user interface. I guess it must have been the combination of the two buzzwords DSL and GWT that did the trick. So the next few weeks I know what to do after I get back from the day job and putting the kids to bed!
Since I've never before visited Devoxx (formerly known as JavaPolis) I don't really know what to expect from the conference; how many people will attend such a BOF, etc. My BOF is scheduled for 20:00 on Thursday night when everybody has started tasting the Belgium beers I suppose? We'll see.
dinsdag 23 september 2008
Resource URLs in Hippo/Jetspeed
Recently we wanted to implement a few Ajax calls in our Hippo portal, a Jetspeed based portal product. Since you are quite restricted within the context of a portal application with respect to accessing or modifying the response object, it turns out that you need a special kind of strategy in order to receive the ajax calls from the client and pass back the results: resourceURLs.
Our version of Hippo is based on Jetspeed 2.1.3 which does not yet comply with JSR-286 for portal standards. This JSR specifies how to handle ajax calls within a portal. Luckily this part of the specification has already been implemented in Jetspeed 2.1.3. So how does it work?
First we have to create a resourceURL factory :
org.apache.portals.bridges.common.PortletResourceURLFactory resourceURLFactory = new org.apache.jetspeed.portlet.PortletResourceURLFactoryImpl();
I've put this code in the init(config) method of a portlet and store this factory in a private instance variable.
Now in your portlet render template you must use an URL generated by this factory. We prepare this URL in the portlet code and store it in the Freemarker model:
model.put("ajaxurl", resourceURLFactory.createResourceURL(getPortletConfig(),
request, response, null));
Refer to this url in your form:
<form id="aForm" method="post" action="${ajaxurl}">
..
</form>
Now, when this form gets submitted, you will receive a hit on your doView method and you can inspect the request to check whether it was a resource request or a normal request:
org.apache.jetspeed.request.RequestContext jrc =
(org.apache.jetspeed.request.RequestContext)
request.getAttribute(org.apache.jetspeed.PortalReservedParameters.REQUEST_CONTEXT_ATTRIBUTE);
if
(jrc.getPortalURL().getNavigationalState().getPortletWindowOfResource()!=null)
{
// it was a resource request
} else {
// it was a normal render request
}
Now you have full control over the response and can set its content type and get the output stream to pass back whatever content you like without going through the portal aggregating cycle. Pretty simple and works like a charm.
Our version of Hippo is based on Jetspeed 2.1.3 which does not yet comply with JSR-286 for portal standards. This JSR specifies how to handle ajax calls within a portal. Luckily this part of the specification has already been implemented in Jetspeed 2.1.3. So how does it work?
First we have to create a resourceURL factory :
org.apache.portals.bridges.common.PortletResourceURLFactory resourceURLFactory = new org.apache.jetspeed.portlet.PortletResourceURLFactoryImpl();
I've put this code in the init(config) method of a portlet and store this factory in a private instance variable.
Now in your portlet render template you must use an URL generated by this factory. We prepare this URL in the portlet code and store it in the Freemarker model:
model.put("ajaxurl", resourceURLFactory.createResourceURL(getPortletConfig(),
request, response, null));
Refer to this url in your form:
<form id="aForm" method="post" action="${ajaxurl}">
..
</form>
Now, when this form gets submitted, you will receive a hit on your doView method and you can inspect the request to check whether it was a resource request or a normal request:
org.apache.jetspeed.request.RequestContext jrc =
(org.apache.jetspeed.request.RequestContext)
request.getAttribute(org.apache.jetspeed.PortalReservedParameters.REQUEST_CONTEXT_ATTRIBUTE);
if
(jrc.getPortalURL().getNavigationalState().getPortletWindowOfResource()!=null)
{
// it was a resource request
} else {
// it was a normal render request
}
Now you have full control over the response and can set its content type and get the output stream to pass back whatever content you like without going through the portal aggregating cycle. Pretty simple and works like a charm.
woensdag 23 juli 2008
Getting a Hippo Portal up and running
This week I started on a project where we'll be using Hippo Portal and repository for an online webshop application. I've never before worked with Hippo so it's a chance to get to know something new. The Hippo products in itself are open source and backed by a commercial company by the same name Hippo BV. Technically there are three products: a CMS, a repository and the portal. The Hippo Portal is based on Apache's JetSpeed.
So yesterday I started by trying to install Hippo Portal and encountered a few issues along the way... the Hippo portal homepage contains a setup document detailing how to install hippo repository, hippo portal as well as maven 1.0.2. All fine. Next we try to deploy a Hello World portal as detailed here. The first action (maven hp:create-portal-project) fails for two reasons:
Still an error message. Luckily after some browsing through the remainder of the documentation I found out that I needed a sitemap.xml document to be present in the hippo repository, specifying the basic structure of my portal. So I created a sitemap.xml identical to the one specified here and uploaded it to the hippo repository. This sitemap.xml contains a reference to the document /content/documents/home.xml which does not exist in the repository. I did find a document called /content/documents/test.xml so I changed the reference in sitemap.xml from home.xml to test.xml and uploaded sitemap.xml it for the second time to the repository.
This all seemed fine and logical but the portal still failed to display anything interesting. So I changed the debug level in /gettingstarted/WEB-INF/conf/Log4j.properties from ERROR to DEBUG and discovered in /gettingstarted/logs/jetspeed.log that something was wrong with a layout. The origin of the problem was that the
<table border="0" cellspacing="10" width="100%">
<tbody><tr>
<td valign="top">#includeFragment($myPage "home-HelloWorld")</td>
<td valign="top">#includeFragment($myPage "home-PickANumberPortlet")</td>
</tr>
</tbody></table>
Wow. So after all of this the portal did work and now I can proceed trying to understand what happened and how the various config files are related to each other and the repository. One final note: along the way I also changed one other config file although I'm not sure if this change was required to get the portal working. At the end of the
to make sure JetSpeed would look in the
So yesterday I started by trying to install Hippo Portal and encountered a few issues along the way... the Hippo portal homepage contains a setup document detailing how to install hippo repository, hippo portal as well as maven 1.0.2. All fine. Next we try to deploy a Hello World portal as detailed here. The first action (maven hp:create-portal-project) fails for two reasons:
- maven cannot find an XSLT transformer, solved by copying xalan-2.4.1.jar into
/lib/endorsed - on my Windows machine I had to tweak the default project.properties by replacing backslashes in the file project.properties by forward slashes like so:
nl.hippo.portal.server.home=c:/dev/apache-tomcat-5.5.23
and
nl.hippo.portal.jdbc.drivers.path=c:/dev/apache-tomcat-5.5.23/common/endorsed/mysql-connector-java-3.1.12.jar
(and also had to copy the mysql driver into the said directory)
127.0.0.1 preview.localhost
Still an error message. Luckily after some browsing through the remainder of the documentation I found out that I needed a sitemap.xml document to be present in the hippo repository, specifying the basic structure of my portal. So I created a sitemap.xml identical to the one specified here and uploaded it to the hippo repository. This sitemap.xml contains a reference to the document /content/documents/home.xml which does not exist in the repository. I did find a document called /content/documents/test.xml so I changed the reference in sitemap.xml from home.xml to test.xml and uploaded sitemap.xml it for the second time to the repository.
This all seemed fine and logical but the portal still failed to display anything interesting. So I changed the debug level in /gettingstarted/WEB-INF/conf/Log4j.properties from ERROR to DEBUG and discovered in /gettingstarted/logs/jetspeed.log that something was wrong with a layout. The origin of the problem was that the
/gettingstarted-portal/src/webapp/WEB-INF/pages/__site1/home.psml
contains a reference to a layoutType
called default
. Based on this 'default' value Jetspeeds looks in the directory /gettingstarted-portal/src/webapp/decorations/layout/default
for a file called default-layout.vm
and this file was empty. I added the following to default-layout.vm
:<table border="0" cellspacing="10" width="100%">
<tbody><tr>
<td valign="top">#includeFragment($myPage "home-HelloWorld")</td>
<td valign="top">#includeFragment($myPage "home-PickANumberPortlet")</td>
</tr>
</tbody></table>
Wow. So after all of this the portal did work and now I can proceed trying to understand what happened and how the various config files are related to each other and the repository. One final note: along the way I also changed one other config file although I'm not sure if this change was required to get the portal working. At the end of the
project.properties
file in /gettingstarted-portal
I uncommented the last two lines:nl.hippo.portal.jetspeed.psml.basedir=${nl.hippo.portal.home}/src/webapp/WEB-INF/pages
nl.hippo.portal.jetspeed.psml.context=site1
to make sure JetSpeed would look in the
../pages/__site1/
directory to find the psml files.
woensdag 16 juli 2008
How to integrate a blog into my website
While working on my company's website I decided I wanted to include a blog on the site to post any relevant findings, problems or experiences. So here's what I did.
- I created a free account on blogger.com
- I selected a so-called classic template and set the readability to Anybody. Only then did the option appear to publish to a custom domain, which is what I wanted, because I already have a domain name and a web hosting contract
- Selected Publishing via FTP and entered all the account details. I created a new directory /blog/ in the root of my web space
- Republished the site and...yep, it worked, I could see the first post at www.wwwilpower.nl/blog/
- Went to Template/Edit HTML and switched off the NavBar, which is only allowed to be switched off when you publish via FTP
Abonneren op:
Posts (Atom)