Johnny Gara

Ranch Hand
+ Follow
since Mar 09, 2007
Merit badge: grant badges
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 Johnny Gara

Bear Bibeault wrote:Aside from WEB-INF and its sub-folders, the structure is up to you.

Why are you putting source files in the war?

Lol, sorry, posted that late in the day, brain wasn't working.

I was actually thinking of the actual project build directory. So you'd have your source and test files in there as well ;)

in your actual war file, I'd assume you'd only want

js/ <-javascripts
imgs/ <-images
WEB-INF/ <- config files
WEB-INF/lib <- libraries
WEB-INF/jsp <- jsp files (thanks for the tip!)

I've been at a few jobs, and it's always seem to vary a bit. Is there a standard ("official") way to deploy applications in a war file?

src/com/(rest of your .class files)

WEB-INF/lib/(all your jar's here)
WEB-INF/classes/com/(all your property files here)

test/com/(testing classes)

jsp/(all your jsp's here) <---- I've seen all the jsp's in the root path as well

img/ <-- images
js/ <-- javascript
I'm helping in an insource of a project and am wondering if other expert java guru's out there had a list of the required documents that you'd want from the outsourced team.

I'm thinking beyond just UML, but into documents that you figure would be vital to the insource. I have documents like:

Database schema
Source Code overview -> Which I"m not even sure what this would contain yet
Package Structure Overview
Code Conventions
Deployment Process
Library Dependancies
Testing -> ?

I know that's just the tip of the iceberg, any good suggestions on people who have had to do similar projects? Best practices?

Note: I'm not sure if this is the right area for this, but there wasn't a good place I could place this thread.
15 years ago
thanks for the suggestion!

Right now, there simply isn't a reference available. The timertask is created in a seperate code block and one that i don't really have access to, all I really have is the timer. I could request for a reference to be made available though...was just hoping there'd be a simple (non-intrusive way I guess ) way to do this.
Is there any way to retrieve a TimerTask from an already running timer? I'm trying to simply update the timertask with information without killing when the next scheduled execute is suppose to take place.

Timer doesn't really leave me with much here...
Not sure if this should be in the servlet section...

but here goes:

Was wondering how you can create a user principle and bind any given role to that use.

I have a tomcat webapp, and instead of using the tomcat form based login, I was wondering if it's possible to create a simple filter that catches any attempts to access the webapp, and fill the principle in myself. (Yes, I know this is basically what the form based login with me on this ).

Creating the filter is fine, but I'm not entirely sure if you can insert the user principle so that tomcat would recognize it....
15 years ago
Good job on getting this to work, there's not a lot of good examples on making Tiles2 working with Spring2.5+.
I'm not really familiar with the commons.validator package, but usually it simply involves you referencing the correct error in your error variable.

If you are seeing all the errors, you are probably outputting your errors like (this is in STRUTS taglib):
<html:errors/> would normally print out all errors

<html:errors property="cellphone" />

would print out errors simply for the errors.cellphone

Not sure if that entirely helped, but that's probably very close to how it works in commons.validator.
I recently "rebooted: my computer, but when restarting tomcat (which may not have been allowed to gracefully shutdown), I got the following exception

Anyone know what's causing this? This makes tomcat fail to load (ie: going to http://localhost:8080 results in a hung request).
15 years ago
I'm not entirely sure about why your arg's aren't being passed in, but why are you even passing in the word Password? Why don't you simply have it say "Password is mandatory"?

If your worried about internationalization (which I can't see since you left english words), then you might have an issue...
using spring2.5, and just trying to map a url to a file


I want it to actually retrieve

I know how I'd do it if I was generating my xml file, but if the file exists I can't seem to make it work. I tried implementing the UrlFilenameViewController and basically

and while it will return what I think I want (ie, with a prefix=results, a suffix=.xml, i get /results/youwin.xml) but I get an exception:

org.apache.tiles.definition.NoSuchDefinitionException: /results/youwin.xml
Since I'm terrible at keeping track of threads lately lol:

if you are using Spring 2.5, there are a few options you do have. I actually worked around my problem by extending the ApplicationContextAware interface. Of course, this only works if you are injecting your class via spring.

Then it was as simple as using

you can also actually simplify this entire process by simply injecting in the resource as well from your servlet context xml file. This is actually probably the ocrrect way to do things.

Originally posted by Matt Zollinhofer:
In hopes of continuing the discussion, I'm running into the same problem as Johnny. I'm afraid it is just bad design, but I'm inheriting the code and am having trouble thinking outside of the current design. What is happening is that between environments we want to use different properties, for instance PLACEMARKS=TRUE vs PLACEMARKS=FALSE. So, as part of the build process the appropriate file is placed essentially in the same place Johnny referred to 'WEB-INF/config.xml'. So then the application loads the config.xml into a custom Config class and will appropriately use placemarks or not without having to think about it.

If that explanation makes any sense, any thoughts on what would be the better/best way of doing that?

Depends on your environment. Are you running springs 2.5 as well?
Is there a way to do this without the ServletContext?

Normally, if I had the servlet context, i would do a ServletContext.getResourceasStream() etc, but I'm using Spring2.5, and I have a class that I would like to have initialized automatically, but can't figure out a way to pass in the ServletContext.

in my app-context.xml

I need a file to initialize some data in the class.

I've tried doing a

InputStream in = new FileInputStream( "/WEB-INF/my.xml" );

but from my class, i get a null pointer. Any ideas?

just to add to the above post, the sax parser cannot guarantee that it has reached the end of the field.[],%20int,%20int)

so yeah, I tend to use a stack of stringbuilders to ensure that you've reached the end of the field, and in the endElement function, pop the field. That way you ensure you have the full value.
15 years ago