[ADF, JDev12.1.3] Opening SESSION: a session ID, HTTPSession, brought bean, UserData... where to store the information? (And other doubts...)

Hallo,

my simple application has this main stream job boundless...

1)

I see that when I call the login page of this URL http://127.0.0.1:7101 / MyApplication/faces/login, to which - in the address bar - it is auto-ajouté for example ' jsessionid = Wn2ymE_3cC2JXHYtG7_ocZDgMgonLyr376zejB-ui28UPlm5tiuB! 1535501325 ".

So I guess that the session exists as soon as the user access the login page.

  • I would like to know if I have to worry about a possible previous session (especially another user session).
  • If the user on the home page click the back button in the browser the application creates a new session to destroy the possible previous session?
  • BdW, if my request to place the values in the HTTP session would be a good practice as part of the bean connection null all the attributes of the session?
  • And if my request to place the values in UserData would be a good practice as part of the bean connection null all the attributes of the container UserData?

2)

  • Is it better to store the information in the HTTP session or UserData?
  • It is less safe than the other? Otherwise why is there the need to have 2 types of sessions?
  • Could he have no sense in storing an individual data in the HTTP session and UserData at the same time?
  • I have seen that the HTTP session is very easy to access, view and (if necessary) and the layers of the model. Is the same as for UserData, or it can be accessed only by the model layer?

3)

  • In my case, I want to share my application the user in user data:
    • First and last name (only at the end of the display)
    • Name of the service (only at the end of the display)
    • Username and DepartmentId (these hairy should be passed to the query and the view of your criteria)
  • Where I put those values? Who, in the HTTP session? Who in UserData?

4)

  • I'm in doubt if using a scope session bean or - since the data that I have to share is really little - use the 'basic' (e.g. ectx.getSessionMap () .put ("key", "ValueToStore")).
  • If I use an extended session bean and I store of simple values (integer, String,...) I don't have to worry about serialization (de)?
  • A scope session bean is accessible from the model layer as the HTTP session basis (what I can put by ectx.getSessionMap () .put ("Key", "ValueToStore"))?
  • And in my situation I could handle everything with a single between UserData anda HTTP session?

These questions are intended to create a simple login system that stores data needed somewhere in the different parts of my application.

So any advice is welcome!

Thank you

Federico

1)

I see that when I call the login page of this URL http://127.0.0.1:7101 / MyApplication/faces/login, to which - in the address bar - it is auto-ajouté for example ' jsessionid = Wn2ymE_3cC2JXHYtG7_ocZDgMgonLyr376zejB-ui28UPlm5tiuB! 1535501325 ".

So I guess that the session exists as soon as the user access the login page.

  • I would like to know if I have to worry about a possible previous session (especially another user session).
  • If the user on the home page click the back button in the browser the application creates a new session to destroy the possible previous session?
  • BdW, if my request to place the values in the HTTP session would be a good practice as part of bean connection null all the attributes of the session?
  • And if my request to place the values in UserData would be a good practice as part of bean connection null all the attributes of the container UserData?

-When you close your browser, this will destroy the session

-None

-It will be much easier to invalidate the entire session (HttpSession method for this object)

-When you destroy the http session, it will destroy the Application modules, and it will destroy UserData

2)

  • Is it better to store the information in the HTTP session or UserData?
  • It is less safe than the other? Otherwise why is there the need to have 2 types of sessions?
  • Could he have no sense in storing an individual data in the HTTP session and UserData at the same time?
  • I have seen that the HTTP session is very easy to access, view and (if necessary) and the layers of the model. Is the same as for UserData, or it can be accessed only by the model layer?

-We already discussed in a previous thread so I won't comment

-both are secure. HttpSession exist in java web applications and UserData is specific ADF.

-Maybe (for example, it is not recommended to access the HttpSession of model project, so you can store some data in the UserData (to be referenced from your, etc.) and managed (so you can bind them directly to UI) Bean)

-Are accessible only from template (but you can expose a custom to ViewController method that accesses UserData)

3)

  • In my case, I want to share my application the user in user data:
    • First and last name (only at the end of the display)
    • Name of the service (only at the end of the display)
    • Username and DepartmentId (these hairy should be passed to the query and the view of your criteria)
  • Where I put those values? Who, in the HTTP session? Who in UserData?

My opinion:

Name, first name, name of the Department-> session brought average managed (so you can link that directly to the user interface components)

UserId, DepartmentId-> UserData (or you can store managed bean and pass as parameters to methods of model project)

4)

  • I'm in doubt if using a scope session bean or - since the data that I have to share is really little - use the 'basic' (e.g. ectx.getSessionMap () .put ("key", "ValueToStore")).
  • If I use an extended session bean and I store of simple values (integer, String,...) I don't have to worry about serialization (de)?
  • A scope session bean is accessible from the model layer as the HTTP session basis (I can put by ectx.getSessionMap () .put ("key", "ValueToStore"))?
  • And in my situation I could handle everything with a single between UserData anda HTTP session?

-with getSessionMap () .put (), you must pay attention to the data types when you change or retrieve values (for example, do you know if DepartmentId is Integer, BigDecimal, oracle.jbo.domain.Number,..) If this isn't "type-safe". In addition, it is easier to understand what your application keep in session if you managed bean that in order to find all the places you're calling the method getSessionMap () .put ().  And controlled beans are a 'natural' way to keep data in a JSF/ADF application.

-Not (just brand bean session with the Serializable attribute)

-You can do something similar to this, but this is not a recommended practice because it would break the MVC pattern

-If you do not have too much, you can keep everything in HttpSession and expose methods to set the binding vars.

Dario

Tags: Java

Similar Questions

  • [ADF, JDev12.1.3] When you use create/restoreSavepoint... Restore operation is still useful? And other doubts...

    Hallo,

    Dario and Timo advised me (in this thread Re: [ADF, JDev12.1.3] Master w/playback af:form only af:tables detail: how to handle insert and edit through forms?) I make a request using the functions create/restoreSavpoint to this fragment in my application.

    The tables are read-only, and the user can insert and modify records by a form of popup.

    Each table has its own pop-up that I created using a btf executed as diaolog (*).

    Before I open the popup, I create the backup point.

    BindingContext bctx = BindingContext.getCurrent();  
    DCDataControl dcDataControl = bctx.getDefaultDataControl();  
    String sph = (String) dcDataControl.createSavepoint();  
    AdfFacesContext.getCurrentInstance().getPageFlowScope().put("AdfmSavePoint", sph); 
    

    When the popup is closed, I restore the backup point if the Cancel button was clicked...

    Object confirmOrCancel = returnEvent.getReturnValue();  
    if (((String) confirmOrCancel).equals("cancel")) {  
      String sph = (String) AdfFacesContext.getCurrentInstance().getPageFlowScope().get("AdfmSavePoint");  
      BindingContext bctx = BindingContext.getCurrent();  
      DCDataControl dcDataControl = bctx.getDefaultDataControl();  
      dcDataControl.restoreSavepoint(sph);  
    } 
    

    I have these doubts:

    1. the button "CANCEL ALL" (so far) AM restore operation is still meaningful (is always useful) when you use the check points? Or can I avoid using the restore of the AM operation, creating a backup point before you enter the fragment and restore it if the user clicks on "RESTORE ALL"?
    2. for all tables: before opening the popup insert/change the backup point is implemented pageFlowScope under the same key 'AdfmSavePoint '. Is it OK or would it be better to use a different key for each table (for example 'AdfmSavePointTable1', 'AdfmSavePointTable2',...)?
    3. If the pageFlowScope already contains a checkpoint under the "AdfmSavePoint" key... What does if I give the floor to new .put ("AdfmSavePoint", sph)? Can I be sure that the old value is overwritten?
    4. is this safe with nested savepoint? For example in my case I want to create a backup before the fragment in the image point is displayed (and restore if the user leaves the fragment by clicking "RESTORE ALL"), then within the fragment, as I said above, I would manage other points of record when inserting/editing tables.
    5. I noticed that clicking on the button "RESTORE ALL" when it relates to the AM-restore operation causes this strange thing: when before displaying the fragment I call SetCurrentRowWithKey on the master istance VO... If I click on "ROLLBACK ALL" posted master VO Records changes and 1 minutes of the main of the VO table is displayed. Why the master istance VO is not reimain in the folder I've previously selected by SetCurrentRowWithKey?
    6. With reference to the expression (*) above. The BTF 'dialogue' I created contains only the page jspx with shape and a return to activity. I also tried a) create (and restore) the backup point, b) to call createInsert inside the "dialog box" operation BTF (see images below), but the createInsert on retail VO istance called inside the 'dialogue' BTF seems not to reflect on the table as when I call createInsert by calling btf. I have to make some adjustments in the 'dialogue' of BTF?

    Thank you

    Federico

    Federico,

    (1) Yes, what should happen if a user add or edit vo1 and click ok in the dialog box but decided that ask to work must be restored?

    (2) as long as you don't have that a dialog box is open, it should work.

    (3) the flowrate range of page is a map. You can put the same key more than once. If the key already exists, the value is replaced.

    (4) in fact, I don't know, but the sounds of complicated design. I guess you can record more points, but only in the order of creation. It's as if you try to rebuild the framework. BTF yo it even for you, when worn right. Please go to ADF Architecture Square and read and watch it task flow of related things.

    (5) this behavior is as expected. A restore resets all the iterators so thagetto point at the top of he. http://www.Oracle.com/technetwork/Developer-Tools/ADF/learnmore/OCT2010-OTN-Harvest-183714.pdf 'keep the line after cancellation' shows how to handle this situation.

    (6) I suppose have you refresh the table iterator, once you close the dialog box for the new data. But that's only a guess because it depends on how the btf share control of data and the your involved.

    Timo

  • How/where to store more information page in the ADF?

    Hi all

    What is the best way to fill the managedBean during the loading of the page?

    In my application, I have a page fragment that displays the details of the user of Webservice DataControl. I have and drag the data to the pageFragment webservice control. This fragment has mapped in the taskFlow and the annex taskFlow in to JSPX homepage as a region. I need to store such user information in any place (ManagedBean / or any other better place to store) that I can use at my request along, because I won't run again whenever the webservice to get the same information from the user. Also, I want to collect and store this information while I give back to the homepage, not after any action of the user.

    Please advice how & where to store the information in the ADF? Can I create a managedBean? If so, how to trigger this class method on page load?

    Thank you
    KLN

    Hello

    in this case, you configure the managed bean to be within the scope of the session. Then, on the first page, you set a stage for restoration after phase listener (it is a beacon in the f: view element). This is phaselistener refers to the bean managed using EL (important). She can do by using an expression of the method in JSF. For example, if the managed bean had a populateUserInfo method then yu might reference #{beanname.populateUserInfo} and run the expression of the method using Java. In the managed bean, the method would be to access the link layer using the BindingContext class

    http://download.Oracle.com/docs/CD/E15051_01/apirefs.1111/e10653/Oracle/ADF/Model/BindingContext.html

    Call

    . GetCurrent () .getCurrentBindingsEntry () BindingContext to get a handle of instance active BindingContainer.

    BindingContainer links is BindingContext.getCurrent () .getCurrentBindingsEntry ();.

    Then on the container of the binding, you call the method to query the Web Service for the modules

    before calling a method on the ADF link layer, make sure that the ADF is binding for the method
    OperationBinding opws (OperationBinding) = bindings.get ("name of the method exposed on the other side");
    If you need pass parameters
    opws.getParamsMap () .put ("name of the argument", value);
    OPWS. Execute();

    You can use similar code to access the information of the user of the iterator method in the ADF to complete managed bean fields. You can access user information from the bean managed through getter and setter methods

    Frank

    PS. : I know that the description is a little rough. I'll see if I can find a sample of blog at a later date

    Published by: Frank Nimphius, 26 January 2010 17:43

  • [ADF, JDev12.1.3] That is the approach recommended to store the information of the logged-on user?

    Hallo,

    I would like to know which are:

    • approaches possible and advised to store the main information (which will be used throughout the application) of the user that is logged;
    • for each of the approaches that are the main advantages and disadvantages.

    For example

    I have my doubts if store info in variables private module request or if I'd better use the HttpSession.

    The use of HttpsSession back to store the information in a range session bean?

    A scope session bean should be used only to store information?

    Sorry if these question may be stupid but I'm starting to take care of the security of my application and I am a bit confused about the available possibilities.

    I use ADF Essentials, so I can't use ADFSecurity.

    Thank you

    Federico

    I have my doubts if store info in variables private module request or if I'd better use the HttpSession.

    Never use app module variables to store data. If you need to store data in the model project, you can use the UserData card, but you must implement the serialization/deserialization.

    Read this blog post for more information: http://andrejusb.blogspot.com/2012/05/solution-for-sharing-global-user-data.html

    The use of HttpsSession back to store the information in a range session bean?

    They are similar.

    Difference is that you can put data directly to the session http (as an attribute) and if you use managed bean then keep you data in the attributes of bean and framework will put bean in scope of the session.

    A scope session bean should be used only to store information?

    Well, do not store the amount of data in session bean because it will influence the performance of the server (if the number of users increases you need more RAM, if you assign more RAM to the server it will be time for garbage collection, will also increase if you have clustering then great session bean (s) will increase the time of synchronization of the session) ", etc...)

    Dario

  • Cannot open email in Hotmail via Firefox. I have Vista installed on the pc and Windows 7 on the laptop, but cannot access all the features of Hotmail.

    Cannot open email in Hotmail via Firefox. I have Vista installed on the pc and Windows 7 on the laptop, but cannot access all the features of Hotmail. I tried to clear the cache and restart Firefox, but I still cannot use Hotmail.

    Not this problem when I go to Internet Explorer.

    Hello, it was noted that the foxit pdf plugin is causing this issue. You can disable this plugin in firefox > addons > plugin until what foxit offers a patch/update for the plugin.

  • Why some items in 'Open an existing project' have just the name of the project and others have access to the entire file path?

    I have SP1 2012 LabVIEW and on the main screne of LabVIEW selecrt "show projects".

    Why some elements of 'Existing Open' (project) have just the name of the project and others have access to the entire file path?

    Examples of two lines in the list of projects.

    Ping.lvproj (with a path: C:\Users\mlevine\Documents\MPCE EQT\EQT Software\Ping.lvproj)

    C:\Users\mlevine\Documents\Common package Mission trainer (CMPT) \SUW Surface Warfare\Weapon permission Panel (WAP) \WAP LabVIEW Software\WAP fire authorization server 28 April 2015

    No chance, it's because I made a copy of this software and stored on a network drive power off and it went out of this network drive?

    So if LabVIEW sees two or more versions of the same software, he decides to use the name to differentiate between full path?

    I'd still rather it shows just the name of the project and if you hover over the name it shows the full path.

    Thank you

    Mark

    If you have opened a project of the same name from a different location, it is when it shows the full path both - in this case showing just the name of the project would not help because it would be the same thing!

  • Hello. I explained the following error in InDesign. When you open a file that is stored on a server, I get an error message because the file is already open, or don't have sufficient permissions. If I copy to the desktop and open it, I have no p

    Hello. I explained the following error in InDesign. When you open a file that is stored on a server, I get an error message because the file is already open, or don't have sufficient permissions. If I copy to the desktop and open it, I have no problem. Can someone help me? Thank you.

    Is there a file .idlk remaining on the server which is not removed properly?

  • How can I get the Inbox and other folders showing when I open logging

    When I have a message open, I can't see my Inbox and other folders. I need to scroll through the messages at the top until I have find the Inbox. Y at - it a fix for this or is it the new configuration for Mozilla?

    Stop leaving the message tabs opened after reading them.

    To close all tabs, you have now opened right click on one of them, and then select close other tabs. Then use the x to close the last of them.

    Make a habit of close tabs message after reading the or just read the messages in the message pane and do not open the tabs.

  • I can't open Photoshop or CC.  Error says I need to connect to the internet, and yet I am connected

    I'm not able to open PS CC.  I get a message that I need to connect to the internet, and yet I am connected.

    Hello johns,

    See the links below:

    Solve common problems of activation and deactivation of creative cloud.

    Internet connection with creative cloud problem

  • LR CC will not open. Tried signing out and in the CC and other suggested solutions.

    I use window 8.1. Downloaded CC trial two weeks ago and installed Lr 5 and PS. I created the Lr catalog in one location other than that proposed by Lr 5 (a secondary drive). LR 5 and Ps worked well and I intend to buy the package of photography. Then I upgraded to Lr CC and uninstalled Lr 5. LR CC will not open. The test appears, I click on "Continue trial" he goes and Lr does not open. I tried disconnecting and DC many times, I've uninstalled and reinstalled Lr CC and even the CC app, still nothing. I tried to remove the. lrcat.lock file but could not find, so I deleted all the files from the catalog and all records (it was just a practice). There seems to be no way to get Lr CC to open.

    Hello

    Please follow the suggestions mentioned here, Lightroom does not launch or closes automatically after the splash screen.

    I would like to know if the suggestions help.

    ~ David

  • Where are stored the information session for "private browsing"?

    I have a frozen private browsing session that I don't want to lose.

    It's a bit complicated, so... I have a prior (not private) regular session which is restored when you open a regular browser. I have closed the session and opened directly into a private window. About two dozen open tabs later, the camera froze and I'm about to lose all the work I had done.

    I tried screenshot tabs so I could at least get an idea of what I had opened, but when I went to paste the Clipboard, he had nothing, and now the browser is minimized at all times (not answer).

    Is there a file in the profile folder containing the URLS of open tabs? I don't have FF forcequit immediately.

    I can't imagine that they would be in "sessionstore" since that holds the non-prive session (correct?) and it does not resemble these files have changed/summer changed since the opening of the private meeting. Wouldn't be a file of type "places" or "sessioncheckpoints"?

    All tracks on this would be greatly appreciated.

    I don't think you can get work if it is not registered to anywhere where you were. I suggest you do all the work in the sessions of navigation non-private, do not have this problem. If it's frozen, you can expect a response, or say goodbye to the work.

  • [ADF, JDev12.1.3] How to set a variable to bind a VO (where clause) in a managed bean?

    Hallo,

    I have a request based on VO.

    The query contains a where clause clause and a bindi variable.

    In a managed bean I would like to access the iterator of VO setting the value of the bind variable and read the result.

    I found this code it is good start, but I do not know how to set the variable binding.

    BindingContext bctx = BindingContext.getCurrent();
    BindingContainer bindings = bctx.getCurrentBindingsEntry();
    DCIteratorBinding iter = (DCIteratorBinding ) bindings.get("MyVO1Iterator");
    iter.execute();
    
    
    

    You kindly help me?

    Also, I would like to know if it is generally advisable to use VO directly in controlled beans or whether it would be best to create in the AppModuleImpl methods that do this and return the result.

    In my case for example of the VO will return max 1 plug so I'm in doubt, if the creation of a method in the AM that returns a custom class, which attributes contain values of the line of VO.

    Sorry if these questions may seem artificial, but I am a beginner, I have many doubts and so I would be happy to receive some tips regarding best practices.

    Thank you

    Federico

    You can use:

    iter.getViewObject().setNamedWhereClauseParam("yourBindVar", value);
    

    Note that this approach is used if you have bind variable in the where clause.

    To set variables bind to ViewCriteria, you must use VarableValueManager.

    This post may be useful for you: binary: how to set the Bind variable values at run time?

    Also, I would like to know if it is generally advisable to use VO directly in controlled beans or whether it would be best to create in the AppModuleImpl methods that do this and return the result.

    You must set "use VO directly.

    For example, from the point of architecture, is probably best to use the method in the model project which will set the bind variable and execute the query.

    Or you can use the ExecuteWithParams operation in your the view layer.

    In my case for example of the VO will return max 1 plug so I'm in doubt, if the creation of a method in the AM that returns a custom class, which attributes contain values of the line of VO.

    Not to complicate your life

    All VO lines are represented as ViewRowImpl class if you already have "custom class".

    Finally, you can generate your own ViewRowImpl class if it is necessary for this.

    Dario

  • I want to open links in a new window but cannot find where to put the setting. Having disabled the "open new windows in a new tab instead" box in the Options dialog box.

    When I click a link on a Web page or other software, I want to open in a window, completely new.

    You can hold the SHIFT key and click the left button of the mouse a link to open this link in a new window.

    The setting in tools > Options > tabs is only for links that specify a window target and you can hijack such a link in a new tab instead.

  • [ADF, JDev12.1.3] Session time-out: is it possible to perform a rederict to a URL to be composed on the basis of a model session ARVS?

    Hallo,

    using this tutorial Fortune Minds - Oracle ADF: how to redirect to a custom page each time the session of delay in the application of the ADF? I implemented a simple redirect when the session expires.

    The real URL 'redirect' should be composed according to the value stored in a var to a managed bean sessionScope, but the problem it is that... the afterPhase listener is run after the session has already expired.

    Could you kindly advice me a wokaround or a different approach to achieve this goal?

    Thank you

    Federico

    Cannot use a variable of bean in any scope as the info is gone. You can store the information in a cookie and read the form here.

    Or you use a different method like adventures of the man of Oracle ADF: heroic alternatives to avoid the annoying Popups SessionTimout ADF

    Timo

  • [ADF, JDev12.1.3] Best practices for maintaining a form validation

    Hallo,

    in my application, I need to create a registration form which contains fields that must be validated (for example they should follow a format like e-mail, phone number, tax code,...).

    If the data inserted by the user are ok, a new record in my custom db table Users will be created.

    I would like to know which are the best practices for maintaining the validation, which means the place where the controls must be made and a message to the user who fills out the form when something goes wrong.

    The best vo or EO or managed bean? Or some controls should be put in the OS, others in the VO and other in the managed bean?

    I would be happy if you could give me some examples.

    Thank you

    Federico

    Assuming you want the validation on the value of the field to any screen data can be entered in (and possibly web services that rely on the same BC ADF) then put the validation on the definition of the attribute in the EO.

    If you want to add a little more friendliness and eliminate some of the network traffic to the server, you can also implement the validation client in your page - for example by using the regular expression validator.

    https://blogs.Oracle.com/Shay/entry/regular_expression_validation

Maybe you are looking for