Coder's Revolution

Do you want a revolution?

Fun with java.net.URL

ColdFusion, Java
I was working with URLs last week while working on my Is It Flex utility and I was looking for a handy way to take a base URL and a path/file relative to that URL and come up with a fully qualified combination. For instance, let's say you have the page http://www.mysite.com/pages/about.html and that page contains a relative reference to an image like this: The fully qualified path to the image would be "http://www.mysite.com/pages/my_photo.jpg". Ok, but given those first two pieces of information how do I consistently come up with the full path while taking into account any number of subdirectories, possible non-standard ports, and query strings with goodness knows what in them. My example at the time didn't have all those factors, but I figure any problem worth solving is worth solving well.
Comments are currently closed

CFHTTP doesn't resolve URL's properly on redirect

ColdFusion
So I was working with CFHTTP the other day and noticed a strange behavior. There are two attributes I want to focus on: resolveurl and redirect. When setting redirect equal to true, ColdFusion will follow up to four 30x redirects (if a location header is provided) the most common being 302 (moved temporarily) and 301 (moved permanently). Redirects actually happen more often than you probably think. Did you know every time you type in a URL like "www.server.com/folder" your browser has to make two requests to get the page. There might be a file called "folder", but if there isn't, a 302 comes back and says check out "www.server.com/folder/" (with the trailing slash). A very common example of the 301 redirect is when you type in "yahoo.com". The server comes back and says try "www.yahoo.com".
Comments are currently closed

I'm entering the Blogosphere

ColdFusion, General
Well I've put off doing this for a very long time, but now I've officially entered the blogosphere.
Comments are currently closed