amit ang

Ranch Hand
+ Follow
since Sep 28, 2001
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
In last 30 days
0
Forums and Threads

Recent posts by amit ang

Hi All,

Can i know what is the industry definition for lightweight and heavyweight objects?

One about AWT is heavyweight and SWING is lightweight for usage of navie system resources is okai.

Is there anything in for just java objects to be said as lightweight or heavyweight ?

Things in my mind like :
1) Use of hierarchy of objects.
2) heavy in memory.
3) something like EJB is heavy ?

Cheers,
Amit
20 years ago
Hi All,

Can i know what is the industry definition for lightweight and heavyweight objects?

One about AWT is heavyweight and SWING is lightweight for usage of navie system resources is okai.

Is there anything in for just java objects to be said as lightweight or heavyweight ?

Things in my mind like :
1) Use of hierarchy of objects.
2) heavy in memory.
3) something like EJB is heavy ?

Cheers,
Amit
20 years ago
Thanks guys,
Got it. It's all to do with the associated TYPE rather then instance for the static declarations.
20 years ago
Hi Max,
Ya, i know that static is identified by class. But, when you access it through reference
20 years ago
public class Test {
public static int intTmp = 10;
public Test() {
}
public static void main(String[] args) {
Test test1 = new Test();
test1=null;
System.out.println("Here it is : "+test1.intTmp);
}
output :
Here it is : 10
how is this possible any good explaination on this ?
cheers,
Amit
[ EJFH -- added sensible subject line ]
[ April 28, 2004: Message edited by: Ernest Friedman-Hill ]
20 years ago
Hi All,
Something more to add. I was doing compressing the byte stream of ServletOutputStream. Please refer following link for detail.
http://www.javaworld.com/jw-06-2001/Filters/compress.war
Tried jsp on the same that'snot working. The problem is with g-zip.
Have anyone tried the same ?
Regards,
Amit
21 years ago
Hi All,
I am trying to cache the complete jsp and servlet by using filters.
I am facing the following problem.
When i set url for non-cachemode for sevlet, it returns the output without cache, where for jsp it doesn't.
I have overriden the ServletOutputStream to cache the bytes. If the URL has a parameter for caching.
Is this because the JSPWritter used for out ?
Any ideas ?? Any one have worked on similar thing ?
Regards,
Amit Angarkar
21 years ago
Hi,
outputstream overriding to get the byte stream for caching, didn't succeed. There is some problem of container that is not allowing to override the ouputstream implementation of it.
This all is done to cache the outputstream bytes to save the rendering time. Is this correct ? Whether this rendering problem (caching of bytes) will really improve the performance.
Following are the files created , using tomcat to test on.
Myresponse to call the overriden outputstream.

please suggest,
Amit
=============================================================
import java.io.*;
import javax.servlet.*;
import javax.servlet.http.*;
import java.util.Locale;
import servlets.MyServletOutputStream;
public class MyHttpResponseWrapper implements HttpServletResponse{
protected HttpServletResponse _response;
private ByteArrayOutputStream _bout;
private Writer _cacheWriter;
private MyServletOutputStream outStream;
// private boolean hasStream;
// private boolean hasWriter;
public MyHttpResponseWrapper(HttpServletResponse response) {
this._response = response;
try {
_bout = new ByteArrayOutputStream();
_cacheWriter = new OutputStreamWriter(_bout);
outStream = new MyServletOutputStream(_response.getOutputStream(), _bout);
// hasStream = false;
// hasWriter = false;
}
// catch (IOException e) {
// System.out.println(
// "Got IOException constructing cached response: " + e.getMessage());
// }
catch (Exception er ) {
System.out.println(
"Got Exception constructing cached response: " + er.getMessage());
}
}
public PrintWriter getWriter() throws IOException {
System.out.println("Inside the overriden method ....getWriter()..");
// hasWriter = true;
return new PrintWriter(outStream,true);
//return _response.getWriter();
}
public ServletOutputStream getOutputStream() throws java.io.IOException
{
System.out.println("Inside the overriden method ....getOutputStream()..");
return outStream;
// if (hasWriter) {
// throw new IllegalStateException(
// "Cannot get output stream after getting writer");
// }
// MyServletOutputStream sos = (MyServletOutputStream)_response.getOutputStream();
// ByteArrayOutputStream baout = new ByteArrayOutputStream();
// byte[] byt;
// sos.write(byt);
// BufferedInputStream inputStream = new BufferedInputStream (new FileInputStream
("abc.html"));
// copyInToOut (inputStream, new BufferedOutputStream (response.getOutputStream()));
// inputStream.close();
/* FileOutputStream fo = new FileOutputStream("jspreq.ser");
DataOutputStream doo = new DataOutputStream(sos);
ObjectOutputStream oo = new ObjectOutputStream(doo);
oo.writeObject(sos);
oo.close();
doo.close();
fo.close();
*/
// return sos;
}
public void setStatus(int sc) {
_response.setStatus(sc);
}
public void setStatus(int sc, String sm) {
_response.setStatus(sc,sm);
}
public void setIntHeader(String name, int value) {
_response.setIntHeader(name, value);
}
public void setHeader(String name, String value) {
_response.setHeader(name, value);
}
public void addCookie(Cookie cookie) {
_response.addCookie(cookie);
}
public void addDateHeader(String name, long date) {
_response.addDateHeader(name, date);
}
public void addHeader(String name, String value) {
_response.addHeader(name, value);
}
public void addIntHeader(String name, int value) {
_response.addIntHeader(name, value);
}
public boolean containsHeader(String name) {
return _response.containsHeader(name);
}
public String encodeRedirectURL(String url) {
return _response.encodeRedirectURL(url);
}
public String encodeRedirectUrl(String url) {
return _response.encodeRedirectUrl(url);
}
public String encodeURL(String url) {
return _response.encodeURL(url);
}
public String encodeUrl(String url) {
return _response.encodeUrl(url);
}
public void sendError(int sc) throws IOException {
_response.sendError(sc);
}
public void sendError(int sc, String msg) throws IOException {
_response.sendError(sc,msg);
}
public void sendRedirect(String location) throws IOException {
_response.sendRedirect(location);
}
public void setDateHeader(String name, long date) {
_response.setDateHeader(name ,date);
}
public void setContentLength(int len) {
_response.setContentLength(len);
}
public void setContentType(String type) {
_response.setContentType(type);
}
public void setBufferSize(int size) {
_response.setBufferSize(size);
}
public int getBufferSize() {
return _response.getBufferSize();
}
public void flushBuffer() throws IOException {
_response.flushBuffer();
}
public boolean isCommitted() {
return _response.isCommitted();
}
public void reset() {
_response.reset();
}
public void setLocale(Locale loc) {
setLocale(loc);
}
public Locale getLocale() {
return _response.getLocale();
}
public String getCharacterEncoding() {
return _response.getCharacterEncoding();
}
protected void copyInToOut (BufferedInputStream in, BufferedOutputStream out) throws
IOException
{
int length;
byte data[] = new byte[8192];
while ( (length=in.read(data)) != -1 )
{
out.write (data, 0, length);
}
}
}
=====================================================================
import java.io.OutputStream;
import java.io.IOException;
import java.io.CharConversionException;
import java.text.MessageFormat;
import java.util.ResourceBundle;
import javax.servlet.ServletOutputStream;
import java.io.*;
public class MyServletOutputStream extends ServletOutputStream {
private ServletOutputStream _servletOut;
private OutputStream _cacheOut;
public MyServletOutputStream(ServletOutputStream servletOut, OutputStream cacheOut) {
System.out.println("Inside MyServletOutputStream constructor...");
this._servletOut = servletOut;
this._cacheOut = cacheOut;
}
public void write(int b) throws IOException {
_servletOut.write(b);
_cacheOut.write(b);
}
public void write(byte b[]) throws IOException {
_servletOut.write(b);
_cacheOut.write(b);
}
public void write(byte buf[], int offset, int len) throws IOException {
_servletOut.write(buf, offset, len);
_cacheOut.write(buf, offset, len);
}
public void print(boolean b) throws IOException { _servletOut.print(b); }
public void print(char c) throws IOException { _servletOut.print(c);}
public void print(double d) throws IOException { _servletOut.print(d);}
public void print(float f) throws IOException { _servletOut.print(f);}
public void print(int i) throws IOException { _servletOut.print(i); }
public void print(long l) throws IOException { _servletOut.print(l);}
public void print(java.lang.String s) throws IOException { _servletOut.print(s);}
public void println() throws IOException { _servletOut.println(); }
public void println(boolean b) throws IOException { _servletOut.print(b);}
public void println(char c) throws IOException { _servletOut.print(c); }
public void println(double d) throws IOException { _servletOut.print(d); }
public void println(float f) throws IOException { _servletOut.print(f); }
public void println(int i) throws IOException { _servletOut.print(i); }
public void println(long l) throws IOException { _servletOut.print(l); }
public void println(java.lang.String s) throws IOException { _servletOut.print(s); }
}
===================================================================
21 years ago
Hi Everyone,
I am trying a simple example on wml with wml script using jataayu browser and tomcat server. When i run this simple example currency.wml which uses the currency.wmls script file from the local drive using d:\temp it runs fine. But when same is run using the http://localhost/wmlstrut/currency.wml with the same script file i get an error message saying the invalid xml.
Can any help ?
Thanks in advance!
Amit
21 years ago
Hi Maya,
It is a simple thing.
As, you have identified the classes, that are going to come in the picture while doing the registration.
Just for once check how the sequence diagrams are drawn, wht all is there in that diagram, how does it look like.
If, you have Rational Rose installed on your machine just do the reverse engg and you will get all those class in the Rose.
Now, after you have done the above. Just drag those class into the sequence of classes(sequence here means one after the other comming into pic while doing the registration process) into the view and show the sequence of calling the message.
I think you need to just see some examples on the net for that matter.
:-)Amit

Originally posted by maya menon:
Hi all,
My task is to create a Sequence diagram for an existing application. Say, my J2EE application has a "register" new user sequence which has to be drawn into a sequence diagram.
Since the code is already there, I am confused of which all classes I need to include, I have a controller servlet, some command object, action object, ejbs etc which are involved in this sequence.
How will i draw it ? Or what r the steps that I need to follow ?
This is the first time I am creating a sequence diagram, Please help
Thanks
Maya

Hi Manas,
I think the the use case diagrams, the component diagrams or the High level diagrams all have there own values.
like use case diagram shows you the scenario's that can be present, i mean actor doing some process, typical representation of the process happening in the system. The component diagrams you talking about are the set of process that could form the components.
Now this is all i feel. Tell me if i am worng at any stage.
Now, These could be the business prospective
like you said the "withdrawal of money" from the ATM could be the use the High level diagram in the first iteration, which could be subsequently reduced to the low-level diagram, by showing the details in the the process "withdrawal of money", like it may require a authentication of the user, which could be the on more use case in it.
So, here the designer would be putting the business prospects in the diagram view, that may be usefull for the business understanding(for busines persons) and also usefull for the developer to understand the flow.
Hope that's what is the answer.
Regard's
Amit

Originally posted by manas ahlaad:
Hello All,
I request all to give a vivid answer to the following question.
We have an Use Case Diagram, High level component diagram, low- level component diagram, sequence diagram, class diagram, state diagram.
How one is deduced from the previous one , like how component diagram is deduced from use case diagram since at that case only use case is input for deciding on component. should the high level component diagram be technical or business oriented ?
please clarify
Thanks In advance

Hi,
I have two ejb jar files hosted on the same server.
now i want to refer one ejb within the other.
Can any one give me the details to handle this problem.
Thanks in Advance.
Amit
22 years ago
Hi All,
Can anyone help me?
I have implemented HttpSessionListener and have implemented the methods for Create and Destroy the session.
now when i hit the page with a browser i get the message from the Create method. But, when i close the browser i don't get the message from the Destroy method (I hope when you close the browser the session should be invalidated).
Any seggestions?
Thanks in Advance
Amit
22 years ago
Hi All,

Just a question, Iam doing socket programming and now can i write bind method in the client program? what is the problemt if do that.
Thanks in Advance
Amit
Hi All,
can any tell difference bewteen Network operating system and Distributed Operating system.
Thanks in Advance
Amit
22 years ago