10.28.2007

glassfish ajp proxy

another post from the old blog that i didn't want to lose:

Jean-Francois Arcand wrote an excellent blog entry on getting an ajp proxy running with glassfish. the only problem was that it used mod_jk. now, that's great for httpd pre-2.2, but as of version 2.2 there is a much better way. mod_proxy_ajp allows you to proxy with ajp the same way you would with any other protocol. consequently, all of the worker.properties stuff can be replaced by apache configuration directives like:

<IfModule proxy_module>
<IfModule proxy_ajp_module>
  <Location /pebble>
    ProxyPass ajp://127.0.0.1:8009/pebble
  </Location>
</IfModule>
</IfModule>

comments

martyn
Hi
While configuring with the proxy_ajp this seems to forward all request to glassfish is there a way to configure it so it works like the mod_jk that you can specify file extentions that should be forwarded and let apache handle the html,jpegs,gif of the sort .
I have been going through the documentation but don't see any thing that does this. I would be greatfull for any pointers on this.
regards martyn.
me
hey, sorry for the very, very slow reply. you're right in that the example i gave forwards everything. and while i'm not expert on apache or proxies, i can say that mod_proxy is pretty versatile. i'm pretty sure that you could accomplish what you're trying to do with the ProxyMatch directive. another way to go might be to take a look at mod_cache. it would probably boost the performance of your static content in a more dynamic way. hope that helps.
anonymous
I think you also need a ProxyPassReverse, in case the glassfish side sends an HTTP redirect.

I'm not totally sure, but that is what I have read.  :-)

java with leopard

there seem to be a fair number of java developers using os x these days, so i thought that i'd quickly write down some thoughts about java on the new os.

java 1.6

the obvious question is: does leopard comes with java 1.6? at the moment, java -version gives me

java version "1.5.0_13" Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_13-b05-237) Java HotSpot(TM) Client VM (build 1.5.0_13-119, mixed mode, sharing)

and ls /System/Library/Frameworks/JavaVM.framework/Versions/ gives me

1.3        1.4        1.4.2      1.5.0      Current 1.3.1      1.4.1      1.5        A          CurrentJDK

so, the obvious answer is no. honestly, this is a bit annoying. we know that there were some issues getting leopard out in time, but things seem to be dropping all over the place. it actually reminds me of vista a little bit... how sad. anyway, i still maintain hope that the missing pieces will show up in a software update pretty soon. otherwise...

so what's the upside? what's the reason that i'm not feeling dirty all over for owning a bit of AAPL (aside from the positive slope in that graph)?

spaces

while i spend my time at home with my macbook attached to a 20" cinema display, the rest of the time i'm confined to a mere 13". at any given time i'll have at least a browser, an ide, a text editor, a command prompt on my tiny little display and it gets a bit cluttered. until now i've been a cmd + tab, cmd + ` and cmd + her. (i really only ever used exposé to get to the desktop...) now, i think spaces may clean up my app switching. put the browser in the first space, the ide in the second and the command prompt in the third. now i can just ctrl + arrow between spaces and get right to where i want to be. since spaces aren't in a stack like the app switcher, i don't have to figure out how many cmd + tabs it'll take me to get to where i need to be.

obviously spaces wasn't just designed for developers, but i can't image who will get more use out of it. well, maybe people that want to hide the fact that they're playing launchball all day from their bosses... that's a different story.

i want mustang damnit.

10.17.2007

pie progress bar in safari 3

macosxtips pointed me to this neat little trick. if you want to get a nice little pie chart indicator for page loading instead of the default, just execute

defaults write com.apple.Safari DebugUsePieProgressIndicator -bool true

on the command line. in my opinion, it's a much nicer little indicator.

10.01.2007

coupling

i really enjoy bob lee's blog and somehow or another got back to a post from a while ago about the various degrees of coupling with guice and spring. i'll briefly say that i don't think having to have a jar on the classpath for annotation is that big of a deal and i do think that providing your own version of Inject with source retention is a big hack. that's not really the point though. what bothers me about the whole thing is that colin sampaleanu, who's pretty obviously a spring proponent, gets in a snit about coupling at all. i don't think that i've ever seen code written with spring in mind that didn't use InitializingBean, Assert and *Aware everwhere. regardless of how various versions of java 1.5 handle annotations, you can't compile a thing if the spring interfaces you're implementing aren't there. now, it's certainly possible to write code that's completely spring-agnostic, but look forward to your configuration being even more of a pain than it already was. anyway, i just think that, with regards to coupling, spring is a glass house. it may not be perfect, but at least guice was a step in the right direction.

9.19.2007

safari's web inspector

i usually use firefox when i'm working with xhtml/css because it renders consistently and the dom inspector is pretty handy. the rest of the time i use safari, so i end up switching back and forth a lot. while i was working, i ran across safari's new web inspector and it is awesome. there's probably some similar plugin for firefox (i don't really do web stuff often enough to find out), but this little addition gives me one less reason to ever move away from safari...

install cert

because it was one of my most accessed posts from the old blog, i thought that i'd repost it here.

i've done a fair amount of fighting with trusted certificates in java and it's a big pain. luckily, Andreas Sterbenz made this really useful little tool that accesses a site and adds it to a keystore automatically. the only downside was that it was written for java 1.5 and can't be used with earlier versions.

it only took a couple minor changes to allow the utility to work with 1.4 and now i've got it packaged into an executable jar. it's attached to this entry... just execute java -jar install-cert-1.0.jar to see some usage instructions. enjoy.

by the way, the original file made reference to a license that i couldn't find. i'm assuming that since he only posted the source it could be modified and redistributed. if it turns out that there are any issues, somebody please let me know and i'll be glad to remove this post.

download it here

nifty ajax search

i ran across google ajax search and thought that it'd be a great way to add search to this blog. here's what i wanted:

  • results scoped only to this blog
  • optional full google search results as well
  • no modification to the blogger template

here's how i got it:

  1. sign up for a key
  2. add an "HTML/JavaScript" page element to the blog
  3. give it a title and set the content to:
    <script src="http://www.google.com/jsapi?key=$YOUR_KEY" type="text/javascript"></script>
    <script type="text/javascript">
        google.load("search", "1");
    
        function OnLoad() {
    
          var searchControl = new google.search.SearchControl();
    
          var siteSearch = new GblogSearch();
          var options = new GsearcherOptions();
          options.setExpandMode(GSearchControl.EXPAND_MODE_OPEN);
          siteSearch.setUserDefinedLabel("this blog");
          siteSearch.setSiteRestriction("$YOUR_BLOG_ADDRESS");
          searchControl.addSearcher(siteSearch, options);
         
          siteSearch = new GwebSearch();
          options = new GsearcherOptions();
          options.setExpandMode(GSearchControl.EXPAND_MODE_CLOSED);
          siteSearch.setUserDefinedLabel("web");
          searchControl.addSearcher(siteSearch, options);
    
          searchControl.draw(document.getElementById("searchcontrol"));
        }
        google.setOnLoadCallback(OnLoad);
    </script>
    <div id="searchcontrol">Loading...</div>

as long as you replace $YOUR_KEY with the key you got in step one and $YOUR_BLOG_ADDRESS with the address of your blog, you should have search that's exactly like the search on this page. enjoy.

9.15.2007

moving to the cloud

as time goes on i find myself more and more compelled to move content to the cloud. as much as i like being autonomous, i'm getting sick of the effort that i have to put in to making it all work. so, today i push a little more responsibility somebody else's way. thanks blogger.