I wanna know that how we can identify whether a page is redirecting to some other web page or not?
I'm using URLConnection class of java.
One way that i know is, to check the headerfield 'Location' of the connection established.
But i'm not getting the solution :-(
Plz assist.
...
Hi All,
This is a general question on how to unit-test a Java Class using mock objects.
I can summarize my problem with this example. Let's say I've an Interface called MyInterface.java and a "TwoString" Object that doesn't override equals()
"TwoString.java"
private String string1;
private String string2;
public TwoString(...
Q1. What is a condVar in Java? If I see the code below, does a condition variable necessarily have to be within the 'mutex.acquire()' and 'mutex.release()' block?
public void put(Object x) throws InterruptedException {
mutex.acquire();
try {
while (count == array.length)
notFull.await();
array[putPtr] = x;
...
Hello,
I want to auto-schedule a thread with a particular time interval. I also need to execute this in the background continously without hangs to the device.
I have tried this with Application Manager Class but it's for application scheduling and I need to schedule thread within the application.
...
Hello,
I'm the following situation.
At web application startup I need to load a Map which is thereafter used by multiple incoming threads. That is, requests comes in and the Map is used to find out whether it contains a particular key and if so the value (the object) is retrieved and associated to another object.
Now, at times the co...
Hi!
In netbeans you can choose to work on "design" or "source". If you don't have a form file, netbeans won't let you see the design and work on that with drag and drop.
I have some existing code with much swing. How can I use the "design" mode in netbeans on that code? To me it seams I can only use the "design" mode if I create a new e...
I have created a java based project using Netbeans as an IDE. Now I want to obfuscate my project. How can this be done?
...
I'm using Java's ProcessBuilder class to run an external process. The process should not terminate before the Java program does; it must stay alive in command/response mode.
I know that the process streams may easily 'jam' if neglected, so I've done the following:
The program reads the process's combined output and error streams in a "r...
I'm using a XYPlot to show a line graph with 1 or more lines in it. I have it combined with a listener pattern so it can receive updates: if so, it removes the lines using a dataset.removeAllSeries() (dataset is of type XYSeriesCollection) call, and then adds the new lines using dataset.addSeries(...) However, a new graph with new lines ...
I'm having an issue with a SELECT NEW query.
Query q = em.createQuery(
"SELECT NEW com.bcbst.odstats.ejb.RangeStats(a.folderName, SUM(a.hits)) " +
"FROM ODStat a GROUP BY a.folderName");
return q.getResultList();
I get the following stacktrace when I try to run this query. RangeStats does have public methods, ...
I'm executing a shell pipeline from a java program - it'll be something like
ProcessBuilder builder = new ProcessBuilder(
"sh", "-c", "program1 | program2 | program3");
builder.start();
In some cases this unit might need to be terminated. However
process.destroy();
Will only destroy the "sh" command. The co...
Now I've heard the expression maths is the language if the universe; and most languages are based on maths.
But today i got into a heated discussion with my head of department over whether a bachelors degree in Ireland is the same as in America. The result was inconclusive. His main reason was that languages aren't the same everywhere!
...
I wrote a Java class that parses a bpel text file and then returns a count of the number of occurences of certain words. I wanted to convert it to VB2008 Forms application, so that its results are displayed in a TextBox and not on the console. The problem is that VB2008 lacks Scanner and StringTokenizer classes, which are in my current J...
My output should be something like this:
<result>
<item>
<id>123</id>
<src>123</src>
<dst>123</dst>
</item>
<item>
<!-- ... -->
</item>
</result>
And the action class would have a method getFoos which returns an array of uniform objects, e. g. like this:
class Foo {
// ...
public long getId() { ... }
// .....
Hi,
is there some way to terminate all (Java) applications launched with Eclipse at once?
br, Touko
...
I'm currently having a self signed certificate for my HTTPS webserver.
In my java program there is a SSLSocketFactory that will create a socket to the webserver. The default implementation of sun blocks the self signed certificate. With an own implementation of a X509TrustManager I can only check whether the date of the certificate is v...
Hi,
I was wondering why in java constructors are not inherited? You know when you have a class like this:
public class Super {
public Super(ServiceA serviceA, ServiceB serviceB, ServiceC serviceC){
this.serviceA = serviceA;
//etc
}
}
Later when you inherit from Super, java will complain that there is no default constru...
I have a form with (at the moment) two fields and submit the following:
capture.id = 213
capture.description = DescriptionText
The target object 'capture' is immutable and I would like to provide a type converter to take both values and call the constructor. What I cannot seem to do is get by TypeConverter to be invoked.
If the input...
I wish to use Spring MVC to provide a REST web service. However, running through some books and tutorials, it looks like ModelAndView always returns a parsed JSP file. I guess I could make the JSP build my XML document, but is this the best way to go about things? I thought that perhaps a more structured XML building approach might be ap...
Is it possible to search on date ranges using Lucene in Java? How do I build Lucene search queries based on date fields and dates ranges? For example:
between specified dates
prior to a specified date
after a specified date
within the last 24 hours
within the past week
within the past month.
[Edit] i'm using Lucene 2.4.1 and my syste...