2. About Myself
1998-2002 CS at Univ. of Applied Sciences (HTW)
Berlin, Germany
2002 Thesis
2002-2005 Business Integration Consultant
2005-today Mostly web application development
Struts 1, Spring MVC, Struts 2, GWT
2
8. AppFuse
If you develop Java web-applications, it’s a must-know!
http://www.appfuse.org
Developed by Matt Raible - www.raibledesigns.com
jRecruiter is loosely based on AppFuse
8
9. Spring 2.5/3.0
Use annotations to reduce XML clutter
@Autowired - eliminate getters/setters
<tx:annotation-driven/>
<context:annotation-config />
<context:component-scan base-package="org.jrecruiter.dao.jpa" />
<context:component-scan base-package="org.jrecruiter.service.impl" />
9
10. Spring Tips
If using @Autowired and no setters - How to unit-test?
org.springframework.test.util.ReflectionTestUtils
Allows for setting private instance variables
EasyMock is awesome
10
11. Table Pluralization I
What about rails-like table pluralization?
You could do: @Table(name="users")
Better: Hibernate Naming Strategy
org.hibernate.cfg.DefaultNamingStrategy
org.hibernate.cfg.ImprovedNamingStrategy
11
12. Table Pluralization II
How to do pluralization?
inflector project (http://inflector.dev.java.net)
e.g. String cats = Noun.pluralOf(“cat”)
jRecruiter: ImprovedPluralizedNamingStrategy
12
13. Data Migration
How to deal with external services referencing jobs?
Primary key ids may change across data migrations
Solution: UUID for Job postings
How to map old urls to the new one?
Solution: urlrewriter (http://tuckey.org/urlrewrite/)
13
14. Lorem Ipsum
Generate an arbitrary number of job postings
Fill them with Dummy Data aka ‘place holder text’
http://en.wikipedia.org/wiki/Lorem_ipsum
Library for Java: http://loremipsum.sourceforge.net/
14
15. Struts 2.1
Annotation-driven configuration
Using Convention Plugin (Bundled with Struts 2.1)
VERY similar to Spring MVC 3.0
Which one is better?
15
16. I18N part I
support for German (80% complete)
support for Spanish is planned
Advice: UTF-8 for everything!
Java properties files are a bit ‘iffy’
16
17. I18N part II
by default Java properties files are in ISO-8859-1
UTF-8 characters need to be escaped - ugly!
Java 6 has better support: ResourceBundle.Control
ResourceBundle bundle =
ResourceBundle.getBundle("messages", new
MyControl());
17
18. I18N part III
Spring: ReloadableResourceBundleMessageSource
<bean id="messageSource"
class="org.springframework.context.support.ReloadableResourceBundleMessageSource" >
<property name="basenames" >
<list>
<value>classpath:messages</value>
</list>
</property>
<property name="defaultEncoding" value="utf-8"/>
<property name="cacheSeconds" value="0"/>
</bean>
Spring JSP message tag can use it
Good plugin for eclipse: Eclipse ResourceBundle Editor
http://sourceforge.net/projects/eclipse-rbe/
18
19. Security in jRecruiter
SSL for all administrative pages
Account verification at signup (Email)
User Login: Email + Password
Under the covers: Email OR Username + Password
19
22. Google Maps
jRecruiter uses:
Maps Api (Version 2)
Maps Api for Flash
Static Maps API
Be careful with SSL!
http://code.google.com/p/gmaps-api-issues/issues/detail?id=591
22
23. Google Maps for PDF
Using Static Maps API
Server makes call
Image embedded using iText
23
25. bit.ly
similar to TinyUrl, just cooler
there is a Java library available bitlyj
http://code.google.com/p/bitlyj/
bitlyj works okay but needs some work
final Bitly bitly = BitlyFactory.newInstance(“username”, “password”);
try {
final BitlyUrl bUrl = bitly.shorten(“http://www.google.com/”);
return bUrl.getShortUrl();
} catch (final IOException e) { … }
25
26. Managing API Keys
Dealing with one API key is easy, but many?
Google Maps, Twitter, bit.ly, reCAPTCHA ...
Centrally stored in jrecruiter.properties
org.jrecruiter.common.ApiKeysHolder
Spring-injected
26
27. RSS Feed Support
Provide the latest 20 Job postings as Feed
ROME
https://rome.dev.java.net/
Struts2 integration with s2-rome
http://code.google.com/p/s2-rome/
27
28. Web Services (Indeed.com)
Used JDOM at first, yet memory intensive
StAX - Streaming API for XML
Stream XML data to client
Advantage: Lower Memory Footprint
Part of Java 6
28
29. YSlow
80% of the end-user response time is spent on the
front-end.
Reduce HTTP requests, GZIP, Minify …
http://developer.yahoo.com/yslow/
http://developer.yahoo.com/performance/rules.html
29