[ADF, JDev12.1.3] How to manage cookies (configure/create/read) in the ADF applications?

Hallo,

I would like to create a cookie in my ADF application.

To start I used the code shown in this thread code example for create / read a cookie value? but the cookie seems to not be created.

It is not present in Firebug or it can be retrieved by the code.

    Cookie userCookie = new Cookie("myCookie", "hello");
    userCookie.setMaxAge(-1);
    FacesContext ctx = FacesContext.getCurrentInstance();
    ((HttpServletResponse) ctx.getExternalContext().getResponse()).addCookie(userCookie);


    Cookie retrieveCookie = (Cookie) ctx.getExternalContext().getRequestCookieMap().get("myCookie");
    if (retrieveCookie != null)
      System.out.println("My cookie is: " + retrieveCookie.getName() + " " + retrieveCookie.getValue());

What's not in the code?

There may be something to confiure in the application of the ADF?

Thank you

Federico

  1. Cookie userCookie is new Cookie ("MyCookie", "Hello");.
  2. userCookie.setMaxAge(-1);
  3. FacesContext ctx = FacesContext.getCurrentInstance ();
  4. (Ctx.getExternalContext () m:System.NET.FtpWebRequest.GetResponse ()) .addCookie (userCookie) (HttpServletResponse);
  5. Cookie retrieveCookie = ctx.getExternalContext () .getRequestCookieMap () .get ("myCookie") (Cookie);
  6. If (retrieveCookie! = null)
  7. System.out.println ("my cookie is:" + retrieveCookie.getName () + "" + retrieveCookie.getValue ());

Is - this code is run from the same method in java?

If this will not work (cookie is added to the http response if you can't get this until the next http request arrives)

Dario

Tags: Java

Similar Questions

  • How to configure Adobe Reader as the default application to open PDF files in Windows 10

    I have Windows 10. This includes Microsoft Edge and a left click on a PDF file, the file to open with Microsoft Edge. I want my PDF files to open with Adobe Reader by default. Anyone know how to make this happen?

    Hi Thomas,

    Right-click any file pdf-> Select 'open with'-> program choose default-> select Adobe Reader in the list of programs-> click OK

    Kind regards
    Rahul

  • How to configure Adobe Reader to the default program to read PDF files after you install Adobe Acrobat?

    How to configure Adobe Reader to the default program to read PDF files after you install Adobe Acrobat? I have a few other programs that need to use Adobe Reader showing 'photo' that are PDF files, and after the installation of Acrobat, it is Acrobat that opens automatically, with a message whenever Acrobat cannot be used for this and will be closed, and then the Player opens. I don't like having to see this message every time... Thank you! :-)

    Hi anne-grethea26777033,.

    You can do CD player as your default application by browsing in Edition > Preferences > under categories, select the "Général" and at the bottom of the window, you must select an option which reads "set as default PDF Manager" under the label of startup application and click OK.

    Let us know if that helps.

    Concerning

    Sarojini

  • How to remove a specific email inbox with the client application code?

    Hello

    How to remove a specific email inbox with the client application code?  Please suggest useful links.

    Advanced thanks.

    Concerning

    Sunil.G

    Your question is a bit broad, so it is difficult to give you details.

    First of all, you must have the ID of the original message. Usually, you get either by hanging the message when he came into the Inbox (by implementing FolderListener), or by retrieving a list of mail of enamel "Store".

    Once you have this message ID, you call Folder.deleteMessage ().

    Here, there is a laboratory of Developer:

    http://NA.BlackBerry.com/eng/developers/resources/Labs/listeningforemail.jsp

    Moreover, classes to look in the API of reference:

    Store

    Folder

    FolderEvent

    FolderListener

    Session

    ServiceConfiguration

    Message (message RIM, not the J2ME)

  • How can I keep only one instance of the javafx application at the same time?

    Hello
    How can I keep only one instance of the javafx application at the same time?
    Let not the user run the javafx application is running on your PC.

    Hello. This program does what you want. You can probably find a better solution.

    import javafx.application.Application;
    import javafx.event.ActionEvent;
    import javafx.event.EventHandler;
    import javafx.scene.Scene;
    import javafx.scene.control.Button;
    import javafx.scene.layout.StackPane;
    import javafx.stage.Stage;
    
    import java.io.BufferedReader;
    import java.io.File;
    import java.io.FileReader;
    import java.io.FileNotFoundException;
    import java.io.*;
    import java.nio.channels.FileLock;
    import javafx.application.Platform;
    import javafx.stage.WindowEvent;
    
    public class Simpleapp extends Application {
    
        public static void main(String[] args) {
    
            launch(args);
        }
    
        @Override
        public void start(Stage primaryStage) throws Exception {
    
            final File file = new File("flag");
            final RandomAccessFile randomAccessFile = new RandomAccessFile(file, "rw");
            final FileLock fileLock = randomAccessFile.getChannel().tryLock();
    
            System.out.print(fileLock == null);
            if (fileLock == null) {
                Platform.exit();
            }
    
            primaryStage.setTitle("Hello World!");
            Button btn = new Button();
            btn.setText("Say 'Hello World'");
    
            StackPane root = new StackPane();
            root.getChildren().add(btn);
            primaryStage.setScene(new Scene(root, 300, 250));
    
            primaryStage.setOnCloseRequest(new EventHandler() {
    
                @Override
                public void handle(WindowEvent arg0) {
                    try {
                        fileLock.release();
                        randomAccessFile.close();
                        System.out.println("Closing");
                    } catch (Exception ex) {
                        System.out.print(ex.getMessage());
                    }
    
                }
            });
    
            primaryStage.show();
        }
    }
    
  • [ADF, JDev12.1.3] How to resize and style default popup of the message of faces?

    Hallo,

    popups messages of faces that I take the floor in managed beans or auto-affichent by the application to show errors (e.g., https://dl.dropbox.com/s/hsje8m0meci2wai/FacesMessage.png?dl=0) do not adjust automatically based on the content.

    I would like to know how I can fix this problem and:

    Thank you

    Federico

    Well, for automatic resizing, you can use this workaround: https://agungor.wordpress.com/2014/05/14/handling-un-resizable-facesmessage-popup/

    Also, if I remember correctly, you can download the fix for this problem for Oracle Support(if you have support contract).

    Inline messages you must provide the id of the component when you create messages of faces.

    For global inline messages you need to af:messages component.

    As an alternative, you can use something like this: Awasthi (Jdev/ADF) Ashish Blog: better interface user-display the notification message of jQuery (for error, warning, info) to Oracle ADF

    Dario

  • How can I import my iPhotos library into the new application Photos?

    My iPhoto library is on an external hard drive. When I try to import into the new application of Photos on my laptop, it is said that Photos doesn't have "permissions". I can't find a way to solve this problem, please help!

    Hello. This information should help you http://www.macworld.com/article/2909654/software-photography/how-to-import-merge-and-consolidate-your-libraries-in-photos-for-os-x.html

  • [ADF, JDev12.1.3] How to display a gif of loading during the loading of the af: table (through the ExecuteWithParams method call)?

    Hallo,

    in the fragment of my page, I created an af:table you drag an instance of VO for the data control; I also have a search button by dragging the operation ExecuteWithParams of the same instance of VO.

    I double clicked on the serach button to create the searchButton_action method in the bean calling the ExecuteWithParams operation after you have made a few operations.

    Next to the button, I put a table whose source is a gif of "load".

    I would like to make visible the gif while research is underway and make it invisible when the search is complete.


    In the beginning, I followed this approach.

    In the searchButton_action, I wrote the code to set the visible of the image property.

    But it did not work because the gif never appears. I also tried to set the property PartialTriggers of the image with the ID of the button table and search.

      public String searchButton_action() {
        RichActiveImage imgSearch = (RichActiveImage) FacesUtils.findComponent("ImgSearch");
        imgSearch.setVisible(true);
        AdfFacesContext.getCurrentInstance().addPartialTarget(imgSearch);
        // ...
        OperationBinding operationBinding = BindingsUtils.getBindings().getOperationBinding("MyVOInstanceExecuteWithParams");
        // ...
        imgSearch.setVisible(false);
        AdfFacesContext.getCurrentInstance().addPartialTarget(imgSearch);
        // ...
      }
    

    Then I tried with another approach which is to set the Visible property using the value off of the search button which is #{! links.} MyVOInstanceExecuteWithParams.enabled}

    But also, this approach has not worked.

    I also tried to set the property PartialTriggers of the image with the ID of the button table and search.

    What's not in my efforts? You could you kindly help me to solve the problem?

    Thank you

    Federico

    PS

    FacesUtils.findComponent is a method that retrieves the item passed as param. It works well since I used it several more times in my application.

    Your approach may not work add there is only a single thread of UI work. Your trigger reached the component when the execute with Péan has finished its work.

    For your use case there are a few solutions combining JavaScript and client-server events showing a window as long as the operation is running. Read https://blogs.oracle.com/groundside/entry/notification_during_long_running_transactions for all the info.

    Timo

  • [ADF, JDev12.1.3] How to design and integrate PDF reports in my web application?

    Hallo,

    I would like to know if JDeveloper offers the functionality for creating visually (dependent or not data db) reports for which the client can see the preview and then print the PDF file.

    It would be very useful to design a report like UI (so for example drag attributes from VO instance to the report).

    Thank you

    Federico

    No, there are none of these available components. You will need to create one yourself (doable but complicated) or use another product the report design, and then call the report of your app engine to return the repost for example in pdf format. The user can to decide to print it or not. At this point, the report is already downloaded on the client as for example pdf.

    Timo

  • How to manage too many objects correspond with the exception of the primary key

    Greetings,

    IM using JDeveloper 11.1.2.4.0 and im trying to manage the "too many objects match the primary key' exception.

    I try to add a try catch in bean when I run the validation operation, but he didn't catch it.

    then I add a plug on the setter, but he ignores the value and try to insert a null on my primary key.

    I want just to handle this exception and display an appropriate message that it is a duplicate primary key

    (and of course do not try to continue the validation operation if there are duplicate key)

    Thanks in advance.

    You can find samples for error messages personalized here:

    http://www.adftutorials.com/ADF-custom-error-handler-to-display-custom-message-to-user.html

    http://smconsultants.in/2013/07/ADF-BC-error-messages-customization.html

  • How to manage data and create new textInput fields during the destruction/creation of new views?

    Basically, I need to know how to create another textInput field when I pass data from one view to the other, while recording the data that has been adopted in a first time.

    I want the user to be able to enter text into a textInput on the first view field and see on the next view, BUT I want the following view to record what the user has entered, return to the first view, then take another entry from the user and create another field textInput on the second point of view. It's like a memo pad app. The user enters a task on the first view, then he or she is able to see it on the second point of view. Then, the user must be able to navigate back to the first view and create another task which also goes to the second point of view, but does not replace the first task that was entered. My problem is to create new textInput fields as new data comes in for the second point of view. Any ideas? Perhaps textInput fields are not visual components I should use...

    http://d-solve.com/flexas3-global-variables-and-the-singleton/

  • How to manage values of 'special' time with the charger

    Hi all

    I want to import data from Google Transit in a DB Oracle (version 11).
    My goal is to import the arrival_time and departure_time as a TIMESTAMP type attributes
    The file to be imported has the following structure:

    trip_id arrival_time departure_time, stop_id, stop_sequence, stop_headsign, pickup_type, drop_off_type, shape_dist_traveled
    3307886, 06:33:00, 06:33:00, 6606, 4,.
    3307886, 06: 34:50, 06: 34:50, 6596, 5.
    3307886, 06: 36:09, 06: 36:09, 6611, 6,.
    3307886, 06: 37:00, 06: 37:00, 6604, 7,.
    3307886, 06: 37:42, 06: 37:42, 6601, 8.
    3307886, 06: 38:24, 06: 38:24, 6612, 9,.
    ...........................
    * 3348800, 24: 47:03: 24: 47:03, 3031, 61, *.
    * 3348800, 24: 48:00: 24: 48:00, 4823, 62, *.

    The problem is that "BOLD" marked lines have a time value greater than 24, and this is not possible with the charger.

    In this case in the imported value the day must be incremented by 1 and time must begin with previousHours % 24.
    for example

    + 3307886, 06:33:00,-> 3307886,'1970-01-01-06: 33:00 ',... +.
    + 3348800: 24: 47:03-> 3348800,'1970-01-02-00: 47:03',... +.

    Thank you very much

    is there a way to do this with sql loader? If so, is there a way to say that for the charger?

    Thanks a lot for your help

    was soon Markus

    Published by: markusin on January 20, 2010 12:26 AM

    Published by: markusin on January 20, 2010 12:26 AM

    Hello Markus.
    If you download files from the server that depends on the database, using external tables is an excellent choice. If you download files from a server that is remote from the database, external tables is not an option and you need to use SQL * Loader.

    In both cases, you can create a function to be used for the processing of these data.

    Your command file may look like this (untested)

    LOAD DATA
    APPEND
    INTO TABLE target_table
    FIELDS TERMINATED BY ','
    TRAILING NULLCOLS
    (  trip_id
     , arrival_time         "CONVERT_TIME(:arrival_time)"
     , departure_time       "CONVERT_TIME(:departure_time)"
     , stop_id
     , stop_sequence
     , stop_headsign
     , pickup_type
     , drop_off_type
     , shape_dist_traveled
    )
    

    Your function might look like this

    CREATE OR REPLACE FUNCTION  convert_time
      (p_time_string  VARCHAR2)
      RETURN  TIMESTAMP
    IS
      r_timestamp            TIMESTAMP;
      v_day_increment        PLS_INTEGER  := 0;
      v_hour_part            VARCHAR2(2);
      v_rest_of_time_string  VARCHAR2(6);
    BEGIN
      v_hour_part           := SUBSTR(p_time_string, 1, 2);
      v_rest_of_time_string := SUBSTR(p_time_string, 3, 6);
      IF  v_hour_part = '24'
      THEN
        v_day_increment := 1;
        v_hour_part     := '00';
      END IF;
      r_timestamp := TO_TIMESTAMP(v_hour_part||v_rest_of_time_string, 'HH24:MI:SS') + v_day_increment;
      RETURN  r_timestamp;
    END;
    /
    

    During testing, I found that the current month and year will be used for the timestamp instead of Jan 1970.

    Hope this helps,
    Luke

    Please check the answer as helpful or response, if it is so. If this is not the case, further clarification.
    Try to always provide create table and table insert to help members of the forum to help you.

  • How to stop more calories of reading on the activity monitor?

    How to stop the calories to be overvalued in the activity monitor?

    Hi Roger

    To help improve the accuracy of estimates of the calories:

    • Check that your personal information is accurate:
      • On your iPhone, in the application of the watch, go to: My Watch (tab) > health > check and, if necessary, change your date of birth, sex, height and weight.
    • Check your privacy settings:
      • On your iPhone, in the application of the watch, go to: My Watch (tab) > privacy > Motion & Fitness > check that heart rate and fitness tracking are both enabled.
    • Calibrate your Apple Watch:
      • Calibration will improve the accuracy of health and activity related to such estimates:
        • Estimates of calories for a workout during the use of the application of the workout.
        • Calories, distance, move and perform estimates in the implementation of the activity.

    More information:

    Calibrate your Apple Watch for better accuracy of training and activity - Apple Support

    Use the activity on your Apple Watch - Apple Support

    Use of the workout on your Apple Watch - Apple Support

  • space management of configured storage server via the 3rd customer of SMI-S Group

    Does anyone know of a way of being able to manage a 2012r2 window server configured with storage space, acting as a storage array, with a 3rd party customer SMI-S?

    Hello

    I suggest that you post the application on Microsoft TechNet forum because we have experts working on these issues. You can check the link to post the same query on TechNet:

    https://social.technet.Microsoft.com/forums/WindowsServer/en-us/home?category=WindowsServer

    Please do not hesitate to contact us if you have other questions related to Windows.

  • How to view several categories of items in the Web application list? Change list listbox to list box to select the category in the submission process?

    Hello!

    1.

    I'm trying to get my page for webapp of list items that are part of a few categories. I understand that if I want to see that one category, I just need to do the normal process to choose this category and put him outside. So my question is: How can I view several categories of items in a Web application on a single page. I tried this

    {module_webapps, WEBAPP_ID, c, CATEGORY_ID1, 10, 1} {module_webapps, WEBAPP_ID, c, CATEGORY_ID2, 10, 1}

    This displays only the whole of the first category, then all the other who will not succeed by date order.

    I also tried this for fun:

    {module_webapps, WEBAPP_ID, c, CATEGORY_ID1 & CATEGORY_ID2, 10, 1}

    How can I go to?

    2.

    I'm looking to allow users to enter a webapp item and allow them to select a category to link to this article.

    < label for = "CAT_Category" > category (you can choose more than 1) < span class = "req" > * </span > < / label >

    < select name = "CAT_Category" id = "CAT_Category" class = "cat_listbox" lines = "4" multiple = "multiple" style = "" height: 60px banner; ">"

    < option value = "CATEGORY_ID1" > - Option 1 < / option >

    < option value = "CATEGORY_ID2" > - Option 2 < / option >

    < / select >

    Is it possible for me to change the style of the listbox in a style box so that the user doesn't have to Ctrl + click on options?

    No answer to no. 1, but I really want to know also.

    N ° 2

    If you already know the category list & ID you can manually create a list of checkboxes

    something like this should work

Maybe you are looking for

  • After installing WXP Satellite A200 reveals an error in device manager

    Hello I reinstalled my pc with windows XP, but after installation, there is a mistake of the ethernet controller in Device Manager.Can someone help me find the right driver for this problem? Here is the information from my pc: SYSTEM====== Host name:

  • Installing drivers for Satellite A300 PSAJ4E XP

    I got my notebook, A300 - PSAJ4E, from Vista to Xp. The following problem occurred: Some drivers are installed and a couple of them did not. The following components are not installed: -Audio device on High Definition (2 times) - Bus (Driver Sound)-C

  • Layer grey on MagSafe port

    Everything in cleaning the MagSafe port on my MacBook Pro 15 "(2009), a layer of gray was released, revealing bare metal." This is why my MacBook does not load?

  • T420 wakes up automatically hibernate due to Intel Identity Protection Technology (IPT)

    Noticed the laptop turned on itself all night and was in fashion in the morning watch... Looking at the log events revealed that it was lit by: Intel (R) Identity Protection Service resume inactive Anyone know why this happens and how to disable it p

  • Windows 2008 Server R2 Std - issue of Best Practice Analyzer

    Windows 2008 Server R2 Std - question BPA I built a new Windows 2008 R2 Standard Server and configured as a domain controller. When you run the BPA I get the following error, which I can not solve: Question:The default domain controllers policy is no