Am I responsible for closing the HttpServletResponse.getOutputStream() (or the getWriter() or even the inputstream)
or should I leave it to the container ?
protected void doGet(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
OutputStream o = response.getOutputStream();
...
...
I am using RESTlet and I have created a resource. I handle POST by overriding acceptRepresentation method.
Client should send me some data, then I store it to DB, set response to 201 (SUCCESS_CREATED) and I need to return some data to client, but return type of acceptRepresentation is void.
In my case I need to return some identificato...
Using Java 1.4.2 with unlimited jurisdiction policy files installed.
I have a class that has been successfully signing and verifying. However, now I've changed the keys and suddenly verification is failing.
Keys were generated with:
openssl genrsa -aes256 -out production_private.pem 2048
openssl pkcs8 -topk8 -nocrypt -in production_p...
With PMD, if you want to ignore a specific warning, you can use // NOPMD to have that line be ignored.
Is there something similar for FindBugs?
...
I just got an Java update notification that Update 17 is out, so I ran the update and found that only my public JRE was updated. I still only have Update 16 of the JDK.
Is there a way to have the latest JDK automatically when it's available?
Of course, the update shouldn't get rid of old versions. That should be done manually since Ecl...
How would I go about styling a SWT label created along the following lines so it is displayed italicised?
Label label = formToolkit.createLabel(composite, "My label name");
...
I am using ImageIO.write() to convert PNG files to JPG. For some reason, my result image has a pink layer over it. I have searched far and wide for a solution but haven't found any. The code works for all other types of images except PNG.
...
I'm developing a Java application and am new to using TreeMap. The program needs to keep track of the number of occurrences of each word in a text file. However, I'm having trouble putting my data into the TreeMap.
It works fine when I use the same exact code to put the data into a HashMap, but I need the data to be sorted by the value....
Hi! I just need some help with this program.
The user has to enter in the id,password,the number of max tries & the number of max uses.
And they have to go into a constructor...
Could someone help me pass them into the constructor?
I'm using java.
Thanks!
import java.util.Scanner;
public class LoginPw{
public static void main(String[...
Can someone come up with a disassembled machine code assembler listing?
I mean there must be some overhead compared to the normal function call in C.
The VM needs to track calls to find hotspots and when it uses compiled code it needs to provid ways to change the compiled method on fly if a new loaded class requires a recompilation.
I...
I didn't think I made any tweaks to my machine configuration lately but all of the sudden, after I performed a 'grails clean', followed by 'grails war', I'm unable to build my project due to: "java.lang.UnsupportedClassVersionError".
JDK: 1.5.0_19 on MacOS 10.6
Grails: 1.1.1
Groovy: 1.6.5
Here's what I get when I execute 'grails war'...
My company have a web application product for distribution planning and scheduling. An important part of it is a gantt chart component where user can fine tune the schedules. Currently the gantt chart component is pure javascript+dhtml.
I am currently looking into the possibility of moving to JavaFX to get richer interactivity and gener...
I'm having a contest with another student to make the fastest version of our homework assignment, and I'm not using an ArrayList for performance reasons (resizing the array myself cut the benchmark time from 56 seconds to 4), but I'm wondering how much I should resize the array every time I need to. Specifically the relevant parts of my ...
Hello,
I'm trying to learn about java's event handlers and keep getting errors with type type (static/non-static) methods I create. Some code I'm trying to write looks like:
import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
import java.io.*;
public class Main extends JFrame implements ActionListener{
static priva...
For my university project I am creating a neural network that can classify the likelihood that a credit card transaction is fraudulent or not. I am training with backpropagation. I am writing this in Java. I would like to apply multithreading, because my computer is a quad-core i7. It bugs me to spend hours training and see most of m...
We'd like clients to be able to control logging levels in our client JAR. What is the best way to do this?
Currently we just have a handful of log statements that write to System.out. I realize that using Log4J would solve this problem although one of our biggest clients doesn't use Log4J and uses their own custom logging implementati...
I have tried both lines of code below to no avail. The code works fine with jpg, or gif but turns the image pink if a png.
ImageIO.write(input, "jpg", profileFile);
RenderedOp op = JAI.create("filestore", input, pFileName, "jpeg");
Anyone else run into this problem? I haven't been able to find a solution.
...
To read data from my serial port I am using a inputStream and using BufferedReader for the inputStream. After each read I want clear the BufferedReader. Under the class BufferedReader there is no clear method. I tried to use reset() but it dint work. Any geeks here to suggest anything on this problem?
...
Hi,
I created RSS feed with Java Rome lib. The project is near the end. But I found some strange behavior of RSS clients.
I think it's more RSS clients problem, but i wont to make sure.
Rome holds items in List, so latest items are in the end of the list. I opened my feed I rss clients (Firefox and RSS Bandit) and I found there are in ...
Ok, so I've been doing some experiments with hash tables and different collision resolution problems. I'm trying to figure out which is more efficient for doing finds, a hash table that uses separate chaining or quadratic probing for collision resolution. My results suggest that separate chaining is faster than quadratic probing even for...