HttpURLConnection.getInputStream() performance problem

Joined
Nov 10, 2008
Messages
1
Reaction score
0
Hi everyone,

I'm having a problem that has me stumped--any input would be appreciated.

I have an application that makes requests to web services and reads the responses using the HttpURLConnection.getInputStream() method. When I run the application without a security manager enabled, it works in a perfectly normal manner--the results for a 60 byte request are returned in 150 ms.

But, when I enable the security manager using my own policy file, the same call to HttpURLConnection.getInputStream() takes 1000 times longer--150,000 ms.

Does anyone know why this might be? I know that the app is using the correct policy file, and I'm using the default Java security manager.

Here is the command I use to execute the app:

Code:
java -Djava.security.manager -Djava.security.policy=java.policy -jar test.jar

Here is my policy file:

Code:
grant codeBase "(url omitted)/*" {
  permission java.net.SocketPermission "*:80", "accept, connect, resolve";
  permission java.net.SocketPermission "*:8080", "accept, connect, resolve";
  permission java.lang.RuntimePermission "accessDeclaredMembers";
  permission java.lang.reflect.ReflectPermission "suppressAccessChecks";
 
  permission java.io.SerializablePermission "enableSubclassImplementation";
  permission java.io.SerializablePermission "enableSubstitution";
  permission java.lang.RuntimePermission "setFactory";
  permission java.net.NetPermission "specifyStreamHandler";
};



Thanks,
Jenn
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,537
Members
45,020
Latest member
GenesisGai

Latest Threads

Top