Using cookies in a JAVA portlet

I made a Cookie using JAVA. It is made before user enter in the Oracle Portal (index.html call the java action) to get the
user Country.
Now I can take this cookie by PL-SQL, but I need to get it by JAVA too.
When I call directly my portlet action the java code get the cookie ([http://portal_middle_tier_host:port/testeSession/testeSessionViewAction.do?countryId=BR]), but when I put this portlet on a page, this page can't get the cookies.
this is de JAVA code to get the cookies.
Cookie acheiCookie = null;
Cookie[] meusCookies = request.getCookies();
if(meusCookies != null){
     for (int i = 0; i < meusCookies.length; i++) {
     if (meusCookies.getName().equals("PORTAL_USER_COUNTRY_COOKIE")){
          acheiCookie = meusCookies[i];
     if (acheiCookie == null){ 
     out.println("There aren't your cookie");
     else{   
     out.println("PAIS: " + acheiCookie.getValue());
}else{
     out.println("Thre aren't cookies in request");
Why cna't I get the cookies when I call my portlet in a page and when I caal directly it's works?
Edited by: user10609895 on Nov 25, 2008 10:36 AM

Hi,
1) Create the java dc.
2) In the public part of this java dc create new public part. Include the package tree of the classes in this. e.g if your classes are in packages with root package as com. Include com in public part and as package tree.
Now build the dc. (Must. Hope you are not missing this)
3) Go to dc where you want to use the dc. And add the previous dc as used dc.
Now build both dc's. (Must. Hope you are not missing this)
Now access the classes in your using dc.
Regards.
Ashwani Kr Sharma

Similar Messages

  • Using Cookies

    Hi there
    I have a report template, inside of which is a div containing drop down boxes. I want to use a button to hide/show the div.
    The code to do that is quite simple, however, I want to be able to 'remember' the view state of the div with subsequent page refreshes ( as happens when a value is selected from the drop down ).
    I thought I could use client-side cookies to achieve this, and for the most part this works.
    However, the first time I set the cookie, it doesn't seem to save the value.
    So, the process behind the scenes, is as follows:
    1. Enter the page for the first time ... cookie doesn't exist and div is hidden
    2. Click on the SHOW button, which sets the cookie to visible, and displays the div.
    3. Select a value from one of the dropdowns in the div, which reloads the page.
    4. As the page loads, the cookie should be read and the div display, but I find that the cookie is null or doesn't exist. If I now follow steps 2 and 3 again, next time the page loads, the cookie is read.
    So ... the cookie doesn't seem to be set on the first action, but does work correctly on subsequent actions ... very confusing ??
    Any ideas?
    Cheers,
    Andrew

    Hi,
    You can find the info on how to use cookies here:
    http://java.sun.com/developer/onlineTraining/Programming/JDCBook/aucserv.html
    Hope this helps you
    Cheers
    Giri :-)
    Creator Team

  • How to make a java portlet using workshop?

    I installed weblogic 8.1 portal and the jsr168 support package.
    Can I make a java portlet (not jsp/html) using workshop? How?
    If I can, to make a new portlet should I drag a class file or java file to portal
    Thanks,
    Jason

    In workshop do:
    F1 (for help)
    Take a look at
    => Tutorials => Portal tutorial
    Geoffrey
    "Jason" <[email protected]> schreef in bericht
    news:3f9700f0$[email protected]..
    >
    I installed weblogic 8.1 portal and the jsr168 support package.
    Can I make a java portlet (not jsp/html) using workshop? How?
    If I can, to make a new portlet should I drag a class file or java file toportal
    Thanks,
    Jason

  • Set and read page parameter using a java portlet

    I created a portlet that takes a parameter. I wantt his parameter to be set by the admin in the page parameter section. The portlet that I crated has a parameter. In the providers it has the following:
    <inputParameter class="oracle.portal.provider.v2.DefaultParameterDefinition">
    <name>param</name>
    <displayName>displayParam</displayName>
    </inputParameter>
    However, when I go to the page propertie/parameter, I can "bind" a parameter. How can I do that?
    Thanks,
    Marcelo

    Marcelo,
    This was what I've given you above...
    From 7.1.3 Passing Parameters and Submitting Events jump to Section 2.12, "Public Portlet Parameters Support".
    Public portlet parameters:
    You can use a public portlet parameter to pass a value to a portlet. Using portlet parameters, the information that is displayed in a portlet can be specific to a particular page or a user. Portlet parameters are created by the portlet developer and are exposed to the page designer, through the user interface. After adding a portlet to a page, page designers can assign values to the public portlet parameters to make the information displayed in the portlet specific to the page.
    Page designers can assign values to public portlet parameters by providing a specific value (constant), a system variable (for example, the portal user name), or a page parameter. At run time, the portlet receives the values from the sources specified. In this way, page designers have complete control over the source of the parameter, whereas you have complete control over how the data is used after it is transmitted to the portlet.
    ...and in 7.1.3 Passing Parameters and Submitting Events as assumption is "You have followed through and understood Section 6.3.2, "Building PDK-Java Portlets".
    This why I've said to read it carefully... I hope this helps you further...
    Cheers,
    Pedro.

  • Anyone using Java Portlet Tools?

    Is anyone using the Java Portlet Tools to develop portlets?
    You can read about it here:
    http://dev2dev.bea.com/pub/a/2006/05/java-portlet-tools.html
    I was told by BEA that this is unsupported but I don't think thats going to be a problem.
    If you are not using this then how do you build portlets in java without resorting to scriptlet code?

    Thanks for the reply Chris.
    It looks like the portlet tools does 3 things:
    1 - filters content like the DotNet WCC http module to make existing apps behave when run inside the portal
    2 - drops a bean in the request automatically for you so that you can access portlet functionality on the jsp with JSTL and no scriptlet code
    3 - gives you some custom tags to read and write session prefs and publish and subscribe to events without javascript
    Items 2 and 3 are very desirable to me for new portlet development.
    So who is using this toolkit and are you using it with JSF or Struts or just straight JSP?

  • Using SSO username/password in java portlet for Database Connection

    Hi all,
    We implemented java portlet with environment Oracle Application server 10.1.2 and Portal 10.1.4
    At present we are picking the database username and password and connect string in properties and our
    java class is reading the properties file and connecting to database to fetch the records.
    Our idea is to not to pick the username/password and connect string from the properties file or
    not to configure the datasource in data_source.xml.
    Our Requirement is who ever login to the Portal(SSO) our java class should pick the sso username/password and
    connect to database to fetch the record(s).
    Because our database users are one to one mapped to sso user(s) of portal.
    We request anyone to guide us how can we do it or suggest any suitable solution for our requirement.
    Thanks
    Dan Tey

    I think this is a no-go, since you cannot retrieve a cleartext password from the OID if I'm correct.

  • Deploying  Jave portlet on Oracle Application Server 10g

    I have installed Oracle 10g Application server, donwloaded and installed JDevleoper 9.0.5.1 and the latest Java Portal Development and as well as the JDeveloper portlet-addin. Now, I followed the instructions from the http://portalstudio.oracle.com/pls/ops/docs/FOLDER/COMMUNITY/PDK/ARTICLES/BUILD.JSR168.PORTLETS.USING.JAVA.PORTLET.WIZARD.9IJDEVELOPER.HTML
    On using JDeveloper addin wizrd to create a java portlet and so far so good. However, I am stuff on the last bit on deployment. It document says "# Now use the URL provided in the log page at the bottom of JDeveloper to get part of your URL (e.g. http://myserver.uk.oracle.com:8888/my-portlet) and complete the URL.
    http://myserver.uk.oracle.com:8888/my-portlet/portlets?WSDL
    Now use this URL to register your portlet with OracleAS Portal.
    But when i deploy my application (just a test thing), from the deployment tab I get:
    ---- Deployment started. ---- 22-Mar-2005 14:11:27
    Target platform is Oracle Application Server 10g (hotseatConnection).
    Wrote WAR file to C:\work\oracle\MyProject\MyPortlet\deploy\hotseat.war
    Wrote EAR file to C:\work\oracle\MyProject\MyPortlet\deploy\hotseat.ear
    Invoking DCM servlet client...
    C:\Java\j2sdk1.4.2_03\jre\bin\javaw.exe -Djava.protocol.handler.pkgs=HTTPClient -jar C:\Java\JDeveloper9.0.5.1\jdev\lib\oc4j_remote_deploy.jar http://194.83.41.114:1811/Oc4jDcmServletAPI/ ias_admin **** redeploy /u01/app/oracle/product/10.1.0/oraMid_904 C:\work\oracle\MyProject\MyPortlet\deploy\hotseat.ear hotseat
    Initializing log
    Servlet interface for OC4J DCM commands
    Command timeout defined at 600 seconds
    Executing DCM command...
    Executing command redeploy /u01/app/oracle/product/10.1.0/oraMid_904 C:\work\oracle\MyProject\MyPortlet\deploy\hotseat.ear hotseat UNDEFINED
    Command = REDEPLOY
    Reading application's ear file
    Ear file was successfully read
    Opening connection to Oc4jDcmServlet
    Setting userName to ias_admin
    Sending command to DCM servlet
    HTTP response code = 200, HTTP response msg = OK
    Command was successfully sent to Oc4jDcmServlet
    Receiving session id from servlet to check command status
    Session id = c253297271317c3f930003c405ea91ff598582f0be0
    Please, wait for command to finish...
    Checking command status...
    Setting userName to ias_admin
    Setting Cookie to JSESSIONID=c253297271317c3f930003c405ea91ff598582f0be0
    Checking command status
    HTTP response code = 200, HTTP response msg = OK
    Command has not finished yet
    Checking command status...
    Setting userName to ias_admin
    Setting Cookie to JSESSIONID=c253297271317c3f930003c405ea91ff598582f0be0
    Checking command status
    HTTP response code = 200, HTTP response msg = OK
    Command has not finished yet
    Checking command status...
    Setting userName to ias_admin
    Setting Cookie to JSESSIONID=c253297271317c3f930003c405ea91ff598582f0be0
    Checking command status
    HTTP response code = 200, HTTP response msg = OK
    Command has not finished yet
    Checking command status...
    Setting userName to ias_admin
    Setting Cookie to JSESSIONID=c253297271317c3f930003c405ea91ff598582f0be0
    Checking command status
    HTTP response code = 200, HTTP response msg = OK
    Command has not finished yet
    Checking command status...
    Setting userName to ias_admin
    Setting Cookie to JSESSIONID=c253297271317c3f930003c405ea91ff598582f0be0
    Checking command status
    HTTP response code = 200, HTTP response msg = OK
    Command has not finished yet
    Checking command status...
    Setting userName to ias_admin
    Setting Cookie to JSESSIONID=c253297271317c3f930003c405ea91ff598582f0be0
    Checking command status
    HTTP response code = 200, HTTP response msg = OK
    Command has not finished yet
    Checking command status...
    Setting userName to ias_admin
    Setting Cookie to JSESSIONID=c253297271317c3f930003c405ea91ff598582f0be0
    Checking command status
    HTTP response code = 200, HTTP response msg = OK
    Command has not finished yet
    Checking command status...
    Setting userName to ias_admin
    Setting Cookie to JSESSIONID=c253297271317c3f930003c405ea91ff598582f0be0
    Checking command status
    HTTP response code = 200, HTTP response msg = OK
    Command has not finished yet
    Checking command status...
    Setting userName to ias_admin
    Setting Cookie to JSESSIONID=c253297271317c3f930003c405ea91ff598582f0be0
    Checking command status
    HTTP response code = 200, HTTP response msg = OK
    Command has not finished yet
    Checking command status...
    Setting userName to ias_admin
    Setting Cookie to JSESSIONID=c253297271317c3f930003c405ea91ff598582f0be0
    Checking command status
    HTTP response code = 200, HTTP response msg = OK
    Command has finished
    Receiving command exit value
    Receiving command output
    **** No output was received from command
    Closing connection to Oc4jDcmServlet
    DCM command completed successfully.
    Output:
    Exit status of DCM servlet client: 0
    Elapsed time for deployment: 1 minute, 45 seconds
    ---- Deployment finished. ---- 22-Mar-2005 14:13:12
    My question is, HOW DO I ACCESS the deployed application, since it didn't specify the URL where it's deployed????
    Many thanks
    P/S
    I have tried:
    http://{myserver}:8888/{my-portlet}/portlets?WSDL but that doesn't work

    Hi FormsEleven,
    When you say you can do this or you have done for demo then considering following directory structure if I have two forms having common form names how it will be resolved?
    Or how the url to access these forms will be?
    As shown in the following structure consider we have Form1 in sub directory1 as well as in sub-directory2 then how the link to access these forms will be?
    - Hosting Directory (formsweb.cfg entry)
      - Sub Directory1
          - Form1
          - Form2 
      - Sub Directory2
          - Form1
          - Form4
      - Sub Directory3
          - Form5
          - Form6

  • Java Portlet built with BC4J JSP

    Dear Forum,
    The BC4J JSP tag "jbo:ApplicationModule" creates a stateful session by storing a sessioncookie: When this cookie is found, the application module object will be re-used across webpages.
    When a Java Portlet is built using BC4J-JSP, this portlet plants a cookie in its client (the portal). This seems however not to be possible. This means that the portlet can only be stateless.
    Has anyone a clue how to plant a cookie in the portal; thus enabling stateful sessions?
    Kind regards,
    Edwin Grosmann

    It looks like WebSphere is wrapping the Oracle JDBC driver with it's own classes (like com.ibm.ejs.cm.proxy.OraclePreparedStatementProxy).
    On Step 1 of the Business Components Project Wizard, change the SQL Flavor toSQL92 and the Type Map to Java.
    This is the same type of thing required with talking to non Oracle databases (in short, it tells BC4J not to cast things to Oracle classes and just talk against java.sql.*)
    Hope this helps,
    Rob
    Team JDev

  • Java Portlet Geneartion through Designer

    I like to know if anybody has worked on" how to generarte Java Portlets(Java Code) using Designer". Is there a way doing it?
    In other words,How can I include Jdeveloper APIS in Designer? Any Input regarding this would be appreciated.
    Thanks
    H.Israel Arockiaraj

    Here you find detailed information about Sharing Session Cookies.
    Peter

  • Passing value to a dynamic page from a pdk-java portlet

    Hi everyone.
    I'm quite new to portlets, so I'll try to present my problem as well as I can:
    I have a PDK-java portlet in which I read some information (like name, location) about user.It works ok.Now I want to use that infomation in another portlet, which is build as a Dynamic Page ( with portletbuilder). How can I do this? I was thinck at session variables, but....
    Thanks a lot

    have you ever got any response??
    i'm facing the same problem.
    thanks

  • How to retrieve which user-agent in a java portlet?

    Is there a way to get http user-agent info about which browser requested a page with a portlet from within the java portlet?
    It seems like the request.getHeader() always returns the same value no matter what browser we use.
    Have also tried portletRenderRequest.getOriginalHeader() but this method also returns the same result.
    Does the PPE replace these headers or what..?
    Regards,
    Per A Jorgensen

    Hi Per A Jorgensen,
    I see what you mean. I just deployed a simple portlet which displays the user-agent header property.
    Here are my observations:
    1. If you access the page as user1 from Mozilla, I see the following:
    Browser Agent:      Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.7.8) Gecko/20050511 RPT-HTTPClient/0.3-3 RPT-HTTPClient/0.3-3
    2. If I now access this page from IE, as user1, then I still see my browser agent as:
    Browser Agent:      Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.7.8) Gecko/20050511 RPT-HTTPClient/0.3-3 RPT-HTTPClient/0.3-3
    3. If I now access this page from IE, as user2, then i see the following details:
    Browser Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 1.1.4322) RPT-HTTPClient/0.3-3 RPT-HTTPClient/0.3-3
    4. Now I access the same page from Mozilla (after logging out of user1) as user2, I see the following:
    Browser Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 1.1.4322) RPT-HTTPClient/0.3-3 RPT-HTTPClient/0.3-3
    Hmm.. interesting.. it looks like, whoever access the provider first, fixes the user-agent. I need to investigate more into it to find out information as to why this is happening.
    In the mean-time, you can be rest assured that as long as you dont have multiple user's accessing the portlet as the same user, you will get the correct information.
    thanks,
    Harsha

  • Passing Parameters between Java Portlets

    i hava java portlet and it does a search... the search result appears within the portlet region.... but i want to be able to click on the search button and take it to another portal page and have a portlet that contains the result of the porltet... how is that acheivable...

    Well i've done this with java pdk portlets, but I guess the principle is the same everywhere.
    Where are 2 types of parameters, qualified and unqualified ones. In your case you have to
    use unqualified ones, so that your other portlet can read a parameter which is set by your search portlet.
    Also add <passAllUrlParams>true</passAllUrlParams> to your provider.xml, inside a portlet tagof the result portlet, so yo are able to read unqualified params aswell.
    Othee options are using sessions or a persistant datastore, eg database

  • URGENT:How to pass parameter to page from java portlet

    Hi,
    All i need to do is to pass a parameter from my custom java portlet to an omniportlet. Is it achievable? If so, please point me direction!
    Thanks,
    Ceren

    Hmm yeah or else you could use java.net.URLEncoder.encode(String s) to encode it automatically.
    (java.net.URLDecoder.decode(String s) decodes btw)

  • Drag And Drop Java Portlets

    Hi,
    How can we develop Drag and Drop (DnD) Portlets. Does Oracle Portlet provide such functionality.Can someone guide me or have any documentation on how to create Java Portlets that can be dragged arround i.e. just like on google site http://www.google.com/ig. I am using 10.1.0.4. Thanks

    Is there any kind of documentation available as how to build this kind of functionality. What API's to use. Lifefray and StringBeans Portal provides DnD functionality so curious if it's also doable using Oracle Portal and if so how to start on it. I am more interesetd in docs. and API's to use for building our own.
    Thanks

  • How to use PL/SQL procs with portlet enabled CA's?

    I have written some PL/SQL procedures in a package.
    Now I would like to use this in a FOLDER-portlet (a new CA created for this purpose).
    But when I select the 'Open Item In Folder' (which should show the PL/SQL procedure results in the portlet I hope) I get:
    Call to utl_http failed (WWS-32136)
    ORA-1: User-Defined Exception (WWC-36000)
    If instead the option 'Open in new browser window' (or something like that) I get no error.
    My CA calls the PL/SQL pkg using a URL item like this:
    http://myserver/pls/dad/schema.package.procedure?p_arg=...
    It works entered directly in the address bar and if the item opens in a new window.
    But I want it to display in the SAME portlet as the link I click on.
    How is this done?
    null

    JDBC (and SQLJ) only support SQL types as stored procedure arguments, not PL/SQL types.
    If your stored procedure uses a PL/SQL-only type, such as BOOLEAN, record types, or index-by tables, then you cannot call it from Java (or, for that matter, from other languages as well).
    There is one exception: scalar index-by table arguments have been supported since JDBC 8.1.7 in the JDBC-OCI driver (refer to the JDBC manual for specifics).
    One workaround is to create wrapper PL/SQL stored procedures that take SQL arguments and convert them to PL/SQL -and vice versa- and call the original PL/SQL stored procedures. For example, a record type could be exploded into individual arguments, or it could be converted into a SQL object type, index-by tables could be represented as SQL collection types, etc.
    You can find a small example of this in the back of the JPublisher manual, where an example is given how to call a PL/SQL stored procedure that takes BOOLEAN arguments.

Maybe you are looking for

  • Novo Cálculo de IPI na MP 540

    Amigos, Não sei dúvidas de localização BR são colocadas aqui mas vamos lá: O governo acaba de editar a Medida Provisória 540 que vai alterar a forma de tributação do cigarro. Como sabemos, a função que calcula impostos na TAXBRJ não nos permite inser

  • Set reference point for multiple objects in the middle of the document

    Hello Community, I want to mirror a layout. So I: 1. Select all the objekts 2. Set the reference point to the middle 3. Mirror the objects BUT The reference point is the middle of all the OBJECTS. That leads to several objects crossing the border of

  • Transaction resources not released across program invocations using MVCC

    I'm evaluating Berkley DB XML v2.4.13 for use in a new software product and have encountered problems with multiversion concurrency control. I'm using the Java API and JRE 1.6.0_07. The platform is Windows XP Professional SP3. When I create a transac

  • How to use RTFSync in c# ?

    Hello, I need to call this function since i have some mails where the RTF is not in sync (PR_RTF_IN_SYNC returns false) and the consequence is that some attachments appear to be blank when they are opened from disk. Do you know how i can call this fu

  • Page navigation not working through adf-config

    Hi, JDeveloper : 11.1.1.17 I created a WebCenter Framework Portal application. 1. Created a new page under "oracle\webcenter\portalapp\pages" by name Page1. 2. Dragged both "home" and the new page "Page1" and dropped into the adf-config. 3. Created a