Slashdot Mirror


User: The+Wookie

The+Wookie's activity in the archive.

Stories
0
Comments
107
First seen
Last seen
Profile
(view on slashdot.org)

Comments · 107

  1. Source code for session servlet on Web Servers To Handle Java Servlets And WAP? · · Score: 2

    In case anyone is interested, you can use this servlet to insert the session ID into the URL and filter the ID out of the path, even if you use a WML file. This doesn't seem to work in the Phone.com simulator, though. It works fine in the Nokia. I think it may have something to do with the Phone.com server supporting cookies, but I can't be sure. If anyone gets it to work, let me know. I'll keep playing with it, too.
    -------------------------------------
    import java.io.*;
    import javax.servlet.*;
    import javax.servlet.http.*;

    public class FakeSessionServlet extends HttpServlet
    {
    public void service(HttpServletRequest request,
    HttpServletResponse response)
    throws ServletException, IOException
    {
    response.setHeader("Content-Location", request.getRequestURI());

    String extraInfo = request.getPathInfo();

    // Locate the next slash in the path (assume there is one at position 0)
    int slashPos = extraInfo.indexOf('/', 1);

    if (slashPos > 0)
    {

    // Get the subsession id and the real path to access
    String virtSession = extraInfo.substring(1, slashPos);
    String fullPath = extraInfo.substring(slashPos);

    if (fullPath.indexOf(";jsessionid") < 0)
    {
    fullPath = fullPath + ";jsessionid="+virtSession;
    }

    // Assume the real path is under /appdir
    getServletContext().getRequestDispatcher("/appdir" +fullPath).
    forward(request, response);
    }
    }
    }
    ---------------------------------------------
    Using Resin, you need to add the following items to your resin.conf file:
    ---------------------------------------------
    <servlet-mapping url-pattern='/appsession/*' servlet-name='fake-session-servlet'/>
    <servlet servlet-name='fake-session-servlet' servlet-class='FakeSessionServlet'>
    </servlet>
    <path-mapping url-regexp='^/appdir/' real-path='h:/jprogs/sesstest/'/>

    <mime-mapping>
    <extension>.wml</extension>
    <mime-type>text/vnd.wap.wml</mime-type>
    </mime-mapping>
    ---------------------------------------------

    Now, you send your phone to this main page that redirects you through the FakeSessionServlet to get to the real main menu:
    ---------------------------------------------
    <%
    response.sendRedirect("/appsession/"+
    session.getId()+"/Menu.wml");
    %>
    ---------------------------------------------

    The menu.wml file looks like this:
    ---------------------------------------------
    <?xml version="1.0"?>
    <!DOCTYPE wml PUBLIC "-//WAPFORUM//DTD WML 1.1//EN"
    "http://www.wapforum.org/DTD/wml_1.1.xml">

    <wml>
    <card id="mainmenu">
    <p>
    <a href="Test1.jsp" title="Put Into Session">Put Into Session</a><br/>
    <a href="Test2.jsp" title="Get From Session">Get From Session</a>
    </p>
    </card>
    </wml>
    ---------------------------------------------

    The Test1.jsp file looks like:
    ---------------------------------------------
    <%@ page language="java" contentType="text/vnd.wap.wml" %>

    <?xml version="1.0"?>
    <!DOCTYPE wml PUBLIC "-//WAPFORUM//DTD WML 1.1//EN"
    "http://www.wapforum.org/DTD/wml_1.1.xml">

    <%
    session.setAttribute("foo", "Bar!");
    %>
    <wml>
    <card id="test1">
    <p>
    I put <%= session.getAttribute("foo") %> into the session.
    <a href="Menu.wml" title="Back to Menu">Back To Menu</a>
    <a href="Test2.jsp" title="Get From Session">Get From Session</a>
    </p>
    </card>
    </wml>
    ---------------------------------------------

    Test2.jsp looks like this:
    ---------------------------------------------

    <%@ page language="java" contentType="text/vnd.wap.wml" %>

    <?xml version="1.0"?>
    <!DOCTYPE wml PUBLIC "-//WAPFORUM//DTD WML 1.1//EN"
    "http://www.wapforum.org/DTD/wml_1.1.xml">

    <wml>
    <card id="test2">
    <p>
    I found <%= session.getAttribute("foo") %> in the session.
    <a href="Menu.wml" title="Back To Menu">Back To Menu</a>
    </p>
    </card>
    </wml>
    ---------------------------------------------

  2. Re:You can also embed the session ID in the path on Web Servers To Handle Java Servlets And WAP? · · Score: 1
    That works fine if you are dealing with a device that supports cookies. The whole idea behind URL rewriting is that it inserts the session ID into a URL if the browser doesn't support cookies. Otherwise it puts the session ID in a cookie and everything works fine.

    The problem in the WAP arena is that there are a lot of phones that don't support cookies.

  3. You can also embed the session ID in the path on Web Servers To Handle Java Servlets And WAP? · · Score: 1
    The thing I hate about URL rewriting is that you can't use static HTML pages that contain links.

    If you don't mind managing your own session table, you can do sessions with a slight variation on URL rewriting. Instead of embedding the session ID in the parameter section of the URL, you put it in the path section. You then have a servlet that is invoked for every reference to that path.

    For example, you set up a servlet to handle /appdir/. Now every request for /appdir/, like /appdir/index.html goes through the servlet. The trick is, you generate a random session ID and send the user to something like /appdir/9859738579834/index.html. When they click on a link in index.html, assuming the link is relative to index.html, the phone will request /appdir/9859738579834/whateverlink.html or a servlet/JSP. All you need to do in your /appdir/ servlet is parse the key, look up the session-oriented data, place it in the request object and then do a forward to the real page.

    There was a message about something similar (doing multiple sessions for a single browser instance) on the JSP interest mailing list.

    I haven't tried it for WAP, but I suspect it would work.

  4. Help! Microsoft has patented me! on Microsoft Patents Package Management · · Score: 2
    I check the dates on my installed Linux packages and download updates and install them.


    We are Wookie of Borg.

  5. Re:Very few good C++ programmers out there... on IBM JDK 1.3 For Linux · · Score: 3

    I used C++ for many years, although not as much since Java has come out, and since then the standard was finally ratified. Like you, I don't want to get into a Java has foo, C++ has bar kind of argument, I can just state what has made me prefer Java to C++.


    Simplicity:While I would agree that on a large scale, a well-designed C++ system can be just as simple, sometimes simpler than a Java system. In the small, though, I find that I can create useful Java classes faster. I don't have to worry about destructors, assignment operators, etc. I know they have their use, I just prefer not having to deal with them. And just from a Me-Whining-About-Something-Insignificant standpoint, I hate the template syntax.


    Standard Libraries:Okay, so there's no standard. But look at STL compared to the libraries that come with J2SE. With STL you've got containers, algorithms, strings.. very system-independent things. With Java I can write database code for almost any database and it will work on Linux, Windows, Solaris, etc. Swing is kinda big and slow, but at least I know I can count on it being there. C++ doesn't address areas like this. Again, for good reason. If I had to get that kind of stuff by a standards committee, I'd punt, too.


    Garbage Collection:Sure you can do it in C++, but who does? And is it thread-safe? I know it's not the fastest thing in the world, and in some respects indicates a kind of laziness, but at least all the libraries use it. I don't have to worry about which ones do and which ones don't.


    Bounds Checking:It's really not bounds checking so much as the whole pointer deal. No one likes to look for bugs caused by invalid pointers or references. It's not just running off the end of an array, it's things like returning a reference to a stack-allocated object. It's not a smart thing to do, but people do it anyway.


    Reflection:You need to try Java's reflection. RTTI doesn't come close. You can ask a class what methods and fields it has, get and set field values on the fly, dynamically invoke methods.


    Every so often I go back and try to work with C++ and I just find myself missing the Java features I have grown to love. But that's just me.. I love vi, too, having used it for 16 years. :-)

  6. Re:Java? Close... on IBM JDK 1.3 For Linux · · Score: 4
    The ability to move a Java program from one platform to the other without having to recompile is overrated. It's not that big a deal to recompile, especially if you know that you don't have to do any system-dependent #defines like you do in C.

    I would think that the main reasons to use Java are:

    Simplicity

    Built-in threading

    Garbage collection

    A great set of standard libraries

    Bounds checking on arrays (really, avoiding the C/C++ pointer overrun problems)

    The ability to print a stack trace from an exception (oh how I miss that when I do C++!)

    Reflection

    I don't see how a compiled, system and arch dependant binary would eliminate any of those reasons.

  7. Re:the fuss? on Starwars Episode 1 DVD? · · Score: 1
    It may sound silly, but that's exactly the lesson taught by "Return of the Jedi," wherein Darth Vader is forgiven all his sins, because he saved the life of his own son.

    I disagree. Luke saved Anakin by reaching out to him. Darth was really a puppet of Palpatine using Anakin's body. Luke reached out to Anakin, got him to destroy Palpatine and thus killed Darth as well. It would be as if Hitler had been drugged by Goebbels and induced to command things that he would not have if he were of sound mind. In fact, I think there was a Star Trek TOS show that mimicked this exact idea.

  8. Company to extend the life of mid-80's technology on Mir Reactivation Mission to Launch Monday · · Score: 2
    So Mir has been around since the mid 80's, was thought to be dead and was all but abandoned. Now they are going to revive it because they see it still has commercial viability.

    My only question is, will they call it "Mir: Millenium Edition" ?

  9. What an argument against breaking Microsoft up! on Bill Joy On Extinction of Humans · · Score: 3
    Way to go, Bill Joy!


    Wouldn't you feel better about the future if you knew that the only company that would be developing such a thing is Microsoft? (allowing them to continue unchecked and take over the world)


    Hell, you'd end up with a creature that drowns when it tries to take a shower, getting stuck in the "lather-rinse-repeat" infinite loop.


    Microsoft Saves Humanity! Woo hoo!!

  10. Interesting letter counts on Please Patiently Ponder Purported Poe Puzzle · · Score: 1
    If you count the letter frequencies, ignoring the size and orientation of the letters, the count is quite uniform. Looking at the counts for the letters in various sizes and orientations, I noticed that the large letters have an unusual distribution.

    For the large, rightside up letters, there are no fewer than 3 of any letter and no more than 9.

    For the large, upside-down letters, the counts range from 1 to 8.

    If you remove the large letters, the overall frequency counts fall a lot more in line. I wonder if it could be a combination of 4 substitution ciphers after the large letters are removed.

    Anyone care to investigate further?

  11. Re:Funny, but irrelevant on Bearded Drinkers Lose Guinness · · Score: 1
    Peer review? Are you suggesting that the missing pints are lost by people peeing?

  12. 100% Uptime for Windows 2000 on Microsoft Says Windows More Reliable Than Sun · · Score: 1

    They should have claimed that there has been NO downtime, planned or unplanned, on the production release of Windows 2000. They only have 4 more days to claim that.

  13. Re:Availability Guarantees on Microsoft Says Windows More Reliable Than Sun · · Score: 1

    Wookie's can't do math too well. A 99.95% availability is only twice the availability of 99.9%. Still, that's a lot better.

  14. Availability Guarantees on Microsoft Says Windows More Reliable Than Sun · · Score: 1

    It's funny how all of these "proofs" only offer half the story. Like how Sun systems have failed, but no mention of NT systems failing.

    I checked out the availability links they offered up for Windows. Of the four, the most interesting was the Compaq site, because on the same page where they guaranteed "99.5% or 99.9%" availability for NT, they guaranteed 99.99% availability on Tru64 Unix and OpenVMS.

    Sun's web site lists their availability guarantee as 99.95%. Sun's guarantee is still 5 times higher than what is offered by the NT vendors.

  15. Re:Obviously this book is a waste of time. on Java Look and Feel Design Guidelines · · Score: 1
    You posted using the minimum quality that the consumer would tolerate.

    Obviously it was below the minimum quality or you wouldn't be complaining about it, would you?

    Get off the high horse and learn to make some $$$s from all these dumb consumers out there who wouldn't recognise a quality operating system if it was given to them free, with source on a plate...

    The term "bottom-feeder" comes to mind when I see a phrase like this. As a marketroid, you should also know that people use Windows as a matter of convenience. Yes it's buggy, but it comes pre-installed on their PC's and almost every program they would want to run is available for it, which is not the case with Linux.

    Just as the users have their tradeoffs (quality for convenience), developers also have their tradeoffs. Coding standards really help a large project, especially if there is a lot of turnover. Design reviews and code walkthroughs are also a big help. The larger the project, the bigger the help. For smaller projects, though, these activities would take a much larger portion of the total development time, so they are usually scaled back or eliminated completely. Usually when I hear someone tell me that I should eliminate activities like these (or even worse, skip design and go straight to coding) they usually only have experience with short projects and think that techniques for the short projects scale up well.

    I do care about making a good product and I'm not about to trash my principles to make a fast buck. If you think that the end goal is to get the most money, that's your opinion and that's why you're in marketing.

  16. Re:Obviously this book is a waste of time. on Java Look and Feel Design Guidelines · · Score: 1

    >In short forget about coding standards, design >reviews and all that other ivory-tower nonsense, >fire anyone suggesting such time-wasting >strategies, and with the money you have saved, >hire yourself some qualified marketing experts >and watch the $$$s start rolling in.

    And people wonder why there are so many crap products out there that crash when you look at them wrong. You gotta love the marketroid attitude. "Don't spend any time making a good product. Just spend money trying to convince people that they want crap."

    >As usual my "open source" marketing advice is >free.

    And worth every penny.

  17. Speed vs. Convenience on Transmeta Code Morphing != Just In Time · · Score: 1


    First of all, I have seen a few examples of Java running maybe only 10% slower than the equivalent C program. In these cases, the programs were doing raw calculations and not allocating anything.

    While I would love to see Java run as fast as C++, that's not the most important thing to me. I can develop in Java much faster than C++. Doesn't "fast enough" outweigh "fastest possible" if you get it sooner?

    Perl is slower than C, too, but you don't hear as many complaints about that. For most applications you use Perl for, writing the equivalent in C would be a huge pain.

  18. It's not the additions so much as the removals on Judge Reinstates Java Injunction Against Microsoft · · Score: 4


    It's really easy to not use any of Microsoft's extensions. I use Visual J++ as my IDE and generate code that runs beautifully on Solaris because I stay away from Microsoft's extensions.

    Unfortunately, they decided to use a different native method interface, which causes some packages to fail. Also, in their standard distribution, they omitted RMI (like we're all gonna choose DCOM if RMI isn't there). That makes it tougher to write applets and applications that use RMI and run under Microsoft's VM.

    It has gotten worse now because Sun no longer sends MS any Java updates, so the MS Java is pretty much stuck at around JDK 1.1.3. JDK 1.2 runs so much faster, I won't use jview at all to run programs, and I'm about to give up on VJ++.

  19. Re:Still only Java 1.1, though? on Red Hat Distributing IBM Java Runtime and Tools · · Score: 1


    I posted the original comment, and I never meant to imply that IBM wasn't doing a terrific job with Java. I have been using their Linux JDK and Jikes for quite a while now and they are very solid.

    My only concern was that this was being billed as "IBM beating Sun to the punch" and I wouldn't consider releasing a 1.1 JDK a little earlier than a 1.2 to be much of a beating.

    I have looked at the various press releases and I can't find any reference to what version they will be releasing.

  20. Calibration? on Driving with Night Vision · · Score: 2

    I've never used a HUD, so I have been wondering if there is any calibration required. Does it line up correctly no matter if you are 5' tall or 6'8" ?

  21. It's a shame, I hope Rational can keep it going on Microsoft Selling J++; Discontinuing Development · · Score: 3


    I have found J++ extremely handy for doing server-side coding. As an IDE, I haven't seen anything that can touch it. JBuilder is a big, slow piece of crap. I gave up in Visual Cafe after 2.5 wouldn't stay up for more than an hour. It was very responsive, the project management was a little difficult to adjust to, but I find it to be far easier to work with, and the drop-down auto-completion works very well (much nicer than Borland's). Also, they automatically parse Javadoc comments to give you context-sensitive help.

    I have never had to recompile any J++-generated code in order to get it to run on a non-Microsoft VM (Sun's and IBM's on Solaris, Linux, and Windows).

    If they had just supported pure Java GUI's in their RAD stuff, they might have dominated the market.. too bad they had to put preservation of the monopoly above the desire to make a good tool.

  22. Re:One of the coolest things about EROS: persisten on EROS 1.1 relased under GPL · · Score: 1


    One thing that bothers me about this persistence is that they would need to save the state of various cards on your machine, too, which I doubt that they do. I would imagine that some of these 3D accelerator cards require a good bit of initialization.. so you're playing some cool 3D game, the power goes off.. 15 seconds later your game starts up again and you can't see anything anymore.

    For a server, I think it would be really cool, though.

  23. Re:Silly rule... on Chess Dispute: Kasparov vs. the World vs. MSN · · Score: 1


    Well, it's hardly Chess, but in Scrabble, a turn is not committed until you punch the clock. There's certainly ample opportunity for your opponent to show an expression. I once made an error and my opponent challenged the word before I hit the clock, allowing me to correct the error without losing a turn.

    It's certainly a lot more definite when you hit a clock. Accidentally dropping a piece, or brushing one accidentally shouldn't force you to make a move.

  24. Security through crashing on 911 Calls Linux · · Score: 1

    Are you trying to imply that NT crashes as a security precaution?


    You gotta stop hanging around those marketing people.


    I think Slashdot does pretty well considering the number of users that hit it.
    Certainly better than some of these MS sites with N machines
    running ASP that still can't serve up a page in a reasonable amount of time.

  25. Re:You can fix the pointer on Mozilla M9 Released · · Score: 1
    Thanks for the tip! It's not exactly in an obvious place..

    Options/Configure File Manager...

    Then pick the Color(!) tab where you'll find a "Change cursor over link" option.