Win a copy of Bad Programming Practices 101 (e-book) this week in the Beginning Java forum!

Mike Zal

Ranch Hand
+ Follow
since May 04, 2011
Mike likes ...
Fedora Java Oracle
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 Mike Zal

I am working on a webapp that logs into Tomcat A for its initial call. The JSP file that gets returned needs to get periodic updates from Tomcat B and Tomcat C by using Dojo ajax calls. Luckily the project requires require support for only Firefox 8+, which means that the Access-Control-Allow-Origin header should be enough to fix this problem. I was looking at the CORS Filter. It looks like it could solve the problem, but the security team is too backed up that they wouldn't have time to vet it until long after the delivery date.

Is there some way to configure Tomcat to enable CORS? I saw some mention of a crossdomain.xml file in some Flex discussions but have not found any documentation on how to use it. Is the only option available to create a Servlet Filter that mirrors the CORS Filter or does anyone know of some alternatives?
6 years ago
I did not check your link, but did you update your Tomcat configuration files to actual listen on port 8443?

Maybe you should follow the Official Tomcat SSL Setup documentation
6 years ago
I am not a rest expert, but based a few reference materials I think I can make a few improvements

1) You need to specify the param name in @Path annotation
2) You should be using the default constructor for the class
3) You need to specify the @PathParam annotation on the methods that have the HTML annotations

Try the following changes:

The corresponding URL: http://localhost:8084/REST_Jersey_Demo/resources/demo/100

If you are dead set of using query parameters you can try the following

In this case the original url should still work
6 years ago
Here is an example of How to batch calls with a Prepared Statement. You should use it inside your while loop. Your current code try to make a network round trip for each result in your first query.

Note: The executeBatch call returns an int array so you know how many rows were affected by each query.
Welcome to the boards. Before discussing your problem, you will want to update your code to close your database resources (ResultSet, Connection, .etc). It is preferred if you encapuslate your code within code tags and try to do some space formatting when posting on the message board. It makes it a little easier to read. Just a reminder, that this community will not write code for you. You can receive design ideas/feedback or help trouble shooting though, but we are NotACodeMill.

With that out of the way. What do you want to accomplish by turning this into a web service? What are your requirements? Inputs/Outputs? Do you want to return the data from the sql or a renedered chart? What type of web service are you trying to create: SOAP or REST? We cannot help unless you TellTheDetails.
6 years ago
My understanding of the experience (given the job is for a developer position) means if someone sat you in front of a linux machine and gave you the install files for all your COTS/FOSS, could you install and configure the machine to compile and run the given source code. I think the requirement is a warning for "we develop on linux boxes and we don't want to spend time holding your hand teaching you about how to setup your environment variables". That might be different if the job is for an administrator position.
6 years ago

There is a link at the top/tab of the pearsonvue homepage that is labeled "Come a Test Center"
I know that you can reschedule to a different date, but I am not sure if you can change the exam. If you need an answer, your best option is to call the pearsonvue customer service support line.
You should read the books errata page

Page 249
2nd Answer's Result (Last paragraph) of Chapter 6

IllegalStateException is thrown before it reach the isNew() method on session. Since session.setMaxInactiveInterval(0) will cause the session invalidated immediately, the next line of code session.getAttribute("foo") method will throw IllegalStateException before it reach session.isNew() method.

Note from the Author or Editor:

Remove the line of code that reads "String foo = (String) session.getAttribute("foo");
On pg 249: also remove that line

Your code never gets to perform the database execution. Here is what is happening in your code.

You call the tag file with mgr attribute value set as "Chris Novish"
Inside the tag file, the useBean tag creates a session scope bean with default values (zero length array, size = 0, and mgrid = null)
The setProperty tag sets the value of the bean to mgrid to "Chris Novish"
Immediately after, you print the size and mgrid properties which value the values 0 and "Chris Novish"

Also, there is no reason to save the length of the array as an instance variables, just has getSize return the length of the iRecords array.

Another big no-no, you should not have public instance variables. You should always follow the rules of encapsulation.
7 years ago
The setProperty tag has three attributes

1) name: value that matches the id of the useBean tag
2) property: the name of the bean's property to set
3) value: the value to set

You combined the name and property value into one attribute. It does not like when you do that.
7 years ago
Oracle Certification Blog Post

Some interactive question types were removed from several Java and Solaris exams (including "matching" and "drag-and-drop" questions).

That sounds a lot like Kerberos
7 years ago
If you look at the java.sql.Date javadoc, it has a constructor that takes a long as its constructor. The java.util.Date class has a method that returns a long. It should not be hard to convert the two.
7 years ago