Celina Paul

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

Recent posts by Celina Paul

Great ! It works !

Thanks Ernest,
It also cleared few things on the way...
Hi Ernest,

Thanks for the reply.

After reading your comment, I changed the code, so that the Thread t2
sleeps for 10 seconds before calling notify().



This should take care that wait() gets called since the other thread is not sleeping. I still see the same result.

I am expecting to see after the wait is called -
here after being notified

Let me know what is going on here...
The following wait and notify sample does not work.
Please can somebody let me know what is wrong ?




The output that I see is -
"Notified all the waiting threads"

and then it hangs for ever
[ August 03, 2004: Message edited by: Celina Paul ]
Usually the url path your filter is mapped to, the login page is kept out of it. For example, all the important resources are in a folder say "secured"
So every user could go to the login page without the filter being invoked.
Once when he enters the login information and clicks submit, it goes to a servlet which is still outside the "secured" mapped url for filter.

Usually, in a pattern like mvc, it goes to the controller servlet which then creates a valid session for the user. After the valid session is created, then the request is forwarded to a resource which lies in the "secured" path and the filter is invoked which checks for the validity of the session.
20 years ago
Hi Johnny,

Ideally you should check for a valid session on top of any page that your user can go into your website. Usually people include a startup file on top of any JSP and that startup JSP page checks for a valid session and redirects it when not found.

If you are using servlets, then you should use a ServletFilter. This ServletFilter is usually mapped to url (like servlet path mapping).
In the doFilter() API call implementation for this filter, you can check for the existence of the user session, if it is not there, then redirect the user to login page.

If it is there, then the filter would take care of forwarding it to the requested resource when you call chain.doFilter()..

Also, make sure that the session object being checked is removed from session scope when the user logs out.
20 years ago
I read a lot about MVC recently and was impressed to see how better the model is than the old Page 1 architecture.

But I did not find anywhere any real life issues mentioned with MVC.

What I would like to know is when implementing MVC, what should be avoided, etc.

Also, if there is any link explaining that, please let me know.
[ July 15, 2004: Message edited by: Celina Paul ]
20 years ago
I would think that any shared resource which should not have simultaneous access should be synchronized.

In your case, if this servlet can be accessed by n no. of users to create new users at the same time, then you should synchronize database access.

I would assume though that there would database row level loking while inserting...
20 years ago
I had posted this question earlier in XML group, never got an answer.

In DOM, there is a COMMENT_NODE to get the comment data, but if I have to get the data in a comment node in SAX, what can I do?

When the parser comes across a comment node, there is no callback method defined for this in SAX.

Is there a way to get that data in SAX ?
Were setFetchSize() and getFetchSize() API calls available before JDBC 2.0 ?
Also, any sample for the usage of these APIs in JDBC 2.0 would be helpful.
Thanks
Hi Mali,
Mike has explained the process in good detail.
The default buffer size is 8k and buffering is on by default.
To answer your question, the out.println() statement that you added before forward() was not enough to overflow the buffer and hence nothing was flushed out/committed to the client.
And hence forward() worked without exceptions.
If you add data which exceeds 8k, it would cause the response to be flushed out and then your forward() call would definitely throw an exception.
21 years ago
If your response output stream is not buffered..then any out.println()
called before the forward would give you the Illegal State Exception.
Because in this case, whatever you are printing in the output stream is directly getting forced out to the client.
If the reponse output stream is buffered and the data added to the stream has not overflown the buffer size, then the buffer would be cleared and the forward() call would work.
Also, flushBuffer() forces the data to the client and hence should not be called before forward()
You can use the API isCommitted() on the ServletResponse object to make sure if any data has been committed to the client or not before calling the forward() method.
21 years ago
Hi Methias,
I tried the same code for the ConnectionHandler and tested it with another simpler servlet in the same context. It worked fine for me and did not crash the Tomcat server.
I could get the context attribute and also use the connection.
The only questionable thing that I see in your isLoggedIn() method call is why are you closing the connection ? This connection should get closed when the context is destroyed...
21 years ago
A servlet would be loaded when it is accessed for the first time..unless it has been specified as one of the "load-on-startup" servlets in the deployment descriptor as specified earlier.
21 years ago
The initial servlet gets a GET request.
It has to forward it to another servlet. Is it possible for the intial servlet to forward to the another servlet using a POST method ?
21 years ago
Hi Jess,
Yes...that is what I was thinking...
I guess my question is -
Is there anyway to access public methods of a class which has been declared private ?
It's not something that I want to do, it's just something that I want to know.
Thanks..
21 years ago