Daniel Brookshier wrote about a cool app he developed using JXTA & the java.awt.Robot class. I can’t seen to get the app to work, but it’s probably because I don’t have JXTA configured correctly.
Category Archives: J2EE
New I/O Channels
Jason Hunter wrote an article for Oracle entitled New I/O Channels.
Why Web Developers Need JavaServer Faces
Short article at onjava.com entitled: Why Web Developers Need JavaServer Faces. Not much meat to it, but it sure the sparks are flying the comments section. If you don’t want to read it, here’s my data extraction:
· JSF prescribes an architecture for UI rendering to different clients.
· JSF provides rich client like event handling.
· JSF defines functionality for data conversion, validation, and localization.
That’s it… the entire support for why Web Developers need JSF. Pretty weak isn’t it?
C# From a Java Developer’s Perspective
C# From a Java Developer’s Perspective: A Comparison of Microsoft’s C# programming language to Sun Microsystems’ Java programming language. [via thauvin.net]
Oreilly OSCON Java sessions
OSCON Java sessions are now available for download. [via thauvin]
Jakarta Latka
I have a peculiar interest in testing tools… I’ve mentioned JMeter (which is more of a stress testing tool) a couple times before, I just found a new one on the Jakarta site call Latka, which “… is a functional (end-to-end) testing tool. It is implemented in Java, and uses an XML syntax to define a series of HTTP (or HTTPS) requests and a set of validations used to verify that the request was processed correctly.”
The cool thing about Latka is the non Java part… anyone that understands a little XML can create and/or edit an xml document that defines an ‘test’ and then run it using the Latka engine. So for instance, here at Mindseye our QA team is composed of invididuals with a small amount of programming experience. They could easily create a Lakta test using the xml syntax and then automate the testing of various applications using Latka. Still not convinced, here’s a sample test:
<?xml version=”1.0″ standalone=”no”?>
<!DOCTYPE suite PUBLIC “-//Apache Software Foundation/DTD Latka Test Suite 1.0/EN”
“http://jakarta.apache.org/commons/latka/dtds/1.0/suite.dtd”>
<suite defaultHost=”http://www.mindseye.com” label=”mindseye”>
<request path=”/whymindseye/default.cfm” label=”why you should choose mindseye” method=”get” secure=”false” followRedirects=”true”>
<validate>
<statusCode code=”200″ />
<regexp pattern=”What drives landmark companies” />
</validate>
</request>
</suite>
Save this to a file and then type:
latka file:PATH_TO_FILE
from the command line. It should check that the page http://www.mindseye.com/whymindseye/default.cfm returns an HTTP status code 200 and that it contains the phrase “What drives landmark companies”.
Unfortunately, Latka doesn’t appear that anyone is working on it (at least since last July).
On a related note, I also found this Slashdot discussion on “Testing Products for Web Applications?“.
100 New Java Performance Tuning Tips
“Java Performance Tuning author Jack Shirazi attended 8 J1 performance sessions and published a big bulleted list with 100 new insights gained from these talks, from trivial stuff like ‘use lazy loading’ to cool stuff like ‘Chose optimistic concurrency for CMPs with read-mostly access’ and ‘in servlets, set content length; for JSP pages, set UseOutputStreamSize’.” Read about here. [via theserverside.com]
Utilize the SSHTools Toolkit
From the builder.com newsletter: “Even though you may have used SSH clients, have you ever needed to implement one? If you do need to implement an SSH client, then you may find the J2SSH API of the SSHTools project useful. (The J2SSH API is the SSH component of the toolkit.)”
Read more at Sshtools.com
Calling Java Constructors with ColdFusion
I mentioned yesterday that Sam posted some great code that lets you upload files to ColdFusion without using CFFILE. His code can be shortened considerably with the use of the init() method:
<cfscript>
fileAsString = “”;
fileReader = createObject(“java”, “java.io.FileReader”);
fileReader.init(form.upFile);
bufferedReader = createObject(“java”, “java.io.BufferedReader”);
bufferedReader.init(fileReader);
try {
do {
fileAsString = bufferedReader.readLine();
processLine(fileAsString);
} while (true);
} catch (coldfusion.runtime.UndefinedVariableException e) {
// this indicates end of file, ok to ignore error
}
</cfscript>
Basically, you use the CreateObject() function to get a Java object. At that point, you can call static methods on the object or you can use the init() method to call the constructor of the Java object, which I’ve done above, ie:
// get a FileReader object
fileReader = createObject(“java”, “java.io.FileReader”);
// call the FileReader object constructor
fileReader.init(form.upFile);
If you’re curious about this kind of stuff, you should check out the article on Java, ColdFusion MX and Lucene integration I wrote for the July issue of ColdFusion Developer’s Journal, due to hit the stands anytime now.
Lucene HTML Parser alternative
If you’ve ever wanted to embed/use the HTMLParser class in the org.apache.lucene.demo.html package in your own software but wanted a pure Java solution, you should check out the HTMLParser project on sourceforge. It includes classes that handle link extraction, email address ripping, a sample crawling robot, and a class that extracts the text (minus tags) of an HTML page. [via lucene user]