Bindu Kantipudi

Greenhorn
+ Follow
since Nov 30, 2005
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
In last 30 days
0
Forums and Threads

Recent posts by Bindu Kantipudi

Hi,

I have a servlet which acts like a proxy. First when servlet gets request, It creats a socket to a reporting server (run's on 80 port) and sends a request. After getting a file from that server this servlet tries to set status and the header in HttpServletResponse. Latter it writes the data to a ServletOutputStream.

My problem is, the page is not displayed on the browser when I try to access it from webserver. If I run the application directly on test box,it is displaying the page. When I check the webserver logs it is sending a request as below.
/ActuateReportServlet?report=TransactionHistory HTTP/1.0" - -

and I am thinking it is not setting the status and so server is not displaying the page.
Please help me with this problem.

Here is the code in servlet which does

Socket socket = new Socket(host, port);
boolean b1 = socket.isConnected();
System.out.println("Socket Connection = "+b1);
PrintStream ps = new PrintStream(socket.getOutputStream());
BufferedInputStream bis = new BufferedInputStream(socket.getInputStream());
BufferedReader br = new BufferedReader(new InputStreamReader(socket.getInputStream()));

String file = url.getFile();
String request = new StringBuffer("GET ").append(file).append(" HTTP/1.0\r\n\r\n").toString();
ps.print(request);
System.out.println("Print Stream = "+request);

java.util.StringTokenizer st = new java.util.StringTokenizer(br.readLine());
String resProtocol = st.nextToken();
String resStatus = st.nextToken();

int status = 500;
if (resStatus != null && !resStatus.equalsIgnoreCase("")) {
status = Integer.parseInt(resStatus);
System.out.println("resStatus int = "+status);
}

String line = null, name = null, value = null;
if ( status == res.SC_MOVED_TEMPORARILY ) {
while( !(line = br.readLine()).equalsIgnoreCase("") ) {
name = line.substring(0, line.indexOf(":"));
value = line.substring(line.indexOf(":") + 1, line.length());
if ( name != null && name.equalsIgnoreCase("Location") ) {
break;
}
}
if ( MLSFormatter.isValidString( value )) {
String location = (String) System.getProperty("imaging.server");
downloadNetworkResource( req, res, location, value.trim(), null );
status = 200;
}

} else {
ServletOutputStream sos = res.getOutputStream();
res.setStatus(res.SC_OK);

while(!(line = br.readLine()).equalsIgnoreCase("")) {
name = line.substring(0, line.indexOf(":"));
value = line.substring(line.indexOf(":") + 1, line.length());
res.setHeader(name, value);
System.out.println("Name = "+name);
System.out.println("Value = "+value);
}
while ((b = bis.read(buf)) != -1)
{
System.out.println("bytes b = "+b);
/*char c;
System.out.println("b = "+b);
for(int i=0; i<buf.length; i++){
c = (char)buf[i];
System.out.print(c);
}*/
sos.write(buf, 0, b);
}
sos.flush();
sos.close();
/*bis.close();
br.close();
ps.close();*/
}
bis.close();
br.close();
ps.close();
18 years ago
I am using Rational Application Developer (same as WebSphere Studio or WSAD). I have a jsp in the WebContent folder of the war. I put a jar in that same folder that holds the applet class and all the helper classes.

i have tried the following things:

1.putting the .class file and .HTML file in the same folder in the folder structure of the application
2. .class file in its default folder with a absolute(which is not correct) as well as "relative path in the codebase" to the .html file
3. made all the possible conbinatins of code and codebase in the applet tag related to the path and the pacakage name of the .class file.
4.putting the .jar file of the .class file and .HTML file in the same folder and using the archive parameter.
5. putting the .jar file of the .class file in lib folder(which is like Web content->WEB-INF->lib ) absolute(which is not correct) as well as relative path in the archive to the .html file

When I run the jsp, I get the grey applet rectangle with the red X in the upper left corner. There are no errors in either the browser's console or in the server's logs.

Any help would be greatly appreciated.
I am using Rational Application Developer (same as WebSphere Studio or WSAD). I have a jsp in the WebContent folder of the war. I put a jar in that same folder that holds the applet class and all the helper classes. Here is how I am coding the applet:

i have tried the following things:

1.putting the .class file and .HTML file in the same folder in the folder structure of the application
2. .class file in its default folder with a absolute(which is not correct) as well as "relative path in the codebase" to the .html file
3. made all the possible conbinatins of code and codebase in the applet tag related to the path and the pacakage name of the .class file.
4.putting the .jar file of the .class file and .HTML file in the same folder and using the archive parameter.
5. putting the .jar file of the .class file in lib folder(which is like Web content->WEB-INF->lib ) absolute(which is not correct) as well as relative path in the archive to the .html file

When I run the jsp, I get the grey applet rectangle with the red X in the upper left corner. There are no errors in either the browser's console or in the server's logs.

Any help would be greatly appreciated.
18 years ago