java

Should I use ACLs if I want to limit access to files on a per-group basis? If so - what's a good Java library?

Not too sure if I'm barking up the right tree, so I'm wondering if ACLs are the way to go. ...

why it returns null?

I have 3 classes that I have written some part of them below.when i write`this statement in AddStudent class ,it will show abcd1234 which is the password, but when I write it in the MainFrame class it will return null.why??? (I send my management object from MainFrame to the AddStudent with AddStudent's constructor) (I need the mana...

"contains(CharSequence s)" method in String class in JDK 1.4.2

With Java 1.5, the contains(CharSequence s) method was added to the String class. This method Returns true if and only if this string contains the specified sequence of char values. How would you do this in versions of Java prior to 1.5, specifically in version 1.4.2? ...

must do configurations in tomcat for prod configuration?

Hi, Anyone has some pointers/recipe for must/should do configurations for putting a war into production with Tomcat 6.0.20? I understand that it depends on my application, I just want to leverage the communities experience :-) My application will mainly receive webservice requests (CXF and Spring security) store them to DB (JPA/Hiberna...

Should a servlet explicitly return at the end of doGet/doPost?

Is there any difference between explicitly returning at the end of doGet or doPost-methods, and just letting the method return "by itself"? public void doGet(HttpSerlvetRequest req, HttpServletResponse resp) { <my code here> return; } public void doGet(HttpSerlvetRequest req, HttpServletResponse resp) { <my code here> } ...

Are there tools to analyse large Java heap dumps without loading the complete hprof file?

I use Eclipse MAT to analyse hprof files. It is very good but if you have a 2Gb heap dump then you need to run MAT with a 2Gb+ heap size itself to be able to load the complete heap dump. I was wondering if anyone knows of a tool that could analyse a 2Gb hprof file without using that much memory itself (e.g. it doesn't load the complete ...

making a jpa oneToMany relationship effective?

I have written a very basic and naive oneToMany relationship between a ChatComponent and its Chat Messages like this: @OneToMany List<ChatMessage> chatMessages; This basically works, i.e., doing something like: ChatMessage chatMessage = vo.toDomainObject(); chatMessage.setDate(new Date()); //Add the message to the chat component em.g...

&& (AND) and || (OR) in Java IF statements

My question might be very basic but still I think it worths to ask. I have the following code: if(!partialHits.get(req_nr).containsKey(z) || partialHits.get(req_nr).get(z) < tmpmap.get(z)){ partialHits.get(z).put(z, tmpmap.get(z)); } where partialHits is a HashMap. What will happen if the first statement is true? Will Java s...

JDBC and MS-Access problem

I'm trying to connect to an MSAccess database and retrieve some data. With simple examples all runs well but if i'm going to use some where clauses i get no data. This example is ok: PreparedStatement stm = con.prepareStatement("SELECT A.* FROM A"); ResultSet rs = stm.executeQuery(); rs.next(); The next example get no rows: Prepare...

What should I do for getting the information of the new object?

I have a Main Frame and a JDialog ,I make an object in the Main Frame and I sent it to the JDialog with its constructor ,and I assign it to the new object which has type like that.and I add some information to the new object in the JDialog but after that I need the new object's information in the Main Frame what should I do? Should I se...

How can I get the text in a JTable ?

For example I have a Table that I want to get text that's in the first column and store it in an ArrayList. ...

why this function returns null outstream

this function when called in a loop is sometimes giving null as outstream while other times not .. any reason why ? i am writing the outstream into text file sometimes i get empty text file . why ? if i run the loop 20 times .. i sometimes get empty text file on 3 random occasions sometimes 4 or 2 random occasions. what should i do ? pu...

JMS message to remote server

I need to send a message to a remote server's queue (running "JBoss MQ") so that it can process the message and act on it. Properties properties = new Properties(); properties.put(Context.INITIAL_CONTEXT_FACTORY, "org.jnp.interfaces.NamingContextFactory"); properties.put(Context.URL_PKG_PREFIXES, "org.jnp.interfaces"); p...

Overriding the JSP servlet (filter "*.jsp") to wrap in an authentication model

Hi there, Can the JSP servlet that filters on *.jsp (org.apache.jasper.servlet.JspServlet in Tomcat 6) be extended in some way so whenever someone goes to a JSP page I can do some server side authentication to check whether the user can view the page. Our current technique is a taglib in a common include that is imported into each JSP ...

Manage Session when broswer has disable cookies

Hello All... I wants to know that How can i Manage Session if the client browser has disabled cookie feature.. If I wants to implement it in simple JSP - Servlet, then how can I do that ? Thanks in advance... ...

Java snippet that causes stack overflow in the compiler or typechecker (javac)?

Yesterday at a seminar the presenter showed a small java program, with 3 classes, featuring both co-variance and contra-variance. When attempting to compile using javac, the type checker will throw a StackOverflowException. The snippet is developed by some guys that work at Microsoft (think one was called Kennedy). Can't find it using...

Best practices for regex performance VS sheer iteration

I was wondering if there are any general guidelines for when to use regex VS "string".contains("anotherString") and/or other String API calls? While above given decision for .contains() is trivial (why bother with regex if you can do this in a single call), real life brings more complex choices to make. For example, is it better to do t...

Generating XHTML from Servlet after XSL Transformation

Hi, I've written a servlet that takes some xml and xsl and produces a PDF, using ITextRenderer, and displays it on the screen. However, what I wish to do now is to display the resulting XHTML from the transformation on a webpage. I've created a new servlet which gets the xml and xsl as normal, but I'm unsure how to get the resultant XH...

How to capture the data returned from an EXE excuted from a batch?

I've a batch file that needs to be invoked from a java program. The batch file in-turn invokes an EXE. The EXE program will return data which I want to handle. If the EXE prints data to console am able to capture it as follows. But when the EXE is returning data after its completion, am not able to capture it. ProcessBuilder pb ...

post message to a remote JMS provider

I want to be able to send messages to a remote JBoss server (JBoss MQ). I can do it for a local one but i'm stuck when trying with a remote one. can anyone explain to me how to do it ? are there any specific steps to take ? [what i've tried so far] I need to send a message to a remote server's queue (running "JBoss MQ") so that it ca...