Light Wan

Ranch Hand
+ Follow
since May 15, 2002
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 Light Wan

The correct response from server side should be like below. Even, there is a new line character in the value of LOGIN_TOKEN, there is no problem for another account.

HTTP/1.1 302 Moved Temporarily
Date: Mon, 29 Jan 2007 11:07:28 GMT
Location: https://www.companyname.com/login_path/menu
Content-Type: text/html
Transfer-Encoding: chunked
LOGIN_TOKEN:

Set-Cookie: LOGIN_TOKEN=%00%22%3F69%3C5%04%29+5m%03%03%00%1F%13.%13%3C95%3E%24%19%14mbbbbbbbb.%05%235%22%19%14m5%3E7%3C9%238.%061%3C94%005%229%3F4mad.%15%28+9%22%29%049%3D5mbi%7F%60a%7Fb%60%60gpabjbajbh; domain=.companyname.com; path=/
Set-Cookie: CorporateLanguage=en; domain=.companyname.com; expires=Monday, 05-Feb-2007 11:07:28 GMT; path=/
Set-Cookie: lfcclientid=134123413241; domain=.companyname.com; expires=Monday, 05-Feb-2007 11:07:28 GMT; path=/
Connection: Close

012b
<html><head><title>302 Moved Temporarily</title></head>
<body bgcolor="#FFFFFF">
<p>This document you requested has moved temporarily.</p>
<p>It's now at <a href="https://www.companyname.com/login_path/menu">https://www.companyname.com/login_path/menu</a>.</p>;
</body></html>

0000

[ January 29, 2007: Message edited by: Light Wan ]
13 years ago
I used IE HTTP Analyzer to track the https stream sent from WebServer side. IE has received the http header part from server side, but the stream has not been finised. Below is the whole stream content:

HTTP/1.1 302 Moved Temporarily
Date: Mon, 29 Jan 2007 10:11:20 GMT
Location: https://www.copanyname.com/login_path/menu
Content-Type: text/html
Transfer-Encoding: chunked
LOGIN_TOKEN:

Set-Cookie: LOGIN_TOKEN=%00%22%3F69%3C5%04%29+5m%03%03%00%1F%13.%13%3C95%3E%24%19%14mcegie%60e.%05%235%22%19%14m%06%11%1E%14%15%02%0A%09%00%15%1E.%061%3C94%005%229%3F4mad.%15%28+9%22%29%049%3D5mbi%7F%60a%7Fb%60%60gpaajbejb%60; domain=.copanyname.com; path=/
Set-Cookie: CorporateLanguage=nl; domain=.copanyname.com; expires=Monday, 05-Feb-2007 10:11:20 GMT; path=/
Set-Cookie: clientid=233242323423; domain=.copanyname.com; expires=Monday, 05-Feb-2007 10:11:20 GMT; path=/
Connection: Close

012b
<html><head><title>302 Moved Temporarily</title></head>
<body bgcolor="#FFFFFF">
<p>This document you requested has moved temporarily.</p>
<p>It's now at <a href="https://www.copanyname.com/login_path/menu">https://www.copany



There is "012b" in the above content. What's that? Can it cause the problem?

And, with the response, the result code is "ERROR_INTERNET_INTERNAL_ERROR".
[ January 29, 2007: Message edited by: Light Wan ]
13 years ago
Thanks all of you.

I checked the value inputted in cookie and http header part at the server side. One value, which has new line charachers, was inputted into http header. And I tried to repeat the issue using such a value with new line characters, but I failed. The problem was not reproduced. Does HTTP potocol allow to set value which has new line characters into HTTP Header Part?

BTW, to William Brogden, could you share with me how to set the local port for TCPMON? TCPMON is running on my machine.
13 years ago
No enter\ or new line character in cookie value.
13 years ago
Hi all,

We have an authentication applicaiton and the application is based on Weblogic Server 8.1. There are three pages/servlets involved in the login process: login.jsp, LoginServlet, and menu.jsp. If user inputs correct username/password and clicks the login button, the LoginServlet will verify user's profile and set some cookie into HTTP Response. Fianlly, the servlet will redirect the user to menu.jsp.

Right now we are facing a weird phenomenon: based on one specific user, we can not login using IE, but can login using Firefox or Opera.

In IE, after inputed username/password and clicked the logon button, "The page cannot be displayed" is presented on screen. And, the URL in the address bar is the URL of LoginServlet. The log information indicates the user has been redirected to menu.jsp and no log info outputted by menu.jsp. At that time, if we directly access the menu.jsp in the same IE window, below messages is presented on the top of the page. These messages should be in HTTP Header part. Why they aree outputted by WebServer on page? And the menu page is just presented partially.

Cache-Control: no-cache Set-Cookie: ABC_TOKEN=%00%22%3F69%3C5%04%29+5m%03%03%00%1F%13.%13%3C95%3E%24%19%14mcegie%60e.%05%235%22%19%14m%06%11%1E%14%15%02%0A%09%00%15%1E.%061%3C94%005%229%3F4mad.%15%28+9%22%29%049%3D5mbf%7F%60a%7Fb%60%60gp%60hjbdjce; domain=.companyname.com; path=/ Connection: Keep-Alive

The partialsource codes of the menu page is:

Cache-Control: no-cache
Set-Cookie: ABC_TOKEN=%00%22%3F69%3C5%04%29+5m%03%03%00%1F%13.%13%3C95%3E%24%19%14mcegie%60e.%05%235%22%19%14m%06%11%1E%14%15%02%0A%09%00%15%1E.%061%3C94%005%229%3F4mad.%15%28+9%22%29%049%3D5mbf%7F%60a%7Fb%60%60gp%60hjbdjce; domain=.companyname.com; path=/
Connection: Keep-Alive
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<HTML>
<HEAD>
......
.... The last table does not be presented completely.


Do you have any idea about this issue?


Thanks,
Light Wan
13 years ago
1. Functionality of interface in JAVA.
2. Difference between class String and StringBuffer.
3. Illustrate two or three Design Patterns, why and how to use them.
My answers
1.
  • Implement multi-inheritance
  • Separate the implementation
  • Easy to extend implementation
  • 2.
  • The content of a String object cannot be changed, but that of StringBuffer can.
  • Performance of using StringBuffer is good.
  • 3.
  • MVC, used in GUI design and web design.
  • Adapter, class adapter and object adapter.
  • Factory, encapsulate the implementation and easy to extend implementation

  • Light
    [ November 12, 2003: Message edited by: Light Wan ]
    16 years ago
    Hi Chris,

    That sounds like a lot of clients.


    I also think the reason is too many clients. Because I ran the testcase over and over. The rmi server maybe have no time to run the Garbage Collector. I don't know about how many clients can connect to rmi server at the same time.

    Are you trying to run them all at the same time?


    Yes. I modified my testcase to created 2000 rmi clients. The process of creating these clients did not throw any exception. But after I called the 2000 threads to start, then connect exceptions were throwed in the running process of some threads, not all threads.

    What OS is your server running on?


    My server ran on Win2000 professional OS.

    Any chance you are getting bounced because you are trying to open too many connections? Even if you stop your program and then restart, do you somehow disconnect gracefully, or do you leave the server hanging thinking you are still there? I don't know how all that is handled, but with massive amounts of clients, I could see something like that happening if the server never knew anyone was dropping out and you just kept adding more connections. Does it work again if you restart the server and then reconnect your clients?


    Maybe, the rmi server needs more memory. I restart the server after connect exceptions were throwed, then I ran the testcase. Connect exceptions was also throwed in the running process of some threads. But, if I ran my gui client, gui client worked well and no problem. I don't know why rmi server canot response to some clients when so many clients called rmi method simultaneously.
    Best Regards,
    Light
    16 years ago
    Hi all,
    My rmi implementation is described as following. There is a rmi factory at the server side. When a client wants to access the server data, the rmi factory returns a new rmi Data object for this client. Then, every client has its own rmi Data object. I started a testcase to test server: firstly, created 200 rmi client, then every client tried to create a new record in database, and each action(create a new record) was encapsulated in a single thread. At first, my rmi server works very well. But, if I run the testcase over and over again. Then the ConnectException was throwed. The stack trace is listed below. My question is why ConnectExceptions did not been throwed at first, but throwed after I ran the testcase over and over again.

    I don't know how about the under truth of rmi. Could you please help me?
    Best Regards,
    Light
    16 years ago
    Hi Phil,
    I am sorry for my so late response. If I call lock/unlock of LockManager directly in RemoteDataAccess, that is not implemte the lock/unlock of Data.
    So, I thinked a lot in the past two days. Now, I want to implement a simple solution. My instruction does not need me to remember who locked a record. Just need me to implement that a record should be locked by a connection at a moment. If another client want to lock the same record, the client should wait for the record unlocked. And there is no requirement needing me to think about the multi-tables scenario.
    Best,
    Light
    Hi Philippe,

    If yes, how did you implement lock and unlock in Data ?
    Notice that that sentence is a "must" one. What about implementating them by delegating their job to your LockManager ?


    Yes. I must implement the lock and unlock method of DBMain interface. But in order to encapsulate lock mechanism into LockManager class, the lock and unlock method in Data class just overlay the lock and unlock method defined in DBMain interface, but do nothing.
    The lock/unlock method being called process is:

    I don't think it must be in the following steps. And the following implementation violates the SRP(Single Responsibility Principle):


    Regards,
    Light
    Hi Andrew,
    Oh, my god, my poor English. I'm sorry. I apologize to all of you. Thank you, Andrew, thank you figure out my problem.

    Do you have a requirement to lock the entire database? If not, then I would remove the entire method which locks the database.
    If you do have a requirement to lock the entire database, then what is the logical outcome if the database is locked? Should a client be able to get a lock on an individual record while the entire database is locked? Do you prevent this from happening?


    Yes, I need to lock the entire database. In create() method on Data class, my implementation is just appending new record at the end of database file. And in Data class, there is a recordsCount field, which indicates the count of records(live and unlive) in database. So, in the creating process, I need to lock the entire database, append the new record, recordsCound++, and then unlock the whole database. When the entire database is locked, no client can get a lock on a record. The preventing mechanism is implemented in lockRecord() method on my LockManager class.

    What is your "recordLocker" object?
    I presume that this lock() method is in your LockManager. Is it being called by lock() in your Data class?


    Yes, presented codes are in LockManager. The lock() method does not being called in my Data class, but in my RemoteDataAccess clss. Every client has its own RemoteDataAccess object. These RemoteDataAccess objects share a common Data object and a common LockManager object. So, "recordLocker" is a RemoteDataAccess.
    Regards,
    Light
    Hi Philippe,

    Which instructions did you get (including version number) ?


    URLyBird 1.3.1

    It's the first time I read this lock() method signature here :
    "public void lock(int recNo, Object recordLocker) throws Exception".
    What's the Object recordLocker parameter that you never use BTW ?


    This lock() method is in my LockManager class. I use a connection factory to returns a new RemoteDataAccess object to every network client. The recordLocker is a RemoteDataAccess object.
    The recordLocker parameter is to specify who locked a record. It is used in unlock method to unlock a record.

    My server implements Unreference interface. If client called close() or client crashed, the method unlock(Object recordLocker) will be called in RemoteDataAccess class. RemoteDataAccess does not remember the records it locked.

    THis said, and reviewing your code, it seems OK to me, except the useless synchronized (lockMap) block in your isLocked method.


    Yes, you are right. the synchronized (lockMap) block in isLocked method is useless.
    Regards,
    Light
    Hi Andrew,
    Yes, you are right. I am not sure the solution will prevent a client to lock more than one record. And as you think, maybe it is not very useful to implement that. So, I decide to ignore this issue. The following is the coding in my lock method:

    I think the above coding will work fine. Do you think so? I expect some of you check these codes. Thanks very much.
    Regards,
    Light
    Andrew, Philippe, damu
    Thanks for your advice. I follow the principle now. Thank you very much!

    Regards,
    Light
    Hi all,
    I use the 2 tiers structure implement my lock mechanism. To avoid deadlock occur or some other problems, one network client should only lock one record at a time. My implementation is that in LockManager, an object could lock two different record. At client side, in DataAccessFacade, I synchronized the DataAccess(Server side), it means that at a time, only one thread of this client could access DataAccess. Is it need to implement one client cannot lock more records at a moment? If so, how did you implement?
    Regards.
    Light