sakthivel shanmugam

Greenhorn
+ Follow
since Nov 10, 2002
Merit badge: grant badges
For More
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 sakthivel shanmugam

Dear All,
I want to set some values in my config file in the domino server and fetch it from my servlet file....

using the code as:
**************
Properties parameters = new Properties();
String filewithroot = getServletConfig().getInitParameter("configFile");
try
{
File file_temp = new File(filewithroot);
BufferedInputStream bis = new BufferedInputStream(new FileInputStream(file_temp),buffersize);
parameters.load(bis);
if(parameters != null)
{
path = parameters.getProperty("ereview.servlet.path");
path_stylesheet = parameters.getProperty("finishedmeetings.stylesheet.path");
}
}
catch(Exception exception)
{}

which is that config file?? becoz i dont found any config file over here...or should i go for the creation of a new config file.....if so, what should be the name and extension of that config file....also, where(in which directory) it should be placed in the server...also, should i do some setting changes in the domino server.
pl. post a reply,
with rgds,
Sakthive S.
21 years ago
Dear All,
I have a problem over here, in the transfer of file from my client machine to the server machine....I am zipping the file in the client machine and sending to the server machine....In the server machine I am trying to unzip it and write it over there....
For contacting my server, initially i am getting the authentication.....it is all correct....no problem with the authentication work...the problem over here is.............i am having 3 files to be transfered to my server machine...the first file is getting transfered....after that the command prompt is just standing idle....it is not even coming to the prompt state...it is not even thowing any errors in the server console or in the client machine....

Below is my complete code....
Client program: (simple java program)
****************************
import java.io.BufferedInputStream;
import java.io.IOException;
import java.util.zip.ZipEntry;
import java.util.zip.ZipOutputStream;
import java.io.*;
import java.text.*;
import java.util.*;
import java.net.*;
import java.sql.*;
class testprogram
{
HttpURLConnection urlconnection = null;
public static void main(String args[])
{
String file1="F:/Domino/Data/Applications/Groupware/HP/input/Invcor02/param/new1.txt";
String file2="F:/Domino/Data/Applications/Groupware/HP/input/Invcor02/param/new2.txt";
String file3="F:/Domino/Data/Applications/Groupware/HP/input/Invcor02/param/new3.txt";
String name1="new1.txt";
String name2 ="new2.txt";
String name3="new3.txt";
testprogram tt=new testprogram();
try
{
tt.makeConnection();
tt.zipper(file1,name1);
tt.zipper(file2,name2);
tt.zipper(file3,name3);
tt.disconnectConnection();
}
catch(Exception e){}
}
public void zipper(String file,String name) throws Exception
{
try
{
ZipOutputStream zipoutputstream = new ZipOutputStream(urlconnection.getOutputStream());
ZipEntry zipentry = new ZipEntry(name);
zipentry.setMethod(ZipEntry.DEFLATED);
zipoutputstream.putNextEntry(zipentry);
byte bytearray[] = new byte[1024];
File filedir = new File(file);
FileInputStream fileinputstream = new FileInputStream(filedir);
BufferedInputStream bufferedinputstream = new BufferedInputStream(fileinputstream);
int length = 0;
while((length=bufferedinputstream.read(bytearray)) != -1)
{
zipoutputstream.write(bytearray,0,length);
}
fileinputstream.close();
bufferedinputstream.close();
zipoutputstream.flush();
zipoutputstream.finish();
zipoutputstream.closeEntry();
zipoutputstream.close();
System.out.println("I am here...");
InputStream in = urlconnection.getInputStream();
while (in.read()!=-1);
}
catch(Exception exp)
{System.out.println("I am from client: " + exp);}
}
/* to make the URL connection with the server - begin */
public void makeConnection()
{
/* Authentication work is done over here - begin */
String setcookie="";
String cookie="";
try
{
URL theurl = new URL("http://192.168.10.55:8001/names.nsf?login&username=sakthivel&password=12345");
HttpURLConnection.setFollowRedirects(false);
HttpURLConnection hurl = (HttpURLConnection)theurl.openConnection();
hurl.connect();
setcookie = hurl.getHeaderField ("set-cookie");
int index=setcookie.indexOf(";");
cookie=(setcookie.substring(0,index)).trim();
hurl.disconnect();
hurl=null;
theurl=null;
}
catch(Exception exp){exp.printStackTrace();}
/* Authentication work is done over here - end */
/* to make the URL connection with the server - begin */
try
{
URL serverURL = new URL("http://192.168.10.55:8001/servlet/FileUploadServlet");
urlconnection= (HttpURLConnection)serverURL.openConnection();
urlconnection.setDoOutput(true);
urlconnection.setRequestMethod("POST");
urlconnection.setRequestProperty("Cookie",cookie);
}
catch(Exception exp)
{System.out.println("Client machine: Error in Making Connection" + exp );}
/* to make the URL connection with the server - end */
}
/* to disconnect the URL connection with the server - begin */
public void disconnectConnection()
{
try
{
System.runFinalization();
urlconnection.disconnect();
urlconnection.getInputStream().close();
}
catch(Exception exp)
{System.out.println("Client machine: Error gets fired while disconnecting the connection" + exp);}
}
}
/* to disconnect the URL connection with the server - end */
My Server side Program(servlet program)
*******************************
import java.io.BufferedOutputStream;
import java.io.IOException;
import java.util.zip.ZipEntry;
import java.util.zip.ZipInputStream;
import java.io.*;
import java.util.*;
import javax.servlet.*;
import javax.servlet.http.*;

public class FileUploadServlet extends HttpServlet
{
public void init() throws ServletException
{}
public void doPost(HttpServletRequest httpservletrequest, HttpServletResponse httpservletresponse) throws ServletException, IOException
{
try{UnzipAndWriteToDir(httpservletrequest, httpservletresponse);}
catch(Exception exp){System.out.println("I am from server............" + exp);}
}
public void UnzipAndWriteToDir(HttpServletRequest httpservletrequest, HttpServletResponse httpservletresponse) throws Exception
{
javax.servlet.ServletInputStream servletinputstream = httpservletrequest.getInputStream();
ZipInputStream zipinputstream = new ZipInputStream(servletinputstream);
ZipEntry zipentry = null;
String directory="c:\\test";
try
{
File file = new File(directory);
if(!file.exists())
file.mkdirs();
}
catch(Exception exp)
{System.out.println("I am from Server: " + exp);}
try
{
zipentry = zipinputstream.getNextEntry();
if(zipentry != null)
{
int slash = zipentry.getName().lastIndexOf(File.separator) + 1;
String filename = zipentry.getName().substring(slash);
File file1 = new File(directory + File.separator + filename);
BufferedOutputStream bufferedoutputstream = new BufferedOutputStream(new FileOutputStream(file1));
byte abyte0[] = new byte[1024];
for(int index = 0; (index = zipinputstream.read(abyte0)) > 0
bufferedoutputstream.write(abyte0, 0, index);
bufferedoutputstream.flush();
bufferedoutputstream.close();
zipinputstream.closeEntry();
zipinputstream.close();
}
}
catch(IOException ioexception)
{System.out.println("IOException occured in the Server: " + ioexception);}
} // end of the method...
} // end of the class
P.S: Here, I am using the Domino Server, which is same as the Web Logic Server......Pl. post a reply....hanging over here for the past one week...any suggestion is highly appreciated....

After wasting around 5 hrs, i have found that the statement
"InputStream in = urlconnection.getInputStream();" (in the client program)
is making the comand prompt to be idle....is it a bug with sun java....or is there any solution for this......i mean the link with the server, is just as it is without disconnecting....
21 years ago
Dear All,
I have a problem over here, in the transfer of file from my client machine to the server machine....I am zipping the file in the client machine and sending to the server machine....In the server machine I am trying to unzip it and write it over there....
For contacting my server, initially i am getting the authentication.....it is all correct....no problem with the authentication work...the problem over here is.............i am having 3 files to be transfered to my server machine...the first file is getting transfered....after that the command prompt is just standing idle....it is not even coming to the prompt state...it is not even thowing any errors in the server console or in the client machine....

Below is my complete code....
Client program: (simple java program)
****************************
import java.io.BufferedInputStream;
import java.io.IOException;
import java.util.zip.ZipEntry;
import java.util.zip.ZipOutputStream;
import java.io.*;
import java.text.*;
import java.util.*;
import java.net.*;
import java.sql.*;
class testprogram
{
HttpURLConnection urlconnection = null;
public static void main(String args[])
{
String file1="F:/Domino/Data/Applications/Groupware/HP/input/Invcor02/param/new1.txt";
String file2="F:/Domino/Data/Applications/Groupware/HP/input/Invcor02/param/new2.txt";
String file3="F:/Domino/Data/Applications/Groupware/HP/input/Invcor02/param/new3.txt";
String name1="new1.txt";
String name2 ="new2.txt";
String name3="new3.txt";
testprogram tt=new testprogram();
try
{
tt.makeConnection();
tt.zipper(file1,name1);
tt.zipper(file2,name2);
tt.zipper(file3,name3);
tt.disconnectConnection();
}
catch(Exception e){}
}
public void zipper(String file,String name) throws Exception
{
try
{
ZipOutputStream zipoutputstream = new ZipOutputStream(urlconnection.getOutputStream());
ZipEntry zipentry = new ZipEntry(name);
zipentry.setMethod(ZipEntry.DEFLATED);
zipoutputstream.putNextEntry(zipentry);
byte bytearray[] = new byte[1024];
File filedir = new File(file);
FileInputStream fileinputstream = new FileInputStream(filedir);
BufferedInputStream bufferedinputstream = new BufferedInputStream(fileinputstream);
int length = 0;
while((length=bufferedinputstream.read(bytearray)) != -1)
{
zipoutputstream.write(bytearray,0,length);
}
fileinputstream.close();
bufferedinputstream.close();
zipoutputstream.flush();
zipoutputstream.finish();
zipoutputstream.closeEntry();
zipoutputstream.close();
System.out.println("I am here...");
InputStream in = urlconnection.getInputStream();
while (in.read()!=-1);
}
catch(Exception exp)
{System.out.println("I am from client: " + exp);}
}
/* to make the URL connection with the server - begin */
public void makeConnection()
{
/* Authentication work is done over here - begin */
String setcookie="";
String cookie="";
try
{
URL theurl = new URL("http://192.168.10.55:8001/names.nsf?login&username=sakthivel&password=12345");
HttpURLConnection.setFollowRedirects(false);
HttpURLConnection hurl = (HttpURLConnection)theurl.openConnection();
hurl.connect();
setcookie = hurl.getHeaderField ("set-cookie");
int index=setcookie.indexOf(";");
cookie=(setcookie.substring(0,index)).trim();
hurl.disconnect();
hurl=null;
theurl=null;
}
catch(Exception exp){exp.printStackTrace();}
/* Authentication work is done over here - end */
/* to make the URL connection with the server - begin */
try
{
URL serverURL = new URL("http://192.168.10.55:8001/servlet/FileUploadServlet");
urlconnection= (HttpURLConnection)serverURL.openConnection();
urlconnection.setDoOutput(true);
urlconnection.setRequestMethod("POST");
urlconnection.setRequestProperty("Cookie",cookie);
}
catch(Exception exp)
{System.out.println("Client machine: Error in Making Connection" + exp );}
/* to make the URL connection with the server - end */
}
/* to disconnect the URL connection with the server - begin */
public void disconnectConnection()
{
try
{
System.runFinalization();
urlconnection.disconnect();
urlconnection.getInputStream().close();
}
catch(Exception exp)
{System.out.println("Client machine: Error gets fired while disconnecting the connection" + exp);}
}
}
/* to disconnect the URL connection with the server - end */
My Server side Program(servlet program)
*******************************
import java.io.BufferedOutputStream;
import java.io.IOException;
import java.util.zip.ZipEntry;
import java.util.zip.ZipInputStream;
import java.io.*;
import java.util.*;
import javax.servlet.*;
import javax.servlet.http.*;

public class FileUploadServlet extends HttpServlet
{
public void init() throws ServletException
{}
public void doPost(HttpServletRequest httpservletrequest, HttpServletResponse httpservletresponse) throws ServletException, IOException
{
try{UnzipAndWriteToDir(httpservletrequest, httpservletresponse);}
catch(Exception exp){System.out.println("I am from server............" + exp);}
}
public void UnzipAndWriteToDir(HttpServletRequest httpservletrequest, HttpServletResponse httpservletresponse) throws Exception
{
javax.servlet.ServletInputStream servletinputstream = httpservletrequest.getInputStream();
ZipInputStream zipinputstream = new ZipInputStream(servletinputstream);
ZipEntry zipentry = null;
String directory="c:\\test";
try
{
File file = new File(directory);
if(!file.exists())
file.mkdirs();
}
catch(Exception exp)
{System.out.println("I am from Server: " + exp);}
try
{
zipentry = zipinputstream.getNextEntry();
if(zipentry != null)
{
int slash = zipentry.getName().lastIndexOf(File.separator) + 1;
String filename = zipentry.getName().substring(slash);
File file1 = new File(directory + File.separator + filename);
BufferedOutputStream bufferedoutputstream = new BufferedOutputStream(new FileOutputStream(file1));
byte abyte0[] = new byte[1024];
for(int index = 0; (index = zipinputstream.read(abyte0)) > 0
bufferedoutputstream.write(abyte0, 0, index);
bufferedoutputstream.flush();
bufferedoutputstream.close();
zipinputstream.closeEntry();
zipinputstream.close();
}
}
catch(IOException ioexception)
{System.out.println("IOException occured in the Server: " + ioexception);}
} // end of the method...
} // end of the class
P.S: Here, I am using the Domino Server, which is same as the Web Logic Server......Pl. post a reply....hanging over here for the past one week...any suggestion is highly appreciated....

After wasting around 5 hrs, i have found that the statement
"InputStream in = urlconnection.getInputStream();" (in the client program)
is making the comand prompt to be idle....is it a bug with sun java....or is there any solution for this......i mean the link with the server, is just as it is without disconnecting....
Dear All,
I have a problem over here, in the transfer of file from my client machine to the server machine....I am zipping the file in the client machine and sending to the server machine....In the server machine I am trying to unzip it and write it over there....
For contacting my server, initially i am getting the authentication.....it is all correct....no problem with the authentication work...the problem over here is.............i am having 3 files to be transfered to my server machine...the first file is getting transfered....after that the command prompt is just standing idle....it is not even coming to the prompt state...it is not even thowing any errors in the server console or in the client machine....

Below is my complete code....
Client program: (simple java program)
****************************
import java.io.BufferedInputStream;
import java.io.IOException;
import java.util.zip.ZipEntry;
import java.util.zip.ZipOutputStream;
import java.io.*;
import java.text.*;
import java.util.*;
import java.net.*;
import java.sql.*;
class testprogram
{
HttpURLConnection urlconnection = null;
public static void main(String args[])
{
String file1="F:/Domino/Data/Applications/Groupware/HP/input/Invcor02/param/new1.txt";
String file2="F:/Domino/Data/Applications/Groupware/HP/input/Invcor02/param/new2.txt";
String file3="F:/Domino/Data/Applications/Groupware/HP/input/Invcor02/param/new3.txt";
String name1="new1.txt";
String name2 ="new2.txt";
String name3="new3.txt";
testprogram tt=new testprogram();
try
{
tt.makeConnection();
tt.zipper(file1,name1);
tt.zipper(file2,name2);
tt.zipper(file3,name3);
tt.disconnectConnection();
}
catch(Exception e){}
}
public void zipper(String file,String name) throws Exception
{
try
{
ZipOutputStream zipoutputstream = new ZipOutputStream(urlconnection.getOutputStream());
ZipEntry zipentry = new ZipEntry(name);
zipentry.setMethod(ZipEntry.DEFLATED);
zipoutputstream.putNextEntry(zipentry);
byte bytearray[] = new byte[1024];
File filedir = new File(file);
FileInputStream fileinputstream = new FileInputStream(filedir);
BufferedInputStream bufferedinputstream = new BufferedInputStream(fileinputstream);
int length = 0;
while((length=bufferedinputstream.read(bytearray)) != -1)
{
zipoutputstream.write(bytearray,0,length);
}
fileinputstream.close();
bufferedinputstream.close();
zipoutputstream.flush();
zipoutputstream.finish();
zipoutputstream.closeEntry();
zipoutputstream.close();
System.out.println("I am here...");
InputStream in = urlconnection.getInputStream();
while (in.read()!=-1);
}
catch(Exception exp)
{System.out.println("I am from client: " + exp);}
}
/* to make the URL connection with the server - begin */
public void makeConnection()
{
/* Authentication work is done over here - begin */
String setcookie="";
String cookie="";
try
{
URL theurl = new URL("http://192.168.10.55:8001/names.nsf?login&username=sakthivel&password=12345");
HttpURLConnection.setFollowRedirects(false);
HttpURLConnection hurl = (HttpURLConnection)theurl.openConnection();
hurl.connect();
setcookie = hurl.getHeaderField ("set-cookie");
int index=setcookie.indexOf(";");
cookie=(setcookie.substring(0,index)).trim();
hurl.disconnect();
hurl=null;
theurl=null;
}
catch(Exception exp){exp.printStackTrace();}
/* Authentication work is done over here - end */
/* to make the URL connection with the server - begin */
try
{
URL serverURL = new URL("http://192.168.10.55:8001/servlet/FileUploadServlet");
urlconnection= (HttpURLConnection)serverURL.openConnection();
urlconnection.setDoOutput(true);
urlconnection.setRequestMethod("POST");
urlconnection.setRequestProperty("Cookie",cookie);
}
catch(Exception exp)
{System.out.println("Client machine: Error in Making Connection" + exp );}
/* to make the URL connection with the server - end */
}
/* to disconnect the URL connection with the server - begin */
public void disconnectConnection()
{
try
{
System.runFinalization();
urlconnection.disconnect();
urlconnection.getInputStream().close();
}
catch(Exception exp)
{System.out.println("Client machine: Error gets fired while disconnecting the connection" + exp);}
}
}
/* to disconnect the URL connection with the server - end */
My Server side Program(servlet program)
*******************************
import java.io.BufferedOutputStream;
import java.io.IOException;
import java.util.zip.ZipEntry;
import java.util.zip.ZipInputStream;
import java.io.*;
import java.util.*;
import javax.servlet.*;
import javax.servlet.http.*;

public class FileUploadServlet extends HttpServlet
{
public void init() throws ServletException
{}
public void doPost(HttpServletRequest httpservletrequest, HttpServletResponse httpservletresponse) throws ServletException, IOException
{
try{UnzipAndWriteToDir(httpservletrequest, httpservletresponse);}
catch(Exception exp){System.out.println("I am from server............" + exp);}
}
public void UnzipAndWriteToDir(HttpServletRequest httpservletrequest, HttpServletResponse httpservletresponse) throws Exception
{
javax.servlet.ServletInputStream servletinputstream = httpservletrequest.getInputStream();
ZipInputStream zipinputstream = new ZipInputStream(servletinputstream);
ZipEntry zipentry = null;
String directory="c:\\test";
try
{
File file = new File(directory);
if(!file.exists())
file.mkdirs();
}
catch(Exception exp)
{System.out.println("I am from Server: " + exp);}
try
{
zipentry = zipinputstream.getNextEntry();
if(zipentry != null)
{
int slash = zipentry.getName().lastIndexOf(File.separator) + 1;
String filename = zipentry.getName().substring(slash);
File file1 = new File(directory + File.separator + filename);
BufferedOutputStream bufferedoutputstream = new BufferedOutputStream(new FileOutputStream(file1));
byte abyte0[] = new byte[1024];
for(int index = 0; (index = zipinputstream.read(abyte0)) > 0
bufferedoutputstream.write(abyte0, 0, index);
bufferedoutputstream.flush();
bufferedoutputstream.close();
zipinputstream.closeEntry();
zipinputstream.close();
}
}
catch(IOException ioexception)
{System.out.println("IOException occured in the Server: " + ioexception);}
} // end of the method...
} // end of the class
P.S: Here, I am using the Domino Server, which is same as the Web Logic Server......Pl. post a reply....hanging over here for the past one week...any suggestion is highly appreciated....

After wasting around 5 hrs, i have found that the statement
"InputStream in = urlconnection.getInputStream();" (in the client program)
is making the comand prompt to be idle....is it a bug with sun java....or is there any solution for this......i mean the link with the server, is just as it is without disconnecting....
21 years ago