Results 1 to 20 of 20
  1. #1
    Nicholas Jordan's Avatar
    Nicholas Jordan is offline Senior Member
    Join Date
    Jun 2008
    Location
    Southwest
    Posts
    1,018
    Rep Power
    8

    Question [SOLVED] id for new session

    Psuedocode:
    Java Code:
    HttpSession SESSION = request.getSession(true);
    
    // ServerSessionValue reserved for server's idea of what session is.
    String ServerSessionValue = SESSION.getId();//
    
    if(SESSION.isNew())
    {
        ServerSessionValue == null;
        ServerSessionValue.equals(/* New Session ID */);
        ServerSessionValue.equals(/* default session ID */));
    }
    My question is placed in comments in the dot equals for

    String ServerSessionValue.

    In other words, I have a simple html page that calls the servlet, I have my own identifier in the form that shows the request came from simple html page. Now I want to assign a session ID in the form that is written out in println()'s using a session id provided by server.

    I have workarounds already in mind for if user does not accept cookies and so on, several cross-checks. Here I want to get server's idea of what the session id is if isNew() returns true.
    Introduction to Programming Using Java.
    Cybercartography: A new theoretical construct proposed by D.R. Fraser Taylor

  2. #2
    fishtoprecords's Avatar
    fishtoprecords is offline Senior Member
    Join Date
    Jun 2008
    Posts
    571
    Rep Power
    7

    Default

    So what is the answer? I assume you have run this in a debugger, such as Netbeans with Tomcat. Change your comments to get() and print out the result.

    You should not have to do anything if the client browser doesn't support cookies. That is the job of the servlet container (i.e. Tomcat, JBoss, Resin, etc.) The container should use cookies or URL rewriting as needed. All automatically without any programmer effort.

    This is what reuse is all about

  3. #3
    Nicholas Jordan's Avatar
    Nicholas Jordan is offline Senior Member
    Join Date
    Jun 2008
    Location
    Southwest
    Posts
    1,018
    Rep Power
    8

    Default debug?

    Quote Originally Posted by fishtoprecords View Post
    So what is the answer? I assume you have run this in a debugger, such as Netbeans with Tomcat.
    No, I have a servlet container running on my machine but it is not Tomcat. It is version 2.1 of the Java(tm) Servlet Development Kit from Sun. I am working towards getting my first loadable servlet but fear all the configuration files and so on. Debuggers in Java? I just put in some print statements during prototyping. Debuggers bug me.

    Change your comments to get() and print out the result.
    Will the Java Servlet Development kit run the same as Tomcat? To test this with my browser over the open wire, I would have to turn off cookies off which would discard several kilobytes of cached information. I have the Hot Java Browser installed and up, I could use it I guess and see what the rack in Chicago does with a print() by running this code from Hot Java. iow test instead of guess?

    You should not have to do anything if the client browser doesn't support cookies. That is the job of the servlet container (i.e. Tomcat, JBoss, Resin, etc.) The container should use cookies or URL rewriting as needed. All automatically without any programmer effort.
    I have been burned too many times by people who should know what they are doing. I even do my own minor surgery because is is cheaper, faster and easier than relying on others. To me code reuse means a 10k copy-paste operation.
    Introduction to Programming Using Java.
    Cybercartography: A new theoretical construct proposed by D.R. Fraser Taylor

  4. #4
    fishtoprecords's Avatar
    fishtoprecords is offline Senior Member
    Join Date
    Jun 2008
    Posts
    571
    Rep Power
    7

    Default

    Get the Netbeans with JDK bundle. Use it. You can debug right into Tomcat and your servlet's code, and the code automatically generated by the JSP page.

    It greatly improves your productivity.

    Then read No Silver Bullet by Fred Brooks, and see that great debuggers are the closest thing to a silver bullet that we've found.

    There is no reason to use the old Servlet kit from Sun. uninstall it.

    You have to use 'reuse' to have any productivity. and with security, its insane to roll your own. Just let the servlet engine do they work, someone else debugged it. If it doesn't work, submit a bug into their bugzilla

  5. #5
    Nicholas Jordan's Avatar
    Nicholas Jordan is offline Senior Member
    Join Date
    Jun 2008
    Location
    Southwest
    Posts
    1,018
    Rep Power
    8

    Default on your authority

    Quote Originally Posted by fishtoprecords View Post
    Then read No Silver Bullet by Fred Brooks, and see that great debuggers are the closest thing to a silver bullet that we've found.
    Okay, but it is on your authority by the gains you have made in my mind. Prof. Brooks's paper is my field of expertise. When I hear or use the term 'Death March' it is a real one, with ( ... snip for posting ... ), not the esoterics of Eifeldorfers and Dwebus Doolitle. I am doing it on the power of your words, I have just been assigned a project to do plug-ins for Ignite Realtime: Openfire Server but the first time it does a code-analysis on the basis of how many comments per method call I will have at least 10k of hotbits all ready for it to soothe it's tortured soul.

    I long ago resorted to using random strings for method names as trying to do design by OO left me with the unshakable image of that as being the two ends of the human alimentary canal.

    Get the Netbeans with JDK bundle. Use it. You can debug right into Tomcat and your servlet's code, and the code automatically generated by the JSP page.
    So it's back to Beans, huh? Will Beans let me do my own Threading Sync()'s? My absolute first Java program juggled some twenty threads with remarkable robustness. I still have to do the loop logic and so on but you could 'hear' the "Nature of Machinery" running. Perhaps we could co-operate on a book title: "The Nature of Computing Machinery" in which we do a mid-level workup on the interaction of equipment in the form of Computing Machinery and the Humans who use them. Clearly AI is moving the embeded computational power forward, and it's ability to do that is a direct reliance on the strength of AI to make the computational nature run like invisible ants.

    It greatly improves your productivity.
    If it asks me for my email address, it can have my signature.

    There is no reason to use the old Servlet kit from Sun. uninstall it.
    On your authority. ( not to be repetitive or gloating )

    You have to use 'reuse' to have any productivity. and with security, its insane to roll your own. Just let the servlet engine do they work, someone else debugged it. If it doesn't work, submit a bug into their bugzilla
    Okay, but for sure I will be drilling into the sources that the debugger shows me for Tomcat. If it does it already, okay ~ but I will still call Random.nextInt() and get a session ID myself. We can put both in the log file and if a bugzilla does not live in real time, it is because someone did their job already.

    I come in behind those that don't on massive projects. I can spot them from a hundred yards away.
    Introduction to Programming Using Java.
    Cybercartography: A new theoretical construct proposed by D.R. Fraser Taylor

  6. #6
    fishtoprecords's Avatar
    fishtoprecords is offline Senior Member
    Join Date
    Jun 2008
    Posts
    571
    Rep Power
    7

    Default

    Quote Originally Posted by Nicholas Jordan View Post
    I will still call Random.nextInt() and get a session ID myself.
    Do not do that. Random.nextInt() is not good enough for any sercurity.
    At least use java.security.SecureRandom

  7. #7
    fishtoprecords's Avatar
    fishtoprecords is offline Senior Member
    Join Date
    Jun 2008
    Posts
    571
    Rep Power
    7

    Default

    Quote Originally Posted by Nicholas Jordan View Post
    a project to do plug-ins for Ignite Realtime: Openfire Server
    I hate it when marketing dweebs use "real time" when they mean "quick"
    IM/AIM/ICQ/Jabber, etc. are all fine things, but none of them are real time.

    real time is when you have a 40 ton hydralic press forming metal, and when you tell it to stop, you mean now!

    Realtime is the ABS system in your car, or better, the air bag. It the air bag is 500 milliseconds late, you have already crushed the car into the concrete pilling, and you are dead. Sorry about the slow response, RIP and all that.

  8. #8
    Nicholas Jordan's Avatar
    Nicholas Jordan is offline Senior Member
    Join Date
    Jun 2008
    Location
    Southwest
    Posts
    1,018
    Rep Power
    8

    Default fun with Masters

    Remarks noted for reply, but first we must address the issue ( moderators go look at this guys resume before getting between us - this is one heavy *** computer scientist dude ) first we must address the issue of all the surfers sync()'d in loginheader.jpg on the compulsory registration page. Getting smarter, the installer did not inform me that I would have to do the registrations. In my not humble opinion, Fire whatever it was ran a safer route when it did a call into a C++ virtual func with no vftable pointer. At least the os just did a return from the Window pointer, no stack unwinding or anything. Just click, next Z-Order in the process heap. ( or stack or whatever it is)

    Forcing one to use a registration basis ( such as the netbeans ide installer did ) that relies on historical origins in IP-v4 is very much withiin the problem domain of the paper you directed me to. I will reserve my comments to the email account off the Chicago server.

    Quote Originally Posted by fishtoprecords View Post
    I hate it when marketing dweebs use "real time" when they mean "quick" IM/AIM/ICQ/Jabber, etc. are all fine things, but none of them are real time.
    Correct. Reliability issues must scope in the human operator. We have a unique opportunity here, it may be that real real time already has nomenclature for what we are about to discuss here. I know it is in the one book I have on embeded devices, a text for a trainer board. That market, as a programming employment arena, constitutes some 60% of the market. Why 90+% of we hear favors socialization over engineering constitutes proof of a hijacked population, a battle for minds conducted by en masse embracing of ignorance. As a matter of fact, my team lead for risk-analysis is a degreed Industrial Engineer. I would really like to get you and he and the Sun engineer I emailed a few moments ago together on a potential marketing of a Sun videoconferencing product. We hear claims of 'critical shortage of it workers' ~ not suprisingly, those claims come from vendors of I.T. training products.

    If one of them can roll their own pencil out of the way and begin to write some code, I will put up a red-faced icon just to take the heat ~ just to get them to do something other than moan about stuff that does not matter.

    real time is when you have a 40 ton hydralic press forming metal, and when you tell it to stop, you mean now!
    See Seth Lloyd's remarks on that in his book.

    Realtime is the ABS system in your car, or better, the air bag. It the air bag is 500 milliseconds late, you have already crushed the car into the concrete pilling, and you are dead. Sorry about the slow response, RIP and all that.
    They have the ABS to come on at just exactly the instant when I try to take over. It makes the pedal go soft ~ the entire vehicle becomes spongy and develops a mind of it's own. Just when I need it to lock or un-lock, it just hangs there in a sort of limbo.

    Much like the limbo we see being shipped today.
    Last edited by Nicholas Jordan; 07-01-2008 at 12:03 AM.
    Introduction to Programming Using Java.
    Cybercartography: A new theoretical construct proposed by D.R. Fraser Taylor

  9. #9
    fishtoprecords's Avatar
    fishtoprecords is offline Senior Member
    Join Date
    Jun 2008
    Posts
    571
    Rep Power
    7

    Default

    Quote Originally Posted by Nicholas Jordan View Post
    Forcing one to use a registration basis ( such as the netbeans ide installer did ) that relies on historical origins in IP-v4 is very much withiin the problem domain of the paper you directed me to. .
    Yes, registering for free software is blatantly silly.

    You can always use "George Bush" with a potus@whitehouse.gov address.

    I think that Netbeans "requires" registration because of the JCE inside. Sun is very paranoid about ITAR restrictions. Netbeans can't be downloaded to countries that are on the "bad country" list. -- hey, don't ask me, as Commerce, it seems to change every week.

    On the netbeans users list, there are regular complains from folks in Pakistan having download troubles. Its all very silly, and IPv4 should die soon. Not that IPV6 will fix that piece of fiction.

  10. #10
    Nicholas Jordan's Avatar
    Nicholas Jordan is offline Senior Member
    Join Date
    Jun 2008
    Location
    Southwest
    Posts
    1,018
    Rep Power
    8

    Default salvage operation underway

    Okay Pat, where did noncetest.B64 go?

    Tried to do DES-56 for someone from I do not know from where I do not know so that his twisted sister cannot make him lose sleep at night when he discusses the project with me. Netbeans took seventy seconds to get past the splash screen, and now the entire machine is running like a bloated elephant on Noctamid. I cannot work this way, I have been through it too many times. I just become an easy takedown for some nasty drill-downs.

    Compiler is giving:
    Java Code:
    ****Encoder.java:28: package noncetest does not exist
                            noncetest.B64 b;
                                     ^
    // Proprietary information screened.
    Spare me the routine about DES-56, let's get my machine working again.
    Last edited by Nicholas Jordan; 07-01-2008 at 11:51 PM.
    Introduction to Programming Using Java.
    Cybercartography: A new theoretical construct proposed by D.R. Fraser Taylor

  11. #11
    fishtoprecords's Avatar
    fishtoprecords is offline Senior Member
    Join Date
    Jun 2008
    Posts
    571
    Rep Power
    7

    Default

    Can you fill me in a bit more? what code are you looking at? Mine? yours? someone elses?

  12. #12
    Nicholas Jordan's Avatar
    Nicholas Jordan is offline Senior Member
    Join Date
    Jun 2008
    Location
    Southwest
    Posts
    1,018
    Rep Power
    8

    Default details

    My code, new client of mine. Trying to write a super-simple main(), the editor is setup such that it is capable of calling the compiler by finding the win registry entry for JAVA_HOME ( or however the win installation works ) The guys that wrote the editor are pretty good.

    I got into the routine of doing slap-it-up-there and see what it does, all I did was run the download and install for the NetBeans I was directed to get and chose to find some other place to put the thing because I could tell from the hour-long file transfer that it was going to bloat my machine. I had been using 1.5 after grudingly upping from 1.4 to get the editor to integrate and being slowed down having to insert and remove Generics when going from one machine to another.

    I figured out not too long ago that I could drop jars in a folder named ext, I still have to hunt to find it and am beginning to think it does not build the classes into compiles, but only serves as a runtime. In any event, it is real handy so I built noncetest.B64 as soon as I found it and dropped it in there, thus continuing work. Figuring I would do this NetBeans thing while I had a signal, I continued work and did a build and all of a sudden it could not find noncetest.B64.

    When I went to see what was going on, I launched the NetBeans IDE and the whole machine slowed to a totally unacceptable response rate while it did all sorts of 'checking for latest software' and are you sure you don't want to register and all the usual bloated code-hog c***ola that does not have to be.

    There is just absolutely no justification for making a machine that can do a billion flops a second and deep-branch-prediction run like this. It took me an hour just to quit shaking. I am in a complete rage, I cannot have my machine running like this.

    Java Code:
    public static void main(String[] args)
    {
        if(args != null)
        {
            if(args.length > 0x00000 )
            {
                java.io.File infile = new java.io.File(args[0]);//
                if(infile.exists())
                {
                    try
                    {
    Introduction to Programming Using Java.
    Cybercartography: A new theoretical construct proposed by D.R. Fraser Taylor

  13. #13
    fishtoprecords's Avatar
    fishtoprecords is offline Senior Member
    Join Date
    Jun 2008
    Posts
    571
    Rep Power
    7

    Default

    Quote Originally Posted by Nicholas Jordan View Post
    I figured out not too long ago that I could drop jars in a folder named ext,
    That's been true since Java 1.1, perhaps earlier. It is, however, now considered bad form.

    With Netbeans, you can create a directory in your project, on the same level as the dist, build, src, test, etc directories named "lib" and then put the libraries that are specific to your application in the lib directory.

    Then use the Netbeans commands to control the project's properties, and add in the libraries you need.

    Netbeans will tell ant to include your library's .jar files

    This makes the end project .jar file (or .war or .ear) be self contained, and gets rid of, or at least controls the .jar equivalent to DLL Hell.

  14. #14
    Norm's Avatar
    Norm is offline Moderator
    Join Date
    Jun 2008
    Location
    SW Missouri
    Posts
    17,306
    Rep Power
    25

    Default Development environment and tools

    Since the thread has sort of wandered around, can I add a question:
    When creating a jar file for a project, how do you ensure that the jar file contains all of and only what classes are necessary?
    Does the IDE that care of that?

    I have only one customer for my programs so I haven't invested in any fancy software. I've written everything I need. For the above problem I have a program that scans a jar file and checks that all referenced classes are in the jar file, with the exception of the sun/java classes.
    I tried Netbeans on my 333MHz computer a couple of years ago and it was so slow, I gave it up. It's still slow on my 1.6GHz PC vs my simple IDE.

    Thanks,
    Norm

  15. #15
    fishtoprecords's Avatar
    fishtoprecords is offline Senior Member
    Join Date
    Jun 2008
    Posts
    571
    Rep Power
    7

    Default

    Quote Originally Posted by Norm View Post
    Since the thread has sort of wandered around, can I add a question:
    When creating a jar file for a project, how do you ensure that the jar file contains all of and only what classes are necessary? Does the IDE that care of that?
    It allows you, the smart developer, to manage it. At least Netbeans does, I have used Eclipse, but not in depth.

    In NetBeans, you can add and substract .jars from the library, so you can try removing them and see if it all still works.

    Sadly, this only shows what is needed on your system. If you deploy on another system, you may find that you are adding a bit of redundancy, especially if they did the old-style /lib/ext hack

  16. #16
    Nicholas Jordan's Avatar
    Nicholas Jordan is offline Senior Member
    Join Date
    Jun 2008
    Location
    Southwest
    Posts
    1,018
    Rep Power
    8

    Default I guess I'll have to eat it on this.

    Read your reply, will read it many times and eat my Humble Pie in big, choking chunks. I just shipped something just now that is going to impress the customer like a Hoard of Banshees on Freedom Celebration Day. It's running a little better, I just work in other windows and then let the IDE do it's work and snag the Sources it generates.

    They say patience is a virtue. I will put some on my Humble Pie.
    Introduction to Programming Using Java.
    Cybercartography: A new theoretical construct proposed by D.R. Fraser Taylor

  17. #17
    Nicholas Jordan's Avatar
    Nicholas Jordan is offline Senior Member
    Join Date
    Jun 2008
    Location
    Southwest
    Posts
    1,018
    Rep Power
    8

    Post adding compiled class files to dot jar

    Quote Originally Posted by Norm View Post
    Since the thread has sort of wandered around, can I add a question:
    Sure, I think you are the navigtor anyway. We are lost, maybe you can just give us a heading.

    When creating a jar file for a project, how do you ensure that the jar file contains all of and only what classes are necessary?
    That is sort of a hidden gotcha type of question, effective answer is to run the jar utility yourself. One may feed specs too the rum_runner, excuse me, Jar Packer, telling it exactly what files you want to add. There is a standard utility that will show you what files are in a .jar you get from somewhere. It is not hard to run, I heard one person say you cannot compile the sources it spits out, the javac will not understand them, but I did no testing on that assertion.

    Does the IDE that care of that?
    It should.

    I have only one customer for my programs so I haven't invested in any fancy software. I've written everything I need. For the above problem I have a program that scans a jar file and checks that all referenced classes are in the jar file, with the exception of the sun/java classes.
    You possibly intend to state that the customers needs have as at least a partial spec the ability to look into a dot jar file and insure that what it says it has is actually there. This is a standard advanced work, there are several ideas I have but I will let you clarifiy the spec.

    I tried Netbeans on my 333MHz computer a couple of years ago and it was so slow, I gave it up. It's still slow on my 1.6GHz PC vs my simple IDE.
    Yeah, I don't know why Pat told me what he did but he is a super-master so if he says it's NetBeans, then we just load a project after we have worked on it awhile and plan for lunch before hitting the build button. I just built noncetest.B64 from sources in NetBeans as a compiled library. I do not know ( now that I have it built ) how to tell the IDE to install the lib as a Globally Available Local Build Tool, I did manage to build it as a Global Library.

    Running IDE's is probably harder than learning the base languge. The reason it runs slow is that doing realistic verification on, ahem,.... popular proprietary operating systems is that it chokes down to some sixteen-bit single-threaded dlls and to verifiy an install and protect the proprietary positions of commercial entities who may have contributed requires pretty much rooting the machine and doing some pretty sophisticated cryptographics.

    I am gettng better responsiveness this morning, at least I do not have to wait several minutes while drilling F11 several times to regain the Z-Order tabbing control passed to the dos interrupt vector table. That is just something we will have to live with, go look at Pat's resume.
    Introduction to Programming Using Java.
    Cybercartography: A new theoretical construct proposed by D.R. Fraser Taylor

  18. #18
    Norm's Avatar
    Norm is offline Moderator
    Join Date
    Jun 2008
    Location
    SW Missouri
    Posts
    17,306
    Rep Power
    25

    Default

    That is sort of a hidden gotcha type of question, effective answer is to run the jar utility yourself. One may feed specs too the rum_runner, excuse me, Jar Packer, telling it exactly what files you want to add. There is a standard utility that will show you what files are in a .jar you get from somewhere. It is not hard to run, I heard one person say you cannot compile the sources it spits out, the javac will not understand them, but I did no testing on that assertion.
    Thanks for the response. Are you guys getting paid while you're cruising the web? I'm retired and do this for amusement.

    I create a batch file with the jar command for every jar file I want and add to it all the class files I think are needed for the app. The problem is if I overlook a class that is rarely used, or if class A refers to class B etc, how can I be sure that all the needed classes are there?
    After building a jar, running it a few times and then finding out that parts are missing and having to go back and add the missing parts to the batch file and creating a new jar file, I wrote a tool to check for all references and since I'm a neatnick to tell me if there are any classes in the jar that are not used.
    In a production environment with paying customers, sending out an incomplete jar file would be a problem. One solution would be to put everything in the jar.

    Norm
    Last edited by Norm; 07-03-2008 at 07:56 PM.

  19. #19
    Nicholas Jordan's Avatar
    Nicholas Jordan is offline Senior Member
    Join Date
    Jun 2008
    Location
    Southwest
    Posts
    1,018
    Rep Power
    8

    Default check this out

    Java class file inspector:

    Javad: A Java Class File Disassembler

    I have not looked at it yet.
    Introduction to Programming Using Java.
    Cybercartography: A new theoretical construct proposed by D.R. Fraser Taylor

  20. #20
    Nicholas Jordan's Avatar
    Nicholas Jordan is offline Senior Member
    Join Date
    Jun 2008
    Location
    Southwest
    Posts
    1,018
    Rep Power
    8

    Default additions to jar

    No, we are not being paid - at least not in real and immediate sense. The computing device is the first device in human techno-babble to engage the human in the use of the machine for it's own sake. I for one intend to pick up any commercial business I can that meets my standards. I am not gonna crawl for anything except squids. ( security joke )

    Interesting part about stuffing things in a jar file is that we can embed images, do a runtime call ( load Library ) that drills down to routines written in C and possibly other things I do not know about.
    Introduction to Programming Using Java.
    Cybercartography: A new theoretical construct proposed by D.R. Fraser Taylor

Similar Threads

  1. session handling
    By priyanka_t in forum JavaServer Pages (JSP) and JSTL
    Replies: 10
    Last Post: 08-11-2009, 12:32 PM
  2. session object
    By 5alive in forum New To Java
    Replies: 1
    Last Post: 06-23-2008, 12:45 AM
  3. session
    By jm_it04 in forum AWT / Swing
    Replies: 0
    Last Post: 03-04-2008, 11:32 AM
  4. Refresh session
    By cachi in forum JavaServer Pages (JSP) and JSTL
    Replies: 1
    Last Post: 08-07-2007, 07:52 AM
  5. Use session
    By Eric in forum Java Servlet
    Replies: 1
    Last Post: 07-05-2007, 08:34 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •