Win a copy of Microservices in Action this week in the Web Services forum!

anirudh takkallapally

Greenhorn
+ Follow
since Sep 04, 2003
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by anirudh takkallapally

Thanks for the reply Norm, i am using URLClassLoader to load the config.jar file into JVM, dont have the jar file on the local file system. The only solution i could come up with is to have a file called directorylisting.xml in the jar file, this directorylisting.xml would contain the list of files and the directory structure inside the jar file and when i need to know the list of files i would just access the directorylisting.xml inside the jar file.

Please do let me know if you have an alternate solution.

thank you,
anirudh
13 years ago
Hi,
I have a Config.jar file on the server, which contains xml files inside some subdirectories. When my applet gets loaded the config.jar file loads into my local machine and I can access the files from it using ClassName.class.getResourceAsStream(config\filename.xml);

Now the problem I have to list the entire contents of the config.jar file once I get it onto the local system. I tried something very lame like ClassName.class.getResourceAsStream(config), where config is the name of the directory, so that I could get the directory and once I have that, I could just list the contents of the directory, it didn�t work.

Is there a way of listing the contents once the jar file is loaded into JVM?

Thank you,
anirudh
13 years ago
Thanks Joe, will look into Java Webstart and see if it has some solution for me.
13 years ago
We are trying to reduce the number of network calls made before the applet is actually started. Right now the way the applet is written, whenever the applet needs a configuration file it goes to the server to get it. There are quite a few number of configuration files in a separate folder called config in the server.

We came up with the idea of making a jar of the config directory, getting it to the local system when the applet is loading and accessing the config.jar file when ever we need a config file. All the configuration files are in XML.

Is there a way to get the config.jar from the server into the local system and access it through the applet? This config.jar will contain subdirectories with XML files in them.

If we cannot do it this way, is there any other better way of reducing the network calls.

Thank you,
anirudh
13 years ago
I have a servlet invoked from an applet , i am trying to debug this servlet program , the communication between the applet and servlet is fine , in the servlet i am trying to create a file ..., which it is not doing ,
basically i would like to know how to view the exceptions that are thrown by the system , i am able to view these exceptions on a tomcat terminal window which comes when i start the server on my standalone windows machine , but there is no terminal window comming on unix machine where i am trying to run the program ,
is there a way to view the exceptions that are generated by the system and how do i view them???
please help
thx..............
15 years ago
i am not getting the terminal window for the server on the machine
, is there a way to look for the exceptions that are generated ??? ,
please help me out here..
thanks ...............
15 years ago
hi!! ,
i have loaded tomcat server on to my local machine and i am running my servlets on that. i have written a servlet to create a file , i am calling this servlet from a applet ,it is working fine on my server , but when i loaded it onto another tomcat server which is the main server which hosts websites , i am not able to create a file , the communication between the applet and servle and the applet is fine ,
try {
File outputFile = new File("window_surf_test");
FileOutputStream fos = new FileOutputStream(outputFile);
PrintWriter pwriter = new PrintWriter(fos);
pwriter.println(stringValue1);
pwriter.println(stringValue2);
pwriter.println(stringValue3);
//pwriter.println(f);
System.out.println( " Check the result: " + stringValue2 );
pwriter.close();
fos.close();
} catch (FileNotFoundException e) {
System.err.println("FileStreamsTest: " + e);
}

this is the code i am using to create the file , please tell me what could be the possable reason for not creating the file on the other server
are there any security issues that have to be resolved....
another question , where exactly is the file created??? i mean the path..
thanks......
15 years ago
hi ,
i have an applet , when the user press the submit button on the applet a image should be displayed on a new window ,
please tell how this can be done
thanks....
15 years ago
hi ,
i have a unix machine , form this machine i have to send some data to a linux machine and invoke a process in the linux machine, this process will generate a GIF image , i have to capture that GIF image and get the image back to the unix machine.....
can any body please tell me how to connect to the linux machine , invoke a process and get the image back... , the unix and linux machine are in the netwok..
please help....
thanks...
hi ,
i am sending a few varibles form an applet to a servlet , here the servlet has to invoke a process and supply these varibles to that process , this process generates graph its GIF image , i have to display this image ,i have to dispaly the image in a new window not in the one with the applet .Can i just generate a HTML file using the servlet and insert the image in the HTML file or do i have to send the image back to the applet which started the servlet so that the graph can be displayed if so how do i put the image in a new window???
please help..
15 years ago
hi,
the problem is i am not able to debug my code , well for testing purpose i am trying to send an objet to the servlet make some manipulations to it and trying to get it back , but when i click on the submit button on my applet nothing is happening , well my applet is on also on the server.. , please look into this code and tell me if u can find any obvious mistakes....
this is my applet code
public class PipelineApplet3 extends Applet implements ActionListener
{
private static final String servlet="http://localhost:8080/examples/servlet/PipelineServlet3";
private Label text ;
String msg;
public class TestVar implements Serializable
{
private void writeObject(java.io.ObjectOutputStream out){}
//throws IOException;
private void readObject(java.io.ObjectInputStream in){}
//throws IOException;
int x,y;
String mesg;
};
TestVar ob= new TestVar();
private URLConnection getConnection() throws IOException
{
URL u =new URL( servlet );
URLConnection con = u.openConnection();
con.setDoInput( true );
con.setDoOutput( true );
con.setUseCaches( false );
con.setAllowUserInteraction( false );
return con ;
}
private void sendObject( URLConnection con , Object obj ) throws
IOException
{
ObjectOutputStream out = new ObjectOutputStream(
con.getOutputStream() );
if ( obj != null )
{
out.writeObject(obj);
}
out.close();
}
private Object receiveObject( URLConnection con ) throws Exception
{
ObjectInputStream in = new ObjectInputStream( con.getInputStream() );
Object obj = in.readObject();
in.close();
return obj ;
}
public void actionPerformed( ActionEvent e )
{
try
{
URLConnection con = getConnection();
sendObject( con , ob );
TestVar s = (TestVar)receiveObject( con );
msg=s.mesg;
repaint();
}catch( Exception ex){
System.out.println("Curses ! Foiled again: " + ex );
}
}
public void init()
{
ob.x=10;
ob.y=20;
ob.mesg="anirudh";
Button b = new Button("Test!");
b.addActionListener(this);
add(b);
//text = new Label(" the world is become a big ");
//add(text);
}

public void paint (Graphics g) {
g.drawString(msg,200,120);
}
}
and this is my servlet code,
public class PipelineServlet3 extends HttpServlet {
public class TestVar implements Serializable
{
private void writeObject(java.io.ObjectOutputStream out){}
//throws IOException;
private void readObject(java.io.ObjectInputStream in){}
//throws IOException;
int x,y;
String mesg;
};
private Object receiveObject( HttpServletRequest req ) throws Exception
{
ObjectInputStream in = new ObjectInputStream( req.getInputStream() );
Object obj = in.readObject();
in.close();
return obj ;
}
private void sendObject( HttpServletResponse resp ,Object obj )
throws Exception
{
ObjectOutputStream out = new ObjectOutputStream( resp.getOutputStream() );
out.writeObject( obj );
out.close();
}
public void doPost( HttpServletRequest req ,HttpServletResponse resp )
{
try {
Object obj = receiveObject( req );
TestVar ob=(TestVar)obj;
ob.x=ob.x+10;
ob.y=ob.y+20;
ob.mesg="BOB";
sendObject( resp , ob );
}catch ( Exception e ) {
System.out.println( " Clang! thunk: " + e );
}
}
}
15 years ago
hi,
the problem is i am not able to debug my code , well for testing purpose i am trying to send an objet to the servlet make some manipulations to it and trying to get it back , but when i click on the submit button on my applet nothing is happening , well my applet is on also on the server.. , please look into this code and tell me if u can find any obvious mistakes....

this is my applet code
public class PipelineApplet3 extends Applet implements ActionListener
{
private static final String servlet="http://localhost:8080/examples/servlet/PipelineServlet3";
private Label text ;
String msg;
public class TestVar implements Serializable
{
private void writeObject(java.io.ObjectOutputStream out){}
//throws IOException;
private void readObject(java.io.ObjectInputStream in){}
//throws IOException;
int x,y;
String mesg;
};
TestVar ob= new TestVar();
private URLConnection getConnection() throws IOException
{
URL u =new URL( servlet );
URLConnection con = u.openConnection();
con.setDoInput( true );
con.setDoOutput( true );
con.setUseCaches( false );
con.setAllowUserInteraction( false );
return con ;
}
private void sendObject( URLConnection con , Object obj ) throws
IOException
{
ObjectOutputStream out = new ObjectOutputStream(
con.getOutputStream() );
if ( obj != null )
{
out.writeObject(obj);
}
out.close();
}
private Object receiveObject( URLConnection con ) throws Exception
{
ObjectInputStream in = new ObjectInputStream( con.getInputStream() );
Object obj = in.readObject();
in.close();
return obj ;
}
public void actionPerformed( ActionEvent e )
{
try
{
URLConnection con = getConnection();
sendObject( con , ob );
TestVar s = (TestVar)receiveObject( con );
msg=s.mesg;
repaint();
}catch( Exception ex){
System.out.println("Curses ! Foiled again: " + ex );
}
}
public void init()
{
ob.x=10;
ob.y=20;
ob.mesg="anirudh";
Button b = new Button("Test!");
b.addActionListener(this);
add(b);
//text = new Label(" the world is become a big ");
//add(text);
}

public void paint (Graphics g) {
g.drawString(msg,200,120);
}
}
and this is my servlet code,
public class PipelineServlet3 extends HttpServlet {
public class TestVar implements Serializable
{
private void writeObject(java.io.ObjectOutputStream out){}
//throws IOException;
private void readObject(java.io.ObjectInputStream in){}
//throws IOException;
int x,y;
String mesg;
};
private Object receiveObject( HttpServletRequest req ) throws Exception
{
ObjectInputStream in = new ObjectInputStream( req.getInputStream() );
Object obj = in.readObject();
in.close();
return obj ;
}
private void sendObject( HttpServletResponse resp ,Object obj )
throws Exception
{
ObjectOutputStream out = new ObjectOutputStream( resp.getOutputStream() );
out.writeObject( obj );
out.close();
}

public void doPost( HttpServletRequest req ,HttpServletResponse resp )
{
try {
Object obj = receiveObject( req );
TestVar ob=(TestVar)obj;
ob.x=ob.x+10;
ob.y=ob.y+20;
ob.mesg="BOB";

sendObject( resp , ob );
}catch ( Exception e ) {
System.out.println( " Clang! thunk: " + e );
}
}
}
15 years ago
hi ,
i need to send 4 ints 2 strings to a servlet from an applet , the servlet invokes a process with this information and generates a graph , i have to display this graph .
my main question is how to send the information to the servlet , i have tried to serialize the object like this
public class TestVar implements Serializable
{
private void writeObject(java.io.ObjectOutputStream out){}
//throws IOException;
private void readObject(java.io.ObjectInputStream in){}
//throws IOException;
int x,y;
String mesg;
};
and using the post method to send this object but it dint work.
Please tell me if this is right , and if u can provide me with a working code for passing the parameters form applet to servlet ,i would appriciate it.
15 years ago
Hi.
I am doing a project in which I have to send some data from applet to the servlet , where the servlet has to invoke a process with this data , the process generates a figure , I have to display this figure to the client.
I have two questions , how do I send the data , the data basically consists of 4 ints and 3 strings, can I create an object with these and send it directly or do I need to do object serialization before sending them , I tried sending them but it did not work, if u have any working code for this I would appreciate it if u can send me other wise please guide me how to do this.
My second question is , when I am doing applet servlet communication can I display a HTML page using a servlet , that is after invoking a servlet from the applet .
I would be grateful if u can help me out here,
Yours sincerely
Anirudh Takkallapally
15 years ago