Put an Object in the session scope

I write a logon() action . Inside, i retrieve informations about user logon from a UserForm Object define in the faces-config.xml file with a request scope. So I want to set a business Object called User with the UserForm's values. Then i need to put the User Object in the session scope but i don't know how to do ?
Can someone help me ?
Thanks.

I write a logon() action . Inside, i retrieve
informations about user logon from a UserForm Object
define in the faces-config.xml file with a request
scope. So I want to set a business Object called User
with the UserForm's values. Then i need to put the
User Object in the session scope but i don't know how
to do ?
Can someone help me ?
Thanks.The session attributes are available via the "sessionMap" property of the ExternalContext for this request. So, from within your Action, you could do something like this:
User user = ... set up your user object ...;
// Get FacesContext for this request
FacesContext context =
  FacesContext.getCurrentInstance();
// Store user object in the session map
context.getExternalContext().getSessionMap().put("user", user);Craig McClanahan

Similar Messages

  • Locking when using a component as an object in the application scope...

    I have a component that I am building right now that hold
    application settings that are stored in a database table. The
    settings are maintained in a structure "variables.settings" within
    the component and can only be accessed by get and set methods. I
    use the following to create the instance of the object:
    <cfset application.settings =
    createObject("settings","component").init() />
    Now when getting a setting I do not think locking is needed
    as its just reading the value and I am not really concerned with a
    race condition...
    But when using the set method which will update the value of
    the setting.... should I be locking that as technically the object
    is in a shared variable scope? Or is it safe because its within the
    cfc/object?
    If locking is needed, would I need to lock when using the set
    method? or can I just build the lock into the set method so that
    its always there?

    To disagree with craigkaminsky, I think you only need to lock
    if you are
    concerned about race conditions and what could happen during
    a 'dirty
    read' and|or conflicting writes.
    A lot of developers have an old impression of ColdFusion that
    one *must*
    lock all shared scope variable access to maintain a stable
    application.
    This dates from the ColdFusion 4.5 days where there where
    bugs in
    ColdFusion that could cause memory leaks and eventual
    application
    instability if one did not lock shared scope reads and
    writes. This has
    long been fixed, but the advice persists.
    So now it is only a matter of your data and what would happen
    if one
    user read an old value while it was in the process of being
    updated by
    another user. Or could two users be updating the same value
    at the same
    time and cause conflict. If either of those two statements
    are true,
    then yes you should use locking as required by your
    application.
    But if they are both false and it does not matter that user A
    might get
    the old value microseconds before user B changes it. Or there
    is no
    concern with user A changing it once and user B changing it
    again to
    something different moments later without knowing the user A
    has already
    changed it. Then locking is probably unnecessary.
    There can be a cost to over locking shared variable writes
    and|or reads.
    Every time one creates a lock, one is single threading some
    portion of
    ones code. Depending on how the locking is done, this single
    threading
    may only apply to individual users or it may apply to every
    single user
    on the entire server. Either way, too much of this in the
    wrong places
    can create a significant bottle necks in ones application if
    too many
    user requests start piling up waiting for their turn through
    the locked
    block of code.

  • Putting a object on the coherence cache

    Hi All,
    Is there a better way of doing the following:
    In a multi-threaded region of code I perform the following sequence of steps:
    1. Use a filter to check if object foo already exists on the cache.
    2. if the result set of the filter is null, I perform a lock Cache.lock(foo.getUniqueID);
    3. I put the object foo on the cache Cache.put(foo);
    Basically I am trying to avoid another thread from overwriting the existing cache object.
    Is there a better way to achieve this ?
    regards,
    Ankit

    Hi Ankit,
    You can use a ConditionalPut EntryProcessor http://docs.oracle.com/cd/E24290_01/coh.371/e22843/toc.htm
    Filter filter = new NotFilter(PresentFilter.INSTANCE);
    cache.invoke(foo.getUniqueID(), new ConditionalPut(filter, foo));An EntryProcessor will take out an implicit lock on the key so no other EntryProcessor can execute on the same key at the same time. The ConditionalPut will apply the specified Filter to the entry (in this case to check that it is not present, and if this evaluates to true then will set the specified value.
    JK

  • Value binding an object to the request scope

    Hello,
    In one page I have the results conducted from doing a search. Each row displayed in that page represents a user, and there is a link within each row that will facilitate the editing of that user in another page.
    Here is the code for the link in the "results" page:
    <h:column>
         <h:commandLink id="editLink" action="#{pc_Search_user_results.editUser}">
              <h:outputText value="Edit" />
              <f:param name="userId" value="#{user.id}" />
         </h:commandLink>
    </h:column>My second page (that is, the one that will allow edits to be made) expects a "User" instance to be available as part of the request:
    <managed-bean>
      <managed-bean-name>pc_EditUser</managed-bean-name>
      <managed-bean-class>pagecode.jsp.EditUser</managed-bean-class>
         <managed-bean-scope>request</managed-bean-scope>
         <managed-property>
              <description>
                        Should be an instance of the user that was selected from
                        the search results page.
              </description>
              <property-name>user</property-name>
              <value>#{requestScope.user}</value>
         </managed-property>
    </managed-bean>I have that variable defined in the EditUser backing bean for the "edit" page with the appropriate getter/setter. The problem is that instead of getting a "User" instance in the bean, I'm getting a null value for it instead. I'm trying to set the instance in the method associated with the command link in my "results" page. That is, in my SearchUserResults bean, which is the backing bean for my "results" page, I have the following code:
    public String editUser() {
            HtmlCommandLink link = this.getCommandLinkById("editLink");
            String id = null;
            Map map = link.getAttributes();
            List children = link.getChildren();
            for (int i = 0; i < children.size(); i++) {
                if (children.get(i) instanceof UIParameter) {
                    UIParameter parm = (UIParameter) children.get(i);
                    id = (String) parm.getValue();
                    break;
            User user = null;
            Iterator iterator = this.users.iterator();
            while (iterator.hasNext()) {
                user = (User) iterator.next();
                if (id.equals(user.getId())) {
                    break;
            facesContext.getApplication()
                        .createValueBinding("#{requestScope.user}").setValue(
                            facesContext, user);
            return "success";
        }All I want to get in my backing bean for the "edit" page is a valid "User" instance, which should be set when a new instance of EditUser is created per request. Obviously, I'm not understanding what is happening for this simple scenario. Please chime in with suggestions or explanations! Thanks.
    Jeff

    Frank,
    Thanks for your reply.
    Yes. I have dragged the collection called "GetYearsDataRequest" (which has 2 attributes) to the view as to create new form with submit button. Then i dragged the method on the button to bind the method called "GetYears".
    But actually the method GetYears is required complex type "GetYearsDataRequest" as input. I see the collection and the object/complex types are seperated form visual perspective.
    I tried dragging method to create parameter form, but unfortunately it created GetYearsDataRequest as text field rather I would like to see its attribute in the form.
    I am not sure how to bind the attributes to the input object/complex type (GetYearsDataRequest). I think I am missing this step. Pls help me on this.
    I hope I answered to your question.
    Please let me know if you need more info.l
    Thanks!
    Rajasekar.

  • Synchronizing session-scope objects?

              Hi,
              I have this problem, using Weblogic 5.1 SP8:
              In a JSP-file I use a java-object with the useBean-directive and
              session-scope.
              The problem occur when a user (for some strange reason) decides
              to double-click in his browser on a link pointing to this
              JSP-page.
              This makes the weblogic server start two separate request-threads to the same page
              in the same session. This will sometimes screw up tha data that the java-object holds
              since both threads at the same time uses the same object.
              The only solution that I have found is to put synchronized blocks in the JSP-file
              either synchronizing the java-object or the session-object.
              Does anyone have any similar problems or perhaps any opinions?
              regards/
              H Waller
              

              The problem we discussed (and fixed)was specifically in
              WLCS 3.2.
              If you are not using WLCS, you will not experience THAT problem.
              If you are using member servlet, member JSP variables or static
              variables, you will see a similar problem - don't.
              If it is data in the httpSession - you have to rethink your
              design.
              Mike
              "Ashutosh Khandelwal" <[email protected]> wrote:
              >
              >Hello Ture and Mike,
              >
              >I have been experiencing problems when a user decides to double-click
              >in the browser
              >pointing to a servlet. This makes the weblogic server start two seperate
              >request-thread
              >to the same page in the same session. This always screws up the data.
              >I am using
              >WLS 5.1 with SP8.
              >
              >According to your previous emails, this was only a problem with WLCS3.2,
              >which
              >uses PipelineSession. You have also indicated that this should not be
              >happening
              >with WLS 5.1 or 6.0 with SP8 or above.
              >
              >Well, I continue to have this problem with WLS5.1. Do you have any suggestions/opinion,
              >etc.
              >
              >regards,
              >
              >Ashu
              >
              >
              >
              >"Mike Reiche" <[email protected]> wrote:
              >>
              >>Thanks for the fast turn-around.
              >>
              >>- Mike
              >>
              >>Ture Hoefner <[email protected]> wrote:
              >>>Hello Mike,
              >>> As you know, a WLCS 3.2 (Commerce Server)
              >>>patch now exists for this problem. I thought
              >>>that I should post the details here to clear
              >>>up any confusion in the WebLogic user
              >>>community.
              >>> The problem that Mike experienced was that
              >>>the WLCS PipelineSession was keeping all
              >>>request-scoped attributes in a single bucket,
              >>>so concurrent requests from a single session
              >>>were experiencing naming collisions. Also,
              >>>one pipeline would empty the bucket when
              >>>finished, but other concurrent piplines may
              >>>have been using the bucket. This was not a
              >>>problem with WLS. It was a limitation of the
              >>>design of WLCS 3.2 PipelineSession, which is
              >>>not used in WLS 5.1 or 6.0.
              >>> Our engineering team has quickly responded:
              >>> they have designed and implemented a
              >>>PipelineSessionExtended that uses multiple buckets.
              >>> Each bucket is associated with a
              >>>request using a unique requestId.
              >>> A patch and details of the design fix and
              >>>use of the patch are available from support.
              >>>Please reference CR043462 when requesting the
              >>>patch.
              >>>
              >>>Mike Reiche wrote:
              >>>
              >>>> I don't mind that the HttpSession is shared,
              >>>my problem
              >>>> is that the PipelineSession is shared - because
              >>>that
              >>>> breaks <pipeline:getProperty > tags. When
              >>>I save a Pipeline
              >>>> propert as REQUEST_SCOPE, that's exactly what
              >>>I expect. But
              >>>> apparently, it's scope is beyond a request.
              >>>>
              >>>> What about a PageContext? That's not shared
              >>>between requests,
              >>>> is it? Maybe that's where REQUEST_SCOPE variables
              >>>should be
              >>>> stored.
              >>>>
              >>>> Mike
              >>>>
              >>>> Robert Patrick <[email protected]>
              >>>wrote:
              >>>> >Hmm...
              >>>> >
              >>>> >I always thought that it was browser specific
              >>>whether
              >>>> >the multiple browser windows
              >>>> >shared or did not share the same session
              >>>(and the Netscape
              >>>> >and IE do exactly the
              >>>> >opposite thing here). Regardless of the
              >>>multiple window
              >>>> >scenario, this can and will
              >>>> >happen if you have multiple frames in the
              >>>same window
              >>>> >making requests concurrently (or
              >>>> >possibly if you double-click on a link causing
              >>>the browser
              >>>> >to generate two requests to
              >>>> >WebLogic).
              >>>> >
              >>>> >Anyway, the crux of the matter is that your
              >>>servlets/JSPs
              >>>> >must be prepared to deal with
              >>>> >multiple requests from the same user accessing
              >>>the same
              >>>> >session. The servlet/JSP spec
              >>>> >doesn't, to my knowledge, address this issue.
              >>> You will
              >>>> >probably need to add
              >>>> >synchronization code somewhere, I would just
              >>>make sure
              >>>> >that you are synchronizing on an
              >>>> >object that is only used by one user (e.g.,
              >>>session) and
              >>>> >keep the synchronization
              >>>> >blocks as short as possible...
              >>>> >
              >>>> >Hope this helps,
              >>>> >Robert
              >>>> >
              >>>> >Michael Reiche wrote:
              >>>> >
              >>>> >> BEA says that's just your imagination....
              >>>> >>
              >>>> >> FR: nelson
              >>>> >>
              >>>> >> CASE_ID_NUM: 222714
              >>>> >> MESSAGE:
              >>>> >> Hi Michael,
              >>>> >>
              >>>> >> The Commerce Server is nothing more then
              >>>an application
              >>>> >riding
              >>>> >> on top of WebLogic Server.
              >>>> >> The HTTPSession is still being managed
              >>>by the WebLogic
              >>>> >Server,
              >>>> >> and not the Commerce Server.
              >>>> >> As I mentioned on my previous email, prior
              >>>to and including
              >>>> >SP6
              >>>> >> for WLS 5.1, the spawning of a child browser
              >>>window,
              >>>> >does create
              >>>> >> a shared HTTPSession, thus creating a shared
              >>>PipelineSession.
              >>>> >>
              >>>> >> If you have indeed upgraded to SP8 for
              >>>WLS 5.1, then
              >>>> >this should
              >>>> >> not be happening.
              >>>> >> Can you tell us exactly how you are spawning
              >>>the new
              >>>> >browser window,
              >>>> >> such that both requests are being sent
              >>>almost concurrently.
              >>>> >> Also, can you send us a copy of your "weblogic.log"
              >>>> >file from the
              >>>> >> Commerce Server as an attachment. If it
              >>>is large, please
              >>>> >zip it.
              >>>> >>
              >>>> >> Regards,
              >>>> >> Nelson Paiva
              >>>> >> WLCS DRE
              >>>> >>
              >>>> >> **********
              >>>> >> If you are replying to this email, please
              >>>DO NOT modify
              >>>> >the subject
              >>>> >> of
              >>>> >> this email in order to ensure that your
              >>>reply is processed
              >>>> >automatically.
              >>>> >>
              >>>> >> You can now "AskBEA" Customer Support questions
              >>>on the
              >>>> >web and
              >>>> >> get
              >>>> >> immediate responses. "AskBEA" is available
              >>>on http://www.bea.com/support/index.html
              >>>> >> **********
              >>>> >>
              >>>> >> "H Waller" <[email protected]>
              >>>wrote:
              >>>> >> >
              >>>> >> >Hi,
              >>>> >> >
              >>>> >> >I have this problem, using Weblogic 5.1
              >>>SP8:
              >>>> >> >
              >>>> >> >In a JSP-file I use a java-object with
              >>>the useBean-directive
              >>>> >> >and
              >>>> >> >session-scope.
              >>>> >> >The problem occur when a user (for some
              >>>strange reason)
              >>>> >> >decides
              >>>> >> >to double-click in his browser on a link
              >>>pointing to
              >>>> >this
              >>>> >> >
              >>>> >> >JSP-page.
              >>>> >> >This makes the weblogic server start two
              >>>separate request-threads
              >>>> >> >to the same page
              >>>> >> >in the same session. This will sometimes
              >>>screw up tha
              >>>> >> >data that the java-object holds
              >>>> >> >since both threads at the same time uses
              >>>the same object.
              >>>> >> >
              >>>> >> >The only solution that I have found is
              >>>to put synchronized
              >>>> >> >blocks in the JSP-file
              >>>> >> >either synchronizing the java-object or
              >>>the session-object.
              >>>> >> >
              >>>> >> >Does anyone have any similar problems
              >>>or perhaps any
              >>>> >opinions?
              >>>> >> >
              >>>> >> >regards/
              >>>> >> >H Waller
              >>>> >
              >>>
              >>>--
              >>>Ture Hoefner
              >>>BEA Systems, Inc.
              >>>2590 Pearl St.
              >>>Suite 110
              >>>Boulder, CO 80302
              >>>www.bea.com
              >>>
              >>>
              >>
              >
              

  • Does the session of JSP limit the capacity?

    hi,all,
    I write a JSP program,and I need to put many Vectors into the session.So I am eager to know whether the session has the limited capacity?If there is too much things in the session, will the performance of running be down?How could I do?Thanks!

    Hi
    Storing a lot of objects in Session might slow down the application depending on the load you are expecting and the resources your application server has at its disposal.
    There is no definite answer , you have to look at the application requirements and scope out the variables you may have to share at various levels - application, session, request, page etc. The trick often lies in the design of the application so that you are not making a particular object too bulky.
    As far as how to deal with your particular problem it is hard to say without looking at the requirements. If you have to put very large vectors/Objects into your session then you may have to rethink your design.
    One suggestion here is to store the Data in Collections instead of Vectors as the Vectors are costlier in terms of processing than Collections. Collections are part of the java.util.* package.
    Keep me posted on your progress.
    Good Luck!
    Eshwar Rao
    Developer Technical Support
    Sun microsystems inc
    http://www.sun.com/developers/support

  • How can I use the same object in the different jsp files?

    I am doing a project. I have finished my jave source files and compiled them successfully. And I also wrote a main method to test my classes, they also worked well. Now I am trying to use my jave code in the jsp files. But I meet a problem, in my method of java source file, I can generate a object of a class, and use it in the whole main method. But in the different jsp files, how can I do same thing?
    For example, in the .java file,
    Vector vl = new Vector();
    While ...{
    vl.add(...)
    In each of my .jsp file I want to do one loop of the above, meanwhile I want to do that in the same object.
    I hope you can understand what I mean. Really need your help!

    put your object into a session and you can the use it in all the jsps as long as the session is valid. Or you could create a static variable in the class that only creates one instance off an object and then create a static method to return this object.

  • How to get the session variable value in JSF

    Hi
    This is Subbus, I'm new for JSF framewrok, i was set the session scope for my LoginBean in faces-config.xml file..
    <managed-bean-name>login</managed-bean-name>
    <managed-bean-class>LoginBean</managed-bean-class>
    <managed-bean-scope>session</managed-bean-scope> like that...
    So all parameter in LoginBean are set in session right ?... for example i used userId is the Parameter...
    Now i need to get the the userId parameter from that session in my another JSP page.. how i get that ?..
    Already i tried
    session.getAtrribute("userId");
    session.getValue("userId");
    but it retrieve only "null" value.. could u please help me.. it's very urgent one..
    By
    Subbus

    Where i use that..is it in jsp or backend bean...
    simply i use the following code in one backend bean and try to get the value from there bean in the front of jsp page...
    in LogoutBean inside
    public String getUserID()
         Object sessionAttribute = null;
         FacesContext facescontext=FacesContext.getCurrentInstance();
         ExternalContext externalcontext=facescontext.getExternalContext();
         Map sessionMap=externalcontext.getSessionMap();
         if(sessionMap != null)
         sessionAttribute = sessionMap.get("userId");
         System.out.println("Session value is...."+(String)sessionAttribute);
         return (String)sessionAttribute;
         return "fail";
    JSP Page
    <jsp:useBean id="logs" scope="session" class="logs.LogoutBean" />
    System.out.println("SS value is ...."+logs.getUserID());
    but again it retrieve only null value.. could u please tell me first how to set the session variable in JSF.. i did faces-config only.. is it correct or not..
    By
    Subbus

  • Jsp:useBean : Missing value of String classed bean with 'session' scope

    Hi!
    I'd like to ask some help.
    I have these two JSP pages:
    1.jsp<jsp:useBean id="str" class="java.lang.String" scope="session"/>
    <html>
    <body>
    <% str="hello"; %>
    <a href="2.jsp">click</a>
    </body>
    </html>
    2.jsp<jsp:useBean id="str" class="java.lang.String" scope="session"/>
    <html>
    <body>
    <%=str%>
    </body>
    </html>When I open 1.jsp in my browser, then click on the link, the result is "nothing" (empty string). Why does the bean lose its value on the way?
    I use a Tomcat 5.5.9 server.
    Any help will be highly appreciated.

    You have to think of several scopes when working with JSP. The first is the local scope: the method _jspService() where all the work of the JSP is done.  This acts as a normal method and is where all the sciptlet code goes.
    When you use jsp:useBean you are creating two references to a new String object. One in the local scope accessible through <%= str %> and the other in the session scope.
    When you do <% str = "hello"; %> you are changing the local str variable to reference the String "hello" (this is equivalant to doing <% str = new String("hello"); %>). Only the local reference is changed, not the second reference in session.
    If you want the change to take affect, then you will have to store the new value in session with the same name:
    <% session.setAttribute("str", str); %>

  • Can we access the session scoped variable by simply using its name

    The Java EE 6 Tutorial contains a "Duke's Bookstore Case Study Example”. I could not understand following statements of this case study:
    *bookdetails.xhtml*
    {code}
    <h:outputText value="#{selected.title}"/>
    {code}
    *BookstoreBean.java*
    {code}
    public String details() {
    context()
    .getExternalContext()
    .getSessionMap()
    .put(
    "selected",
    getFeatured());
    return ("bookdetails");
    {code}
    I want to know can we access the session scoped variable in bookdetails.xhtml by simply using its name as done above?

    It is basic Expression Language (EL) functionality, it isn't even specific to JSF. And it isn't specific to the session scope either, you can put beans in any scope (page, request, session, application, flash, conversation, whatever custom scope you create) and reference it using EL by only its name. The thing that you have to take care of is that the bean lives in SOME scope, which can be achieved using JSF specific annotations or configuration files, through CDI or by manually putting the bean in a specific scope through Java code. It's flexible, which is the nature of the Java platform.

  • Does calling session.invalidate() also removes all the session attriutes?

    Hi,
    I want to know whether calling session.invalidate() also removes any objects in the session attributes.or we have to explicitly remove objects from the attributes.
    I want to know this because my application is having some memory related problems. In my application when a user logs in we put many String objects int the session using session.setAttribute.
    Now when the user logs out we call session.invalidate() .
    Will these String objects occupy memory (i.e. will they be garbage collected ) after I call session.invalidate() ?
    or
    I have to explicitly remove all the session attributes programmatically?
    Any assistance would be of great help.
    Thanks & Regards,
    Nirmal

    Sigh. The invalidate dereferences all attributes from the current session. If the object doesn't have any other references (servlets? filters? listeners? whatever) then it will be eligible for GC. The object i.e the String objects does'nt have any remaining references after I nullified the arrayList (which was the one and only refeferencing the String Objects).
    There isn't any servlet, filter, no other entity that is referencing the arraylist once the user's session is invalidated.
    But still when I take the heap dump I'm gettingt those String objects in the heap.........
    Once a user logs off we call his/her session.invalidate() and we don't want any of his/her arrayList (containing String objects) in the memory anymore.
    Please tell me according to you what should be done in order to get rid of the unwanted String objects in the heap, beside my silly lines of code.
    I've load tested the application using jmeter (say for 100 users) and for each of the users the String objects(contained in ArrayLIst) stored in the session are still available even though we called session.invalidate() for each of the user.
    This is a major concern for memory related problems that we people are facing here.
    Any help would be of great ......
    Thanks & Regards,
    Nirmal

  • What is the best way or best practise to access the session scoped component in servelt pipeline?

    Hi Experts,
    What is the best way or best practise to access the session scoped component in servelt pipeline?
    Please share your thoughts.
    Thanks,
    ankV

    To resolve components in the session scope you should be using DynamoHttpServletRequest.resolveName(). And of course the DynamoHttpServletRequest can also be used to resolve global and request scoped components so it is pretty handy to use. You can get the DynamoHttpServletRequest request associated with the current thread from ServletUtil.getCurrentRequest().
    You can also reference a session scoped component from another session (or request) scoped component's property file. E.g. to access profile component (which is session scoped) from your custom session scoped component you would typically do this:
    $class=com.company.MyCustomComponent
    $scope=session
    profile=/atg/userprofiling/Profile

  • Stop App snooping through Session scope

    Right, haven't had to think about this too much before as I've always been working on projects on our own servers, but I'm now working on a project which will be hosted on a shared server. Irritatingly this brings me back to investigating Application scope snooping, and trying to find a way around it.
    And no don't even bother saying about a Multiserver install, I know that's for an ideal world but it's not the case here.
    Generally, I'd store my database connection details in the App scope, but obviously they can be read by other users on the box. I could wrap it up in a class, but even that can be executed by another app.
    I did, however, have a thought - what they *cannot* do is read my actual Application.cfc file. So how about I do something like this:
    <onAppStart>
      <cfset variables.secretkey =  '94yhf934h9p3v' />
      <cfset application.database.secretpassword = encrypt('mypassword', variables.secretkey , 'DESEDE') />
    </onAppStart>
    That way, the password is in the app scope (ie one place) but encrypted if anyone tries to look at it. I then do:
    <onSessionStart>
      <cfset session.database.secretpassword = decrypt(application.database.secretpassword , variables.secretkey, 'DESEDE') />
    </onSessionStart>
    Then in my code just reference session.database.secretpassword rather than the application-level version. That way nothing is visible in the Application scope, as it's all in the Session scope which other users cannot traverse. I know memory-wise it's not as efficient, but if it's the difference between giving away my database credentials and not, then I'm not overly fussed.
    Any issues anyone can see with that? Anything obvious I've missed? Any ways of improving it?
    Damn, I am ALL OVER these forums today.
    Cheers people
    O.

    What I mean is why an ISP would offer shared hosting instead of hosted VPSes.
    Well, working for an ISP, let me tell you
    Maintainability and resource. One standalone machine with 4GB of RAM and a quad-core CPU can happily run 500 CF websites as a shared server setup. There's simply no way that machine could run 500 VPS servers, all with their individual memory, CPU and disk overheads from both CF and the OS.
    You also would need to do 500 CF installations. Yes, you can deploy from archives or whatever but it's still a significant time and effort. Once done, you have 500 different CF installations you have to patch when Adobe release a hotfix or a new version. You have 500 lots of Windows Updates to do. 500 backups to configure to 500 iSCSI drives.
    And all for £50 a year per customer? Not a chance. That's the very nature of shared hosting; it's quite incredible value when you consider what (can) be included. I know many hosts don't, but we run ColdFusion Enterprise with sandbox security on SAS-based 64-bit servers, and all for £50 a year upwards. When you look into the costs of doing it yourself, it's a simple no-brainer.
    Incidentally for our own benefit we are now splitting machines to an extent - each physical server now runs VMware ESXi, onto which we install four or five virtual machines, each running Windows and ColdFusion. So to a degree we're splitting them up, but that's more for our own benefit - if a customer brings down a server, it affects only a quarter of the customers it would have. If we need to reboot a box for updates, the same. Also virtual machines are far quicker to reboot, another benefit for us.
    But as for running a VPS per customer on shared hosting - forget it. Never going to happen

  • Find information in the session

    Post Author: stujava
    CA Forum: JAVA
    Hi everybody,I 'd like use this code below and I work with Java:ReportEngine boRepEng = (ReportEngine)session.getAttribute("RE");String strEntry = request.getParameter("docRef");String strImageName = request.getParameter("imageName");Image boImage = boRepEng.getImage(strEntry,strImageName);response.setContentType(boImage.getMimeType());ServletOutputStream Output = response.getOutputStream();byte&#91;&#93; boData = boImage.getContent();response.setContentLength(boData.length);Output.write(boData);Output.close(); But when the code is with the line "Image boImage = boRepEng.getImage(strEntry,strImageName);" I have an NullPointerException because the object boRepEng is Null. In the BO website there is this sample code but it does not work for me, I  do not know how to initialize the object boRepEng because this object is not on the HttpSession. Where is it ? When can I get it ?Help me please.In Advance thank you very much

    Post Author: bedla
    CA Forum: JAVA
    I dont know the sample you are talking about (could you link URL?) but just some quick ideas...I believe the sample expects you have initialized ReportEngine in the HttpSession. If boRepEng is null after calling ReportEngine boRepEng = (ReportEngine)session.getAttribute("RE"); it means you either did not stored the ReportEngine object in the session (HttpSession), there is no attribute named "RE" in the session (HttpSession). Try to check content of the session.Note, that BO examples sometimes does expect you proceeded from the beginning of the tutorial.

  • We should NEVER use the session back bean?

    Because the user can open a new window by right click the link, and the session scope back bean is not thread-safe.
    So we should forget it?

    Your concern makes really no sense, or you must be storing request scoped data in a session scoped bean instead of a request scoped bean, which can indeed lead to undesireable behaviour in multiple requests on the same session.

Maybe you are looking for