Michael J. Makunas

Ranch Hand
+ Follow
since Mar 11, 2002
Cows and Likes
Total received
In last 30 days
Total given
Total received
Received in last 30 days
Total given
Given in last 30 days
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Michael J. Makunas

Originally posted by Bear Bibeault:
I still don't get the filter. Why not just declare a controller servlet as the error handler in the deployment descriptor and handle any decision making there?

Good point. I thought of something like that after I just posted this. But my concern is that I need/want:

1. To know what the originally requested URL was.
2. To know what the original status code was.
3. To minimize what I have to add to web.xml. In other words can I do something like:

11 years ago
Hi all-

I'm trying to write a servlet filter that displays custom error pages. (Yes, I do know the standard way of specifying error pages in web.xml but the template of the error page needs to vary and I'd rather not put that logic in a jsp.) I'm doing all the normal wrapping of the response, etc. in order to be able to modify the response, but no matter what I do it just seams to ignore anything written to the output stream. I seem to remember someone telling me once that you cannot modify the response when the status is an error. Is this the case or am I doing something else wrong?
[ August 14, 2008: Message edited by: Michael J. Makunas ]
11 years ago

Originally posted by Doug Hall:
IDs are better for the same reason that database keys should not be an attribute - because attributes can change. This is better for the user, too, by the way, due to bookmarking.

I didn't mean use an attribute. I meant choosing between using the numeric primary key versus a human readable surrogate key (that doesn't change). Also, while you are correct, a URI should ideally not change over time, properly used 301 redirects can help.
13 years ago
I'm not that experienced with Rails (and Ruby in general) but I'm working on an java based web api that is using the REST architectural style and I'm curious about some of the design decisions that went into the new RESTful features of Rails.

1) Plurals in URLs (i.e., www.foo.com/users/1 instead of www.foo.com/user/1). This makes sense to me and most RESTful apis seem to follow this convention, but I can't seem to find a good explanation for why. I am choosing to use plurals because semantically it just seems more correct and while URLs should be opaque to the code they should also be understandable to the human reading them.

2) Exposing identifiers (i.e., www.foo.com/users/1 instead of www.foo.com/users/myusername). In theory, I'm against exposing identifiers, but in practice it's a often a pain to deal with surrogate human readable keys. I'd prefer that the whole URL was human readable, but I'm resorting to exposing identifiers because it's just easier with the data we have.

Does anyone know if Rails chose these conventions for any particular reason? Did it just fit better with existing Rails conventions?

13 years ago
This should be fairly trivial, but for some reason I can't figure it out. How (in Tomcat 5.5) do I deploy foo.war so that it's URL is www.bar.com instead of www.bar.com/foo/ ?

Thanks in advance....
13 years ago
I'm starting a new project that's built on MySql/Apache/Tomcat/Spring/Hibernate. My general philosophy is when in doubt, put jars in the war file and not in tomcat's lib. But, in the book Spring In Action, it has spring.jar outside of the whole source tree. Is there any good reason for this?
I'm creating a "Dynamic Web Project" using Eclipse 3.1/WTP 0.7 and I have some properties and xml files that need to be in the context class path. Does anyone know how I get Eclipse to copy these files from a project subfolder into .deployable/PROJECTNAME/WEB-INF/classes when it does a build? It seems like something that should be pretty straightforward but I can't seem to figure out how to do it.


Originally posted by Jeanne Boyarsky:
I was looking around for something similar a couple of months ago. Didn't find anything though. I did learn that I really only need to provide a subset of UBB. Our users don't require anywhere near the level of sophistication that JavaRanch users do.

Yeah, pretty much my thoughts exactly. I've given up searching and am going to implement something very very simple. I was just hoping I could avoid relearning regex.
HTMLArea has a ton of functionality but it's not really safe and to make it safe I'd end doing just as much work as if I wrote what I need myself. All I really want is to do what this boards does and have a small set of "bracket tags" that will get parsed into html. Looks like I'll have to relearn regex
Thanks. That might do the trick. But I'm not sure how "safe" it is. I want to be able to prevent people from doing anything that will screw up the rendering of the page. But I'll play with it and see.
Anyone know of a free/open source libraries for allowing "safe" html and emoticons in forums/blogs/etc.?

I have a site where users enter postings/blog entries and I want to give them the ability to do some formatting, but (for obvious reasons) don't want them to enter straight html. I could write something myself but there has to be something out there.

Originally posted by Paul Sturrock:

You might try HttpServletRequest.getRequestURL() - that might give you it (assuming #baz is not also considered part of the query string). Given the purpose of fragments though, why does your servlet need it?

Actually, I'm doing it from a jsp, but it should work the same. I want it so that I can track which fragments are being viewed more (i.e., which are more popular). (They are coming from another jsp...I know this won't work if the link is on the same jsp).

Unfortunately, HttpServletRequest.getRequestURL() doesn't seem to include "#baz". That's what leads me to believe it's not sent as part of the request and only the user-agent knows about it. The workaround is to put the fragment id in the query string too (e.g., foo.jsp?id=baz#baz). Not that much work but I was trying not to repeat info when I don't have to.
14 years ago

Originally posted by Ben Souther:
No, HttpServletRequest.getRequestURI will get you from the protocol name up to the query string.
From there, you're on your own.

Just so I'm clear on this....from playing arround with it myself and looking at the docs I've gathered that getRequestURI returns from the protocol to the the end of the query string and no more, correct? Does this mean the string "#baz" isn't even sent in the HTTP request?
14 years ago
If I have a URL like this:


Is there a standard way to get the string "baz" from the request object without having to do pattern patching on the whole URL string?

14 years ago
I have a web app that posts a form to another site. I need to capture the contents of the form before I post it, so I post to a servlet, capture the data, and use HttpClient to post the form to the remote URL. The problem is when I output the response like this:

OutputStream os = res.getOutputStream();

The output is relative to my server and not the actual URL so all the links are broken.

Is there a way with HttpClient to just take the response from the post have it display as it would normally? Or do I need to do some URL rewriting?
15 years ago