Programmatic logon from Java code.

Hi Folks,
I'm trying to implement programmatic logon using the AbstractPortalComponent. For
that I want to develop an iView which will get user name and password from the user for
authentication.
For this, I have wrote <i>AbstractPortalComponent</i> that generates pure html form and
gets the input from the user. Once user "submit" the form, event handler is called which
does the authentication and display the result back to the user.
I'm using the UME API <i>UMFactory.getLogonAuthenticator().logon()</i>.  After the event
handler routine, it should call <i>doContent()</i> to display the result. But, after the event
handlder, <i>doContent()</i> is not called.
From the eclipse debugger I can see that <i>logon()</i> method is successful. If I comment out
the <i>logon ()</i> statement, everything looks good.
Please suggest if there is any other way that works.
Here is the code.
public class Logon extends AbstractPortalComponent
     private final static int INITIAL_STATE = 0;
     private final static int WELCOME_STATE = 1;
     private int state = INITIAL_STATE;
     private String name = "";
     private IPortalComponentURI uri;
     private String logonStatus="";
     protected void doContent(IPortalComponentRequest request, IPortalComponentResponse response) {
          StringBuffer sb = new StringBuffer();
          switch (state) {
               case INITIAL_STATE:
                    if (name == null)
                         name = "";
                    // create a uri for the event
                    uri = request.createPortalComponentURI();
                    uri.setPortalRequestEvent(request.createRequestEvent("Validate"));
               sb.append("<form action="" + uri.toString() +     "" method="post">")
                                   //       .append("<input name="login_submit" type="hidden" value="on">")
                              //We put this line, we get  runtime error.
                              //            .append("<input name="login_do_redirect" type="hidden"  value="on">")
                           //checkout if this is required:  <input type="hidden" name="login_do_redirect" value="1">
                                          //.append("<input name="j_authscheme" type="hidden" value="default">")
                              //            .append("<input name="j_authscheme" type="hidden" value="uidpwdlogon">")            
                                          .append("<table border="0" align="left" valign="top">")
                                          .append("<tr><td>User Id</td><td width="183" height="20">")
                                          .append("<input name="j_user" type="text" value="" +"">")
                                          .append("</td></tr><tr>")
                                          .append("<td width="161" height="20">")
                                             .append("Password</td>")
                                             .append("<td width="183" height="20">")
                                             .append("<input name="j_password" type="password">")
                                             .append("</td></tr><tr>")
                         .append("<td colspan="2" height="20">  </td>")
                         .append("</tr><tr><td colspan="2">")
                         .append("<input type="submit" value="Log on">")
                         .append("</td></tr></table></form>");          
                         response.write(sb.toString());
                    break;
               case WELCOME_STATE:
               sb = new StringBuffer();
               sb.append("Logon status: " +logonStatus );               
               response.write(sb.toString());                    
                    break;
               default:
                    //should never happen
     public void doValidate(IPortalComponentRequest request, IPortalRequestEvent event) {
          try {
//Below two statements are good - They return user  name correctly.
               //name = event.getData().getAttribute("j_user");
               //name = request.getServletRequest().getParameter("j_user");
               Subject subject = UMFactory.getLogonAuthenticator().logon(
                              request.getServletRequest(),
                              request.getServletResponse(true),
                              "uidpwdlogon");                                                                              
               if(subject == null)
                    logonStatus = "Logon failed with by null Subject";
               else
                    logonStatus = "Logon is Successful!";
               state = WELCOME_STATE;          
          } catch (NullPointerException npe) {
               //npe.printStackTrace();
               logonStatus = "Null pointer exception";
          }  catch (LoginException e) {          
               logonStatus = "Logon Failed: " + e.getCause();               

doContent() is not called when reference to Original httpservletresponse <i>request.getServletResponse(true)</i> is obtained.

Similar Messages

  • Clear the Filter Criteria from java code programmatically

    Hi All,
    I am using jdev version 11.1.1.6.0.
    I do have ADF table for which I have added filter to each column .
    I created table using java class data control.
    Filter is working Fine .
    My use case is-
    When I click on search button data is populated in table.
    When anybody enters filter value in column suppose product and hit enter ,it filters data.
    if he clears and do not hit enter key and search again then it does not show all data it only show filtered data.
    So how can I programmatically clear all filters so on click of  search it will show all the values not filtered values.
    I have not used default Filter Behavior.
    Please check below code for reference
      <af:table value="#{bindings.AfMyAccOrderStatusHistorySearchVO.rangeSet}"
                                  var="row"
                                  rows="#{bindings.AfMyAccOrderStatusHistorySearchVO.rangeSize}"
                                  emptyText="#{bindings.AfMyAccOrderStatusHistorySearchVO.viewable ? 'No data to display.' : 'Access Denied.'}"
                                  fetchSize="#{bindings.AfMyAccOrderStatusHistorySearchVO.rangeSize}"
                                  rowBandingInterval="0" id="tblStatusHistoryList"
                                  autoHeightRows="#{bindings.AfMyAccOrderStatusHistorySearchVO.rangeSize}"
                                  rowSelection="single"      
                                  width="100%"
                                  partialTriggers="::cb5 ::cb8 ::cb1 ::cb2"
                                  filterModel="#{bindings.AfMyAccOrderStatusHistorySearchVO1Query.queryDescriptor}"
                                  queryListener="#{bindings.AfMyAccOrderStatusHistorySearchVO1Query.processQuery}"
                                  filterVisible="true" varStatus="vs"
                                  binding="#{AfMyAccOrderStatusHistoryAction.orderStatusHistorySearchList}">
    <af:column headerText="#{alfaprojectBundle['ordstatushistory.column.invoiceDate']}"
                                      width="70"
                                      sortProperty="invoiceDate"
                                      sortable="true" filterable="true"
                                      id="c7" filterFeatures="caseInsensitive">
                              <af:outputText value="#{row.invoiceDate}" id="ot16"/>
                            </af:column>                     
                            <af:column headerText="#{alfaprojectBundle['ordstatushistory.column.soldto']}"
                                       width="100"   
                                       sortProperty="soldTo"
                                       sortable="true" filterable="true"
                                       id="c14" filterFeatures="caseInsensitive">
                              <af:outputText value="#{row.soldTo}"
                                             visible="#{row.visibilityIsOrdrFirstItem}"
                                             id="ot23"/>
                            </af:column>
    So how to clear all filter values from java code.

    I can't get the example "Programmatically Manipulating a Table's QBE Filter Fields"
    Where is it ?
    https://smuenchadf.samplecode.oracle.com/samples/ClearTableColumnFilterFields.zip
    Thks

  • Running sqlplus scripts from Java code?

    hi
    I need to programmatically run sqlplus scripts from Java code on a machine that doesn't have sqlplus installed.
    Is there any Java class library available for doing this?

    The Ant approach could probably work for me, thanks for the tip.
    The setup seems rather complex however, given the simplicity of the task. I would prefer just running a Java based SQL*Plus from in a separate process or doing this via an API that would allow me to run SQL*Plus scripts (parse script, substitute variables, run statements).
    Oracle SQL Developer v1.1 appears to include an API that does exactly this.
    The ScriptParser, Substitution and SQLPLUS classes in the oracle.dbtools.raptor.scriptrunner package (oracle.sqldeveloper.jar) seem to do just what I need based on my tests.
    Can I use these classes for this purpose in my application? Is repackaging allowed?
    Does Oracle have any plans for releasing this sort of functionality separately e.g. as part of the Instant Client?

  • Generation of xml file from java code

    hi,
    I want to manipulate data in a xml file with java code.I have read data from xml file and also changed it. But i am unable to covert it again in xml file from java code. Can you please tell me how i can do this?

    Let me know which parser are you using currently for reading xml files so that i assist you. For now, you can refer to STAX Parser API under this link
    http://java.sun.com/webservices/docs/1.6/tutorial/doc/SJSXP3.html

  • How to call a .bat file from java code?

    How to call a .bat file from java code? and how can i pass parameters to that .bat file?
    Thanks in advance

    thanks for ur reply
    but still i am getting the same error.
    I am trying to run a .bat file of together tool, my code looks like below
    import java.lang.Runtime;
    import java.lang.Process;
    import java.io.File;
    class SysCall{
         public static void main(String args[]){
              String cmd="D://Borland//Together6.2//bin//Together.bat -script:com.togethersoft.modules.qa.QA -metrics out:D://MySamples//Metrics// -fmt:html D://Borland//Together6.2//samples//java//CashSales//CashSales.tpr";
              //String path="D://Borland//Together6.2//bin//Together.bat ";
              Runtime r= Runtime.getRuntime(); //Declare the system call
              try{
                   System.out.println("Before batch is called");
                   Process p=r.exec(cmd);
                   System.out.println(" Exit value =" + p.exitValue());
                   System.out.println("After batch is called");
              /*can produce errors which must be caught*/
              catch(Exception e) {
                   e.printStackTrace();
                   System.out.println (e.toString());
    I am getting the below exception
    Before batch is called
    java.lang.IllegalThreadStateException: process has not exited
    at java.lang.Win32Process.exitValue(Native Method)
    at SysCall.main(SysCall.java:17)
    java.lang.IllegalThreadStateException: process has not exited

  • Starting exetutable java file from java code

    Hi I was wondering how I can start a executable java file from java code?
    thanks

    Hi Mkaveli,
    Yes, it's possible. If you have a JAR executable, you've just to call the main method of its starter class. For a simple executable class, just call its main method.
    This way :
    SomeStarter.main(null); // if there's no argumentSmall precision : the executable JAR or class must be specified in the classpath of your application.

  • How to modify an existing xml file from java code.

    Hi
    I have worked on creating a new xml file from java code using xmlbeans.But if i try to modify an already existing file using java code I am unable to get errorfree xmlfile.
    For example if xml file(studlist.xml) is as below:
    <?xml version="1.0" encoding="UTF-8"?>
    <StudentList xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="D:\kchaitanya\xmlprac1\abc\Studlist.xsd">
         <Student>
              <Name>ram</Name>
              <Age>27</Age>
         </Student>
    <Student>
              <Name>sham</Name>
              <Age>26</Age>
         </Student>
    </StudentList>
    Now suppose i have set name to victor using student.setName,
    and set age to 20 using setAge from javacode,
    the new xml file is as follows:
    <?xml version="1.0" encoding="UTF-8"?>
    <StudentList xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="D:\kchaitanya\xmlprac1\abc\Studlist.xsd">
         <Student>
              <Name>ram</Name>
              <Age>27</Age>
         </Student>
    <Student>
              <Name>sham</Name>
              <Age>26</Age>
         </Student>
    </StudentList>
    <Student>
              <Name>victor</Name>
              <Age>20</Age>
         </Student>
    As observed this is not a valid xml file.But how can i modify without any errors?

    I know it's an old post, but I found this while doing a google search for something else, and don't like to leave it un-aswered
    Just in case anyone has a similar problem... In this case the new elements have been appended outside of the root element
    What you need to do is first get the root element and then append the new children to that, there are several ways of getting the root element, which depend on what you want to do with the elements you get back here's a simple (incomplete) way.
    // gets the root element of the specified file (code not shown)
    Element rootElement= new SAXReader().read(file).getRootElement();Then just append the new elements as below (this is non-generic code and would need to be modified for your situation)
    // write a new student element
    Element student = document.createElement("Student");  // creates the new student
    rootElement.appendChild(student); // ***appends it to the root element***
    Element name = document.createElement("Name"); // creates the name element
    name.appendChild(document.createTextNode("Fred")); // adds the name text to the name element
    student.appendChild(name); // appends the name to the student
    Element age= document.createElement("Age"); // creates the age element
    age.appendChild(document.createTextNode("26")); // adds the age text to the age element
    student.appendChild(age); // appends the name to the studentThen flush ya buffers or whatever and write the file
    Edited by: Dream-Scourge on Apr 23, 2008 11:10 AM

  • Calling a javascript function from java code and getting tha value in Java

    Hi,
    I would like to call a Java script function confirmRemove() from Java code upon meeting a condition..
    for example the code snippet is:
    if(true){
    // I want to call js confirmRemove() over here. And get the value of variable "answer" in this if block.
    <html>
    <head>
    <script type="text/javascript">
    function confirmRemove() {
         var answer = confirm("Are you sure you want to Delete?")
    </script>
    </head>
    <body>
    <form>...

    Hi,
    Back in 2003 I have used an Applet which contain java code and this java code was calling the java scripts ( different methods, DHTML etc..)
    There was a component developed by NetScape called JSObject I am not sure it there is other third party component other then the JSObject
    look at this article which shows how (based on JSObject)
    [http://java.sun.com/products/plugin/1.3/docs/jsobject.html|http://java.sun.com/products/plugin/1.3/docs/jsobject.html]
    Regards,
    Alan Meio
    London,UK

  • Problem when connecting locally to Oracle Database 10g from Java code

    Good afternoon,
    I try to connect to my local Oracle 10g from JAVA code. Could somebody tells me what are the 'values' to enter in place of 'value1, value2, value3' in the following:
    final String connectionURLThin = "jdbc:oracle:thin:@value1:value2:value3";
    I tried to put my 'user' and 'pw' credentials I used when connecting with SQL*PLUS:
    value1=my_user_name
    value2=my_pw
    value3=my_schema
    but it doest work. Besides where could have I to put the 'WORKSPACE" name?
    Thanks for any help.
    Claude
    Details:
    ERR MESSAGE----------------------
    Exception in thread "main" java.lang.NoClassDefFoundError: oracle/dms/instrument/ExecutionContextForJDBC
    at oracle.jdbc.driver.PhysicalConnection.<init>(PhysicalConnection.java:365)
    at oracle.jdbc.driver.T4CConnection.<init>(T4CConnection.java:165)
    at oracle.jdbc.driver.T4CDriverExtension.getConnection(T4CDriverExtension.java:35)
    at oracle.jdbc.driver.OracleDriver.connect(OracleDriver.java:854)
    at java.sql.DriverManager.getConnection(DriverManager.java:620)
    at java.sql.DriverManager.getConnection(DriverManager.java:200)
    at javaapplication6.ConnectionExample.driverManager(ConnectionExample.java:138)
    at javaapplication6.Main.main(Main.java:36)
    Caused by: java.lang.ClassNotFoundException: oracle.dms.instrument.ExecutionContextForJDBC
    at java.net.URLClassLoader$1.run(URLClassLoader.java:217)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(URLClassLoader.java:205)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:319)
    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:294)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:264)
    at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:332)
    ... 8 more
    Java Result: 1
    BUILD SUCCESSFUL (total time: 0 seconds)
    ---------------------ERR MESSAGE
    JAVA code------------------it compiles but throw an error when running there -> (*)...
    final String driverClass = "oracle.jdbc.driver.OracleDriver";
    final String connectionURLThin = "jdbc:oracle:thin:@jeffreyh3:1521:CUSTDB";
    final String userID = "scott";
    final String userPassword = "tiger";
    final String queryString = "SELECT" +
    " user " +
    " , TO_CHAR(sysdate, 'DD-MON-YYYY HH24:MI:SS') " +
    "FROM dual";
    public void driverManager() {
    Connection con = null;
    Statement stmt = null;
    ResultSet rset = null;
    try {
    DriverManager.registerDriver(new oracle.jdbc.driver.OracleDriver());
    con = DriverManager.getConnection(connectionURLThin, userID, userPassword); // (*) prob here
    stmt = con.createStatement ();
    rset = stmt.executeQuery(queryString);
    rset.close();
    stmt.close();
    } catch (SQLException e) {e.printStackTrace();
    --------------------JAVA JDK 1.6
    My system ------------------------
    Oracle Database 10g Express Edition Release 10.2.0.1.0 - Product
    PL/SQL Release 10.2.0.1.0 - Production
    CORE 10.2.0.1.0 Production
    TNS for Linux: Version 10.2.0.1.0 - Production
    NLSRTL Version 10.2.0.1.0 - Production

    Yes, the network connection could not be established. Like the error said.
    What you're asking about is the exact reason, but that could be any number of things and not at all related to code. You could have the wrong host, the wrong port. A firewall could be blocking the outgoing connection, a firewall could be blocking the incoming connection. Etc. etc.

  • How i can set dropDown item to 6th item from java code ?

    Hi
    Thank you for reading my post.
    how i can set dropDown item to 6th item from java code ?
    i have the value field of database and i can use it to set selected item of DropDown.
    so : can i use value field to set the selected item ?
    Thank u.

    Hi,
    Please go through the following thread which discusses about setting teh selected item for a dropdown:
    http://swforum.sun.com/jive/thread.jspa?forumID=123&threadID=50697
    Hope it helps
    Cheers
    Giri

  • Executing a DDL statement from java code

    Hi all,
    this is code from jdev11.1.1.3 version. I am trying to execute a DDL statement in oracle db from java code, but "ORA-00900: invalid SQL statement" error is coming.
    I am trying to create a table in same schema in same db by using 'Copy' command.
    Same DDL command is executing from sql command prompt & table is being created. Plz help me , as how to do from java?
            public String cmb_action() {
            // Add event code here...
            try {
                //getting source db connection
                InitialContext initialContext = new InitialContext();
                DataSource ds = (DataSource) initialContext.lookup("java:comp/env/jdbc/SourceConnDS");
                Connection sourceconn = ds.getConnection();
                sourceconn.setAutoCommit(false);
                String sql = "Copy from myschema/mypass@DB insert t_dept using select * from dept;"                       
                Statement stat = sourceconn.createStatement();
                stat.executeUpdate(sql);
                sourceconn.commit();
                System.out.println("done");
              catch (Exception ne) {
                // TODO: Add catch code
                ne.printStackTrace();
            return null;
        }

    I have a requirement to transfer data from one db to another db from Java Application Layer.Maybe, maye not. We get all sorts of weird "requirements" - which are nothing but thoughts or proposed solutions.
    But,
    Did the "requirement" mention whether the table existed already or not in the target database? - If not, did it tell you to create it - drop/create it?
    Did the "requirement" deliver some explanation to why this copying was neeeded? - Are we talking replication? - Or a one time cloning?
    Etc, etc,
    Personally I would always argue against a "reuirement" like that. - It just isn't the way to do it. Period.
    Regards
    Peter
    P.S: If you are satisfied with what COPY does, then you could let Java make an OS call and do it from there?

  • Programatically calling control flows from java code

    Hi all,
    I have a bounded taskFlow that uses pageFragments. This flow is a region in a page(.jspx).
    In my page fragment, I have a inputComboboxListOfValues with a ValueChangeListener code in a java bean.
    I want when a value is changed, to programatically call "controll flow" (this one has: "From Activity Id" -the page fragment with that inputComboboxListOfValues, and "To Activity Id" - the default Activity on this task Flow).
    So when the value change, practically I want to restart the flow programatically and pass the selected value as input parameter.
    Since the inputComboboxListOfValues is not like a button where in the "Action" property you can set the Control Flow and navigate somewhere, the only option I have is to programatically cause navigation from java code (example: the value change listener code).
    Can this be achieved?
    Any advice is helpfull.

    Hi,
    Absolutely, you can do it using the NavigationHandler. Try the following in you value change listener:
    FacesContext context = FacesContext.getcurrentInstance();
    NavigationHandler handler = context.getApplication().getNavigationHandler();
    handler.handleNavigation(context, null, outcome);
    // Render the response after that phase, the button actions should not be called
    context.renderResponse();
    // Add the following line if you want to prevent further value change listeners to be called
    // throw new AbortProcessingException();Regards,
    ~ Simon

  • Accessing XI Tables (ABAP Stack) from Java code

    Hi,
    IS it possible to access tables like SXMSPMAST, SXMSPEMAS directly from Java code without the use of any RFC or BAPI in between?
    Cheers,
    Earlence

    I think it is technically possible, as you can get access to the JDBC Connector service using J2EE's JNDI feature ... Then you can use the internal DB datasource to read data from tables (read ONLY, cuz I'm not sure it is a good idea to update data "outside" the box, and reading can also have potiential perf or stability issue) ... Some (better) methods can also exist !
    Chris
    Edited by: Christophe PFERTZEL on Jan 15, 2010 3:07 PM

  • Create web service from java code in Jdeveloper 11.1.1.5

    I am try to create web service from java code by default it is connected to Integrated web logic server and generate a
    WSDL like this.
    http://localhost:7101/javaexcel-project1-context-root/MyWebService1Soap12HttpPort.
    please tell me how we can change this local host to our needed Host and how to deploy this web service to web logic server.

    Hi,
    Just right click on your project and deploy it to your application server (Weblogic Server (Not the Integrated server)). {Before that, you have create your Application server connection in the Jdeveloper).
    After deployment open the Admin console of the weblogic server and find your ear of the project.Click on that (Go to the "Testing tab") and you will get the "WSDL" (Concreate wsdl)  and "Test Client" of the Project.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

  • Can u access Oracle9i Reports objects from Java Code?

    Hi,
    How can you access Oracle9i Reports (Rel 2) objects like Body, DataSource, Groups etc from Java Code?
    What are the available APIs?
    I went thru the APIs at http://otn.oracle.com/products/reports/htdocs/getstart/docs/Javadocs/oracle/reports/plugin/definition/package-summary.html
    However various constructors stated in these APIs are using classes from "oracle.reports.definition" package which are difficult for me to locate.
    For eg. Report constructor is using oracle.reports.definition.RWReport and there is no API documentation available for RWReport class.
    Please suggest me the site for the above APIs or the method to get a reference to "Report" instance.
    Thanks
    Rakesh.

    Thanks Tugdual for your quick reply.
    Thats exactly what I am trying to do. I want to develop a utility which can have a subset of Report Developer's functionality.
    Currently using Reports Developer & Report Wizard, I can create a report by providing SQL statement and few parameters (like Report Style, Calculated Fields, Template file etc). I want to put all these parameters in a XML file and run my java utility (based on the APIs which I am looking for) which will use these XML parameter file and generate a '.rdf' file.
    Also, could you please suggest me the site for oracle.reports.definition package API or the way to get a reference to oracle.reports.plugin.definition.Report instance.
    Thanks,
    Rakesh

Maybe you are looking for

  • Problem with JavaScript in URL iView

    Hi, I am facing a problem with javascript when i am trying to access my application through URL iView. In the javascript window.top is used to access the frames in the window. But the EP is not recognizing it as valid. what exctly the problem and ple

  • Loading large files in Java Swing GUI

    Hello Everyone! I am trying to load large files(more then 70 MB of xml text) in a Java Swing GUI. I tried several approaches, 1)Byte based loading whith a loop similar to pane.setText("");              InputStream file_reader = new BufferedInputStrea

  • PO creation through third system

    Hi Friends, We have one process wherein PO is created in thirdparty system & that is being created in SAP through RFC call. Middleware used is Biztalk. Now we have new third party system ( BOL) which need to do same job of PO creation. I want to know

  • Import Package Error

    Hello All, I am getting a strange behavior using Import Package to load data into BPC. I load data into BPC in both LC and USD. When I load the data first time, it accepts transactions in both LC and USD. But when I load after the initial load, it er

  • Adjusting in "Get Info" tab isn't enough

    I have been trying to consolidate my songs under their proper albums and artist names; because I have been getting music from places other than iTunes. iTunes wont put them together now, for some reason. I went through and looked at all the "Get Info