Just simple question about java HTTP session mechanism...

I have one simple question regarding the java HTTP Session Mechanism.
1) Is there another alternative for the HTTP Session ? If have, what the alternative?
2) I have been acknowledge that HTTP session is same as cookie system and others say have many different, where is the different..
thanks

1) You can always do your own session handling. But why bother when there is one there for you?
2) The issue with sessions is how to identify the user from the request. Each session gets given a session id. The user has to send that session id with every request they make.
The standard way is to use a session cookie, which only lasts as long as the browser session. The cookie with the JSESSIONID is sent with every request, thus the server can identify which session a user is in from their cookie.
Of course you cannot assume that the browser will support cookies, so you need to encode all URLs with the method response.encodeURL(). That method puts the session id into the URL if the browser does not support cookies, or they have them switched off.

Similar Messages

  • Simple question about JAVA path

    Hi. I have a simple question , but I spent several hours trying to find an answer.
    How do I know the location of the java executable which is used by Concurrent Manager.
    I already know that running which java under application user will not give me the correct answer

    Maybe you can try like this:
         public String getPath(){
              Class cls=getClass();
              String className=cls.getName();
              String packageName=cls.getPackage().getName();
              System.out.println(className);
              System.out.println(packageName);
              String newClassName=className.replaceAll("\\.", "/");
              String resouceName=newClassName+".class";
              System.out.println(resouceName);
              URL url;
              url=cls.getClassLoader().getResource(resouceName);
              String path="";
              path=url.getFile();
              return path;
         }

  • Simple question about java.rmi.registry.Registry

    Hi,
    where the object java.rmi.registry.Registry takes a URL to rmiregistry when perform bind method.
    thanks.

    Ok, will try to explain.
    I have a server that I register in the RMI registry. Client from a remote machine get the server (as a remote object) and calls his method for the generation of another object on the parameters passed. The server creates this object and tries to register it in the RMI registry, and this raises an exception Registry.Registry.rebind disallowed; origin /11.0.10.31 is non-local host.
    11.0.10.31 is a IP - address of the client

  • Simple Question about java

    Hi all,
    i have one doubt that is
    JLabel lblName = new JLable("String");
    Font f = new Font("Times New Roman", 0, 14);
    lblName.setFont(f);
    I used in one programm and compiled with Java1.1.8
    and run the ptogramm but the font hasn't changed
    If I use java1.2 its Changing So what is the Difference btw
    java1.1.8 and java1.2
    java1.1.8 doesn't support Font???
    please confirm my doubt
    thanks
    byeee

    I think it's the times new roman that's being supported since 1.2.
    Kind regards,
    Levi

  • Simple question about mount and delay script

    Hello, I have a simple question about mounting volumes on start up.
    My computer wakes up auto - and then auto there are serveral applescript tasks (mount and start up programs)
    I use this script (daily) for serveral connections with external volumes I always need the connect to. ( In the script I use this code 3 times for other locations) I do this on start up.
    set Uname to "XXX"
    set Pword to "XXX"
    set someVolume to "afp://XXX.XXX.XXX.XXX/XXX/XXX
    mount volume someVolume as user name Uname with password Pword
    (same code for 2 other locations)
    When i do this on start up sometimes the script says there is no connection possible. I guess it's because on start up the connection isn't there. And 1 minute later when computer is total ready the connection is ok. When I run the script then It works. Just sometimes ( In the morning) 'It' want to connect but the script stops. When i do it manually(I run the script again) it works just fine.
    Is it possible that I need a delay? Can someone explain this?
    How would I make a delay handler for this script? Is that the best solution?
    Thanks in advance. This is something small i'm wondering about.
    Colin

    BTW, If you saved the script as an application +(and not as an application bundle)+ you could drop the script on to *Drop Script Backgrounder* (freeware).
    Then the script would run in the background, so, you wouldn't see it running in the Finder.
    <http://www.macupdate.com/info.php/id/7922/drop-script-backgrounder-x>
    Tom

  • A simple question about combo box

    Dear All,
    Just got a simple question about combo box: I have one of these selectors with labels based on filtered rows from a table.
    Is it possible to have one more label that would select all options?
    Like:
    Product A
    Product B
    Product C
    All Product
    Many thanks for your help!
    Gilles

    Hi Gilles,
    The purpose of ComboBox itself to select single option out of many.
    For your purpose, you may have to use "List Builder" which can accomodate 1 or more  to select.
    Please revert for more clarification if you need.
    With best wishes
    BaaRaa.

  • Question about Java's HttpServer: Threading? Backlog?

    Hello,
    I have two questions about Java's HttpServer (com.sun.net.httpserver). From the JavaDoc:
    >
    Management of threads can be done external to this object by providing a Executor object. If none is provided a default implementation is used.
    >
    How can I get information about the default implementation in 1.6.0_13? Do you know the behavior? From my observations, the default implementation uses no Threads, meaning every request is handled in the same Thread, this results in handling the requests to the HttpServer one after another.
    Is this right?
    The second question is about this, also from the JavaDoc:
    >
    When binding to an address and port number, the application can also specify an integer backlog parameter. This represents the maximum number of incoming TCP connections which the system will queue internally. [...]
    >
    When setting the backlog to -1, it uses the systems default backlog. How can I determine the systems default backlog? Can some lines of Java code reveal it (there is no getBeacklog() method)? Or is it up to the Operating System (we use Redhat Linux)?
    Thanks a lot for your help!
    Regards,
    Timo

    How can I determine the systems default backlog?You can't. There is no API for that even at the C level.
    Can some lines of Java code reveal itNo.
    Or is it up to the Operating System (we use Redhat Linux)?Yes. Linux provides a large default. It seems to be at least 50 on most platforms. This is not something you should be worrying about.

  • Three questions about Java and Ftp

    Hello, i've the following questions about Java and Ftp:
    1- .netrc file is in $HOME directory but i can't access to this directory from java code. The following line producesan Exception (directory doesn't exists)
    FileWriter file = new FileWriter ("$HOME/.netrc");
    2- .netrc file must have the following permissions: -rw- --- --- but when i create the .netrc file the following permissions are on default: -rw- r-- r--, how can i change this permissions? (In java code, i can't use chmod.....)
    3- Are there any way to pass parameters to a .netrc file? If i get to do this i needn't change the permissions because i can't modify or create/destroy this file.
    Thanks in advanced!!!
    Kike

    1- .netrc file is in $HOME directory but i can't
    access to this directory from java code. The
    following line producesan Exception (directory
    doesn't exists)
    FileWriter file = new FileWriter ("$HOME/.netrc");$HOME would have to be replaced by a shell, I don't
    think you can use it as part of a legal path.
    Instead, use System.getProperty("user.home");
    Ok, thanks
    2- .netrc file must have the followingpermissions:
    -rw- --- --- but when i create the .netrc file the
    following permissions are on default: -rw- r--r--,
    how can i change this permissions? (In java code,i
    can't use chmod.....)Yes, you can: Runtime.exec("chmod ...");
    I need to use estrictly the .netrc with -rw- --- --- permissions
    Yes, i can use Runtime.exec ("chmod ..."); but i don't like very much this solution because is a slow solution, am i right?
    3- Are there any way to pass parameters to a.netrc
    file? If i get to do this i needn't change the
    permissions because i can't modify orcreate/destroy
    this file.I don't think so. Why do you need the .netrc file in
    Java at all? Writing a GUI frontend?I want to use automatic ftp in a java program and FTP server, the files and path are not always the same, so i can:
    - modify .netrc (for me is the complex option)
    - destroy and create a new .netrc (is easier but i have permissions problem)
    - use .netrc with parameters but i haven't found any help about it
    Thanks for your prompt reply!!!!
    Kike

  • A simple question about performance!

    Hi! I have a simple question about performance. Suppouse that you have a servlet or a class with DB access, and you need to use a value several times in that page. What is best, to assign the value from say, a resultset or a request.getParameter() to a variable or to call the resultset or the request every time you need to retrieve that value? Which option uses less memory, which is faster, etc.?
    Hoping the best fou u
    Raul

    If you need more values from a db, the best is to open some connections (connection pool) and use the for accessing the db.
    To get the data only once, open the connection, get the data, store the data whereever you want: variable (class), hidden control (if you want to send from one page to another by request) and close the connection as quicky as possible.
    The advantage of the first method is that the most time consuming activity (connections opening) is done only once.

  • Question about navigation in session scope

    Hi.
    I dont know how to resolve a problem or how to focus this stuff.
    I'll try to explain myself.
    Let say I have a page (a.jsf) with several links, all this links navigates to the same page (b.jsf) which shows the results.
    For each link in a.jsf I have attached a bean with a logic, so If I click in link 1 I go to the b.jsf showing data read from the database.table1. If I clik in link2 I go to b.jsf showing data read from database.table2, and so on...
    The beans are in session scope (and must be).
    The first time works ok because I initialize the bean in b.jsf, read data and I show using a selecManyListBox to show it, but if I go back and select another link it goes to b.jsf, but it shows the old data, the data read the first time, because it never calls again the init method.
    Somebody has talked about using an additional bean to control this but once the bean in b.jsf is created I don't know how to call again the init method in beanB (b.jsf)..
    I have attached a very simple project to deploy in eclipse 3.3 and tomcat 6.0. In this example instead of read from database I read from an structure created in memory to simulate this.
    Somebody could take a look and comment something about it.
    http://rapidshare.com/files/197755305/_session-forms.war
    Thanks

    Hi.
    I understand is the same doing in the action method in a button or a commnad, the project is just an example, my real app is a tree, so is not a question about a button or a command, is about the logic being in session scope. I don't know how to face it.
    thanks

  • Questions about Java Servlets and JSP

    Hi,
    I'm a confident Java Programmer (and really enjoy using this language) but am very new to Java servlets and Java Server Pages.
    I have previously worked with Perl on my web projects (simple 'league' style voting pages). I read in my 'Core Java' book that I should no longer use perl or even cgi.
    I need to know more about Java servlets and Java Server Pages so I can make the switch to a 'real' programming language.
    I have a few questions:
    How should I start to learn JS and JSP?
    How applicable will the java knowlegdge I have already be?
    Are JSP common on the world wide web?
    What tools do I need to start? (I currently develop in JBuilder and have Java 1.4.1 Standard Edition)
    Is it likey my web host (and others) will support JSP?
    Thank-you very much for helping a novice get started,
    Regards,
    Paul

    Hi, Steve ...has to be frustrating! But do not despair.
    Let's suppose the servlet it's named MyServlet on package org.servlets
    WEB-INF should look:
    WEB-INF
    classes
    org
    servlets
    MyServlet.class
    web.xml
    web.xml file should have this two declarations:
    <web-app>
      <servlet>
        <servlet-name>MyServlet</servlet-name>
        <servlet-class>org.servlets.MyServlet</servlet-class>
      </servlet>
      <!-- other servlets -->
      <servlet-mapping>
        <servlet-name>MyServlet</servlet-name>
        <url-pattern>/MyServlet</url-pattern>
      </servlet-mapping>
      <!-- other servlets mappings -->
    </web-app>Now, once the container starts (Tomcat?), you should be able to see that servlet in:
    http://localhost:8080/[my-context/]MyServletAnd what my-context is? The web application context. This string should be empty if your're deploying to the root context, otherwise should the context name. In Tomcat, deploying to root context defaults to using webapps/ROOT.
    Sorry for my English, but I felt the need to answer your request. I hope it helps despite my writing.

  • Question about Java apps structure

    Hello guys,
    I'm a professional C++ programmer and I would like to start learning Java. I'm reading about Java from here and there and would like to ask you about how a java program is structured compared to C++.
    So in C++, I have main.cpp (or any other file name, doesn't matter), which contains a the main() function, and I have .h and .cpp class files that I instantiate (basically) in my main function to get my program to work.
    In Java, I'm confused and can't really find the "general" rule to how stuff are organised. I noticed that every class has a main function (why?), and there's no global scope. And "somehow", file names must exactly be equal to the class names.
    The question is: how are Java files of classes (and other stuff, if available) are arranged to create a program? What's the standard why? And How can I have many classes together in a single main()?
    Thank you for any efforts :-)
    Edited by: 927494 on 13.04.2012 07:02
    Edited by: 927494 on 13.04.2012 09:10

    Thank you guys for the replies. I still have some more doubts :-)
    Do I have to have a file for the implementation and a file for the definitons, like cpp and header files? or just everything inside the class?
    Why does Netbeans fail to compile when I change the class name? what should I change with the class name in general to have it compile correctly? From what I understand till now, the top level class's name (the class with the main() function that's gonna be executed) has to be equal to the file name (and I got that this is the sufficient condition for the app to compile), while the same file can have more classes if I wish. Did I get that right?
    I don't know if I get that right too, we pass only a SINGLE class/file to the compiler, and it automatically resolves ALLLL the included files automatically, unlike C++, where all cpp files have to be passed to the compiler/makefile to create object files, and then the executable is created after linking all those object files with the libraries together. i.e.: Java doesn't really need a makefile because making is really simple with only 1 filename. True?

  • Just a question about security

    Hi All.
    Just a simple question really, I read on one of the forums here a question about running windows and apples mac os at the same time.
    My question is: would they not cause conflict, as with apple you don't need to install security but windows is riddled with bugs and virus's surely one would infect the other?
    Sorry to sound so silly,  I'm not very computer savvy , but it strikes me as wrong somehow.
    Thanks Tricia

    You will have whatever threats assail Windows and must protect against those, but none of them will cross over to the Mac side. Note: there is cross platform Windows/Mac malware, i.e. malware written for both. But to be infected you need to be infected directly on the Mac side.
    http://www.zdnet.com/blog/bott/the-slow-and-steady-evolution-of-cross-platform-m alware/4930

  • Simple question about flex and AS 3.0

    Hi, this might sound like a simple question so I apologize...
    I have both a copy of flex 2 and 3, and i want to simply code in AS
    3.0 not mxml. I referred to the help of both flex 2 and 3, and all
    i could come up with is "you can add dynamic behavior to your
    documents using actionscript", which means to me, you only write
    your functions in AS and create instances with mxml (...ugh).
    personally, i find mxml to be ugly (mainly because it looks like
    html to me), and i'd rather not use it. coming from programming in
    an IDE in Java, it seems like it would be nicer to have something
    similar, all the while having the power and cool features of flash.
    I'm not fully educated in this matter so i understand that i could
    be totally wrong.
    i mean, if i have to code in mxml, i will. i'm a web
    programmer for a living, and if a more experience programmer said
    something like "if you don't code mxml in flex, you'll never get a
    job coding in flex", i would trust the advice, and learn the ugly
    code. :)
    yes, i do have Flash cs3, it's great but it seems like a pain
    to me the way you organize classes.... i've only seen a few
    tutorials, ones that explain how you cannot simply import a custom
    class, you have tell your movie to link to it, put it in the same
    directory, or manually name the package, it's sort of confusing.
    my main point here is that i'm very eager to start building
    apps in straight AS 3.0 instead of using flash cs3 (for some
    projects), and it would be cool to get some help or be pointed in
    the right direction.
    to simplify:
    can i write AS 3.0 and only as 3.0 in flex 2 or 3? how? can
    you link me to a tutorial? any advise?
    thanks!

    Hey William, thanks for the post. It's a great coincidence
    because I'm reading that book as well. I'm about half way through
    it, and I love it. I installed mxmlc on my linux box and am writing
    pure AS 3 apps. I think that's the way to go, though I know it's
    not for everybody.
    My problem with mxml is that it has a weird syntax for
    function calls, and it's not as 'intuitive' for a person like me,
    who came from C++ and Java programming in the past. I like writing
    programs in the C++ and Java style syntax, and since so many other
    languages use a similar syntax, I don't see any reason to learn the
    nuances of mxml, unless I was getting paid to do it. As far as I
    can tell there is no benefit.
    I hate using Flash to write flash apps as well, I feel like
    they become messy and confusing, especially when trying to write an
    OOP application. I only use it if I want to move an object in a
    very specific way and can't do it with the Tween methods.

  • Question about Java complying

    I have a question here that I cant seem to figure out.
    I would really appreciate it if someone would help me out with the answer. I just got started learning Java and have a question:
    Suppose list is an array of five components of the type int. What is stored in list after the following Java code executes?
    for(int index = 0; index < 5; index++)
    list(index) = 2 * index + 5;
    if(index % 2 ==0)
    list[index] = list[index] -3;
    I would really appreiciate it if someone could help me out with this problem.

    It's generally considered to be in poor taste to cross post..
    http://forum.java.sun.com/thread.jsp?thread=518979&forum=14&message=2477645
    http://forum.java.sun.com/thread.jsp?thread=518978&forum=423&message=2477642
    http://forum.java.sun.com/thread.jsp?thread=518977&forum=32&message=2477639

Maybe you are looking for

  • FireFox images not loading in local folders (firebug error-Failed to load given URL)

    I am having difficulty when developing websites in local folders (Windows7 computer). The webpages I make are showing images in IE9 & Chrome but not FireFox (nor Safari nor Opera). In FireFox I get Firebug "Failed to load given URL" prompt. I am usin

  • Configurar SAPROUTTAB para permitir acesso de fora rede interna

    Bom tarde pessoal,   Gostaria de saber, como faço para configurar a rota no saprouttab para liberar o acesso externo via front end?   Ex:   O usuário na sua casa, configura o front end com o ip publico e o ip do servidor interno da organização e o me

  • How do I get iTunes 10 to play movie files as their actual size?

    In iTunes (10), I have several iTunes purchases/rentals as well as movie files I've created on my own and converted into .mp4 format. My problem is that I really would like to play these files as their actual size, but can't seem to get iTunes to coo

  • CRM analytics report

    HI Friends, Iam developing report on Executive day contact, so i need to know about the field "NEXT CONTACT DATE" in crm. Ie. the reference field in BW. Please if known post it. Thank u

  • Open new Excel sheet when number of rows is too big

    Hi again, I'm using ActiveX to write some data to Excel. It is common that the amount of data that I want to write to Excel takes more than the 65536 rows of a sheet, so every time this number of rows is reached I wanted to open a new sheet and write