java

Wildcards for resources in a Tomcat Servlet's context.xml

I'm not overly familiar with Tomcat, but my team has inherited a complex project that revolves around a Java Servlet being hosted in Tomcat across many servers. Custom configuration management software is used to write out the server.xml, and various resources (connection pools, beans, server variables, etc) written into server.xml confi...

Doing away with Globals?

I have a set of tree objects with a depth somewhere in the 20s. Each of the nodes in this tree needs access to its tree's root. A couple of solutions: Each node can store a reference to the root directly (wastes memory) I can compute the root at runtime by "going up" (wastes cycles) I can use static fields (but this amounts to global...

Microsoft Reporting Services WebServices and Java

Has anyone successfully implemented a Java based solution that uses Microsoft SQL Server 2005 Reporting Services? Reporting Services comes with a set of Web Services that allow you to control the creation of a report, execution of a report, etc and I am just starting development on a POC of this integration. A couple of choices I have ...

Good Java Practices in Ubuntu

Hey all, my Computational Science course this semester is entirely in Java. I was wondering if there was a good/preferred set of tools to use in ubuntu. Currently I use gedit with a terminal running in the bottom, but I'd like an API browser. I've considered Eclipse, but it seems to bloated and unfriendly for quick programs. ...

Should I use EJB3 or Spring for my business layer?

My team is developing a new service oriented product with a web front-end. In discussions about what technologies we will use we have settled on running a JBoss application server, and Flex frontend (with possible desktop deployment using Adobe AIR), and web services to interface the client and server. We've reached an impasse when it ...

Mixing EJB 2.x BMP entity beans with Hibernate 3.x

I have a large application that uses EJB 2.x entity beans (BMP). This is well-known to be a horrible persistence strategy (I can elaborate if necessary). I'd like to start migrating this application to use a much more expressive, transparent, and non-invasive persistence strategy, and given my company's previous experience with it, Hibe...

Regex that Will Match a Java Method Declaration

I need a Regex that will match a java method declaration. I have come up with one that will match a method declaration, but it requires the opening bracket of the method to be on the same line as the declaration. If you have any suggestions to improve my regex or simply have a better one then please submit an answer. Here is my regex: "...

What's the best way to extract table content from a group of HTML files?

After cleaning a folder full of HTML files with TIDY, how can the tables content be extracted for further processing? ...

Good pattern or framework for adding auditing to an existing app?

I have an existing J2EE enterprise application to which I need to add auditing, i.e. be able to record CRUD operations on several important domain types (Employee, AdministratorRights, etc.). The application has a standard n-tier architecture: Web interface Business operations encapsulated within a mixture of stateless session beans a...

How can I find the response time of a HTTP request through a Socket

I'm using a Java socket, connected to a server. If I send a HEADER http request, how can I measure the response time from the server? Must I use a provided java timer, or is there an easier way? I'm looking for a short answer, I don't want to use other protocols etc. Obviously do I neither want to have a solution that ties my applicati...

How to default the source folder for new JUnit tests in Eclipse?

Most of our Eclipse projects have multiple source folders, for example: src/main/java src/test/java When you right-click on a class and choose New JUnit Test, the default source folder for the new test is "src/main/java" (presumably the first source folder listed in the project properties). Is there any way to change the default sou...

Using Java JAR file in .NET

What options/methods/software are available to convert a JAR file to a managed .NET assembly? Please provide all commercial and non-commercial methods in the answer. These don't include solutions which require Java to be installed on the host machine. ...

Getting The XML Data Inside Custom XPath function

Is there a way to get the current xml data when we make our own custom XPath function (see here). I know you have access to an XPathContext but is this enough? Example: Our XML: <foo> <bar>smang</bar> <fizz>buzz</fizz> </foo> Our XSL: <xsl:template match="/"> <xsl:value-of select="ourFunction()" /> </xsl:template> How do w...

Java Collections using wildcard

public static void main(String[] args) { List<? extends Object> mylist = new ArrayList<Object>(); mylist.add("Java"); // compile error } The above code (obviously) does not allow you to add elements to the list and wild cards can only be used as a signature in methods, again not for adding but only for accessing. In this case what...

How do you do paged lists in JavaServer Faces?

I have a JSF application that I am converting over to use webservices instead of straight up database queries. There are some extremely long lists that before could be returned easily with a simple SQL query. I'd like to figured out how implement the paging using JSF/web services. Is there a good design pattern for doing paged web servic...

Best way for a Swing GUI to communicate with domain logic?

I have some domain logic implemented in a number of POJOs. I want to write a Swing user interface to allow the user to initiate and see the results of various domain actions. What's the best pattern/framework/library for communications between the UI and the domain? This boils down into: the UI being able to convert a user gesture int...

Best Budget SOA Web Application Platform For Mac + Linux + Windows?

I am a Windows guy with an ASP.NET background but I have a hosted Linux server (dedicated) on the Internet, and meanwhile I'm spending more and more time on my Mac. I want to start doing web app and web service (iPhone-to-Internet services) development on the Mac, as well as some server development on my Windows laptop, and then deploy o...

When should you use java stored procedures with an Oracle database ... what are the drawbacks?

PL/SQL is not my native tongue. Oracle supports writing stored procedures in Java. What are the advantages of doing this over writing the stored procedures in PL/SQL ...

In a client-server application: How to send to the DB the user's application password?

I have an Java desktop application wich connects directly with the DB (an Oracle). The application has multiple user accounts. What is the correct method to send the user's password (not DB password) over the network? I don't want to send it in plain text ...

What's the purpose of META-INF?

In Java, you often see a META-INF folder containing some meta files. What is the purpose of this folder and what can I put there? ...