Use Authentication class

hi all,
i see when i downloaded the urlservices that there is a class
oracle.portal.provider.v1.http.Authentication
that can dynamically change attr in provider.xml
the question is where can i make use of the class ..
should i create a dynamic page and write java code in it that uses this or what?

Ahmed,
Take a look at the Yahoo External Application sample. This sample uses the Authentication class.
The Authentication class is used to authenticate your user against an existing external web application and then display the personalized contents as a portlet.
Take a look at both the Basic Authentication and External application samples and articles
Sue

Similar Messages

  • Not able to get group name by using memberof class, getting Total groups as 0 even I am member of that group.

    Not able to get group name by using memberof class, getting Total groups as 0 even I am member of that group. Through this memberof class I am trying to find full qualified name(DN) of my group.
    code I have used:
    //specify the LDAP search filter
                   String searchFilter = "(&(objectClass=user)(CN=Username))";
                   //Specify the Base for the search
                   String searchBase = "";
    Also I have used,
                 String searchFilter = "(&(objectClass=user)(CN=Username))";
                   //Specify the Base for the search
                   String searchBase = "ou=ibmgroups,o=ibm.com";
    But in both cases I am getting value for Total groups as 0.
    Code Reference:
    * memberof.java
    * December 2004
    * Sample JNDI application to determine what groups a user belongs to
    import java.util.Hashtable;
    import javax.naming.*;
    import javax.naming.ldap.*;
    import javax.naming.directory.*;
    public class memberof     {
         public static void main (String[] args)     {
              Hashtable env = new Hashtable();
              String adminName = "CN=Administrator,CN=Users,DC=ANTIPODES,DC=COM";
              String adminPassword = "XXXXXXX";
              String ldapURL = "ldap://mydc.antipodes.com:389";
              env.put(Context.INITIAL_CONTEXT_FACTORY,"com.sun.jndi.ldap.LdapCtxFactory");
              //set security credentials, note using simple cleartext authentication
              env.put(Context.SECURITY_AUTHENTICATION,"simple");
              env.put(Context.SECURITY_PRINCIPAL,adminName);
              env.put(Context.SECURITY_CREDENTIALS,adminPassword);
              //connect to my domain controller
              env.put(Context.PROVIDER_URL,ldapURL);
              try {
                   //Create the initial directory context
                   LdapContext ctx = new InitialLdapContext(env,null);
                   //Create the search controls          
                   SearchControls searchCtls = new SearchControls();
                   //Specify the search scope
                   searchCtls.setSearchScope(SearchControls.SUBTREE_SCOPE);
                   //specify the LDAP search filter
                   String searchFilter = "(&(objectClass=user)(CN=Andrew Anderson))";
                   //Specify the Base for the search
                   String searchBase = "DC=antipodes,DC=com";
                   //initialize counter to total the group members
                   int totalResults = 0;
                   //Specify the attributes to return
                   String returnedAtts[]={"memberOf"};
                   searchCtls.setReturningAttributes(returnedAtts);
                   //Search for objects using the filter
                   NamingEnumeration answer = ctx.search(searchBase, searchFilter, searchCtls);
                   //Loop through the search results
                   while (answer.hasMoreElements()) {
                        SearchResult sr = (SearchResult)answer.next();
                        System.out.println(">>>" + sr.getName());
                        //Print out the groups
                        Attributes attrs = sr.getAttributes();
                        if (attrs != null) {
                             try {
                                  for (NamingEnumeration ae = attrs.getAll();ae.hasMore();) {
                                       Attribute attr = (Attribute)ae.next();
                                       System.out.println("Attribute: " + attr.getID());
                                       for (NamingEnumeration e = attr.getAll();e.hasMore();totalResults++) {
                                            System.out.println(" " +  totalResults + ". " +  e.next());
                             catch (NamingException e)     {
                                  System.err.println("Problem listing membership: " + e);
                   System.out.println("Total groups: " + totalResults);
                   ctx.close();
              catch (NamingException e) {
                   System.err.println("Problem searching directory: " + e);
    Any help will be highly appreciated.

    Not able to get group name by using memberof class, getting Total groups as 0 even I am member of that group. Through this memberof class I am trying to find full qualified name(DN) of my group.
    code I have used:
    //specify the LDAP search filter
                   String searchFilter = "(&(objectClass=user)(CN=Username))";
                   //Specify the Base for the search
                   String searchBase = "";
    Also I have used,
                 String searchFilter = "(&(objectClass=user)(CN=Username))";
                   //Specify the Base for the search
                   String searchBase = "ou=ibmgroups,o=ibm.com";
    But in both cases I am getting value for Total groups as 0.
    Code Reference:
    * memberof.java
    * December 2004
    * Sample JNDI application to determine what groups a user belongs to
    import java.util.Hashtable;
    import javax.naming.*;
    import javax.naming.ldap.*;
    import javax.naming.directory.*;
    public class memberof     {
         public static void main (String[] args)     {
              Hashtable env = new Hashtable();
              String adminName = "CN=Administrator,CN=Users,DC=ANTIPODES,DC=COM";
              String adminPassword = "XXXXXXX";
              String ldapURL = "ldap://mydc.antipodes.com:389";
              env.put(Context.INITIAL_CONTEXT_FACTORY,"com.sun.jndi.ldap.LdapCtxFactory");
              //set security credentials, note using simple cleartext authentication
              env.put(Context.SECURITY_AUTHENTICATION,"simple");
              env.put(Context.SECURITY_PRINCIPAL,adminName);
              env.put(Context.SECURITY_CREDENTIALS,adminPassword);
              //connect to my domain controller
              env.put(Context.PROVIDER_URL,ldapURL);
              try {
                   //Create the initial directory context
                   LdapContext ctx = new InitialLdapContext(env,null);
                   //Create the search controls          
                   SearchControls searchCtls = new SearchControls();
                   //Specify the search scope
                   searchCtls.setSearchScope(SearchControls.SUBTREE_SCOPE);
                   //specify the LDAP search filter
                   String searchFilter = "(&(objectClass=user)(CN=Andrew Anderson))";
                   //Specify the Base for the search
                   String searchBase = "DC=antipodes,DC=com";
                   //initialize counter to total the group members
                   int totalResults = 0;
                   //Specify the attributes to return
                   String returnedAtts[]={"memberOf"};
                   searchCtls.setReturningAttributes(returnedAtts);
                   //Search for objects using the filter
                   NamingEnumeration answer = ctx.search(searchBase, searchFilter, searchCtls);
                   //Loop through the search results
                   while (answer.hasMoreElements()) {
                        SearchResult sr = (SearchResult)answer.next();
                        System.out.println(">>>" + sr.getName());
                        //Print out the groups
                        Attributes attrs = sr.getAttributes();
                        if (attrs != null) {
                             try {
                                  for (NamingEnumeration ae = attrs.getAll();ae.hasMore();) {
                                       Attribute attr = (Attribute)ae.next();
                                       System.out.println("Attribute: " + attr.getID());
                                       for (NamingEnumeration e = attr.getAll();e.hasMore();totalResults++) {
                                            System.out.println(" " +  totalResults + ". " +  e.next());
                             catch (NamingException e)     {
                                  System.err.println("Problem listing membership: " + e);
                   System.out.println("Total groups: " + totalResults);
                   ctx.close();
              catch (NamingException e) {
                   System.err.println("Problem searching directory: " + e);
    Any help will be highly appreciated.

  • Error: SHA1 digest error for javax/mail/Authenticator.class

    I am using javax.mail api to sending emails.
    when I calls main method of the class to send email its works perfect, but when I imports the same class in jsp its shows me above said error.
    My email server requires authentication before sending mails.
    please guide me how to use this class in jsp .
    class code is as below :
    =========================
    import javax.mail.*;
    import javax.mail.internet.*;
    import java.util.*;
    import java.io.*;
    public class SendMailUsingAuthentication
    private static final String SMTP_HOST_NAME = "myserver.smtphost.com";
    private static final String SMTP_AUTH_USER = "myusername";
    private static final String SMTP_AUTH_PWD = "mypwd";
    private static final String emailMsgTxt = "Online Order Confirmation Message. Also include the Tracking Number.";
    private static final String emailSubjectTxt = "Order Confirmation Subject";
    private static final String emailFromAddress = "[email protected]";
    // Add List of Email address to who email needs to be sent to
    private static final String[] emailList = {"[email protected]", "[email protected]"};
    public static void main(String args[]) throws Exception
    SendMailUsingAuthentication smtpMailSender = new SendMailUsingAuthentication();
    smtpMailSender.postMail( emailList, emailSubjectTxt, emailMsgTxt, emailFromAddress);
    System.out.println("Sucessfully Sent mail to All Users");
    public void postMail( String recipients[ ], String subject,
    String message , String from) throws MessagingException
    boolean debug = false;
    //Set the host smtp address
    Properties props = new Properties();
    props.put("mail.smtp.host", SMTP_HOST_NAME);
    props.put("mail.smtp.auth", "true");
    Authenticator auth = new SMTPAuthenticator();
    Session session = Session.getDefaultInstance(props, auth);
    session.setDebug(debug);
    // create a message
    Message msg = new MimeMessage(session);
    // set the from and to address
    InternetAddress addressFrom = new InternetAddress(from);
    msg.setFrom(addressFrom);
    InternetAddress[] addressTo = new InternetAddress[recipients.length];
    for (int i = 0; i < recipients.length; i++)
    addressTo[i] = new InternetAddress(recipients);
    msg.setRecipients(Message.RecipientType.TO, addressTo);
    // Setting the Subject and Content Type
    msg.setSubject(subject);
    msg.setContent(message, "text/plain");
    Transport.send(msg);
    * SimpleAuthenticator is used to do simple authentication
    * when the SMTP server requires it.
    private class SMTPAuthenticator extends javax.mail.Authenticator
    public PasswordAuthentication getPasswordAuthentication()
    String username = SMTP_AUTH_USER;
    String password = SMTP_AUTH_PWD;
    return new PasswordAuthentication(username, password);

    Find all the jar files under Tomcat's installation directory and all the jar files in the jre/lib/ext directory.
    Make sure only one of them includes javax.mail.* classes.
    Note that setting CLASSPATH to a directory does not cause all jar files in that directory to be loaded.
    Finally, make sure Eclipse isn't copying the class files out of mail.jar and packaging them with your
    application.

  • Need info on using Kerberos classes

    Does anybody know, offhand, a decent site that maybe has a tutorial or some explanation about how to use the Kerberos authentication classes that come with the JDK? I haven't looked around yet, but I was wondering if somebody knew a good place.
    Thanks,
    Jason

    if you go to the top of this page you will notice a search engine, type in Kerberos classes and presto, you will get a result, i am sure if you were to do the same on the google homepage you would be suprised to see many websites with the info you seek.

  • Code for mailing from behing a proxy using Authentication

    Dear friends,
    I have found several requests regarding the mailing from behing a firewall/proxy with Authentication.. So here is the entire code for the same..
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    import java.util.*;
    import javax.mail.*;
    import javax.mail.event.*;
    import javax.mail.internet.*;
    public class MailClient extends Frame{
    static String mailHost="proxyAddress";
    public MailClient() {
    public static void main(String[] args) {
    Properties properties=new Properties();
    properties.put("mail.smtp.host",mailHost);
    properties.put("mail.smtp.auth","true");
    Session session=Session.getDefaultInstance(properties,new MyAuthentication());
    try{
    Message msg=new MimeMessage(session);
    InternetAddress address[]={new InternetAddress("toAddress1.domain.com")};
    msg.setRecipients(Message.RecipientType.TO,address);
    msg.setSubject("Test Mail");
    msg.setFrom(new InternetAddress("[email protected]"));
    msg.setContent("Please reply.. This is a java mail using Authentication
    technique..","text/plain");
    Transport transport=session.getTransport("smtp");
    transport.connect();
    transport.sendMessage(msg,msg.getAllRecipients());
    }catch(Exception e){e.printStackTrace();}
    Hope this helps..
    regards Stallon
    class MyAuthentication extends Authenticator{
    public PasswordAuthentication getPasswordAuthentication(){
    return new PasswordAuthentication("userName","password");
    }

    Hi stallon,
    Thanks for ur reply.Actually my application is at server2. I have an account in server1 and sending mail from server2. server1 requires authentication to send it to server3. Though we provide it is not accepting.There no errors while execution but mail couldn't be send.
    Please help me as soon as possible.
    Thanks in advance,
    bdurvasula
    //debug code.
    DEBUG: getProvider() returning
    javax.mail.Provider[TRANSPORT,smtp,com.sun.mail.smtp.SMTPTransport,Sun
    Microsystems, Inc]
    DEBUG SMTP: useEhlo true, useAuth true
    DEBUG: SMTPTransport trying to connect to host
    "host", port 25
    DEBUG SMTP RCVD: 220 host ESMTP
    server (Netscape Messaging Server - Version 3.6)
    ready
    Thu, 21 Jun 2001 14:23:15 +0800
    DEBUG: SMTPTransport connected to host
    "host", port: 25
    DEBUG SMTP SENT: EHLO rao
    DEBUG SMTP RCVD: 250-host
    250-HELP
    250-EXPN
    250-ETRN
    250-PIPELINING
    250-DSN
    250 AUTH=LOGIN
    DEBUG SMTP SENT: MAIL FROM:<[email protected]>
    DEBUG SMTP RCVD: 250 Sender
    <[email protected]>
    Ok
    DEBUG SMTP SENT: RCPT TO:<[email protected]>
    DEBUG SMTP RCVD: 250 Recipient
    <[email protected]> Ok
    Verified Addresses
    [email protected]
    DEBUG SMTP SENT: DATA
    DEBUG SMTP RCVD: 354 Ok Send data ending with
    <CRLF>.<CRLF>
    DEBUG SMTP SENT:
    DEBUG SMTP RCVD: 250 Message received:
    7745C8DA90B.AAA27D7
    DEBUG SMTP SENT: QUIT
    //now i am sending the mail that was sent by my server
    This Message was undeliverable due to the following
    reason:
    Your message was not delivered because the
    destination
    computer
    refused to accept it. The error message generated
    by
    the server
    is reproduced below.
    Non-local addressee. We do not relay!
    Please reply to Postmaster@mailserver .if you feel
    this message to be in error.Thanks once again
    bdurvasula

  • Logon failure: unknown user name or bad password... ?Authenticator class?

    I'm connecting to a MS Exchange server (internally) but I'm getting the following error:
    ........Non SSL........
    POP3: connecting to host "xxxx.xxx.com", port 110
    S: +OK Microsoft Exchange POP3 server version 5.5.2658.25 ready
    C: USER [email protected]
    S: +OK
    C: PASS
    S: -ERR Logon failure: unknown user name or bad password.
    C: QUIT
    S: +OK Microsoft Exchange POP3 server version 5.5.2658.25 signing off
    test2 :: javax.mail.AuthenticationFailedException: Logon failure: unknown user name or bad password.
    I can get my email using Outlook because I don't have to provide a password to connect. So I left it blank in my program but I still can't
    login. Does this mean that I need to use the authenticator class?
    Here's the code I'm using to connect:
    public class ListMailSubjectLines
         private static void ListMailSubjectsLines()
              try
                   Properties pop3Props = new Properties();     
                     Session session = null;
                     Store store = null;
                   pop3Props.put("mail.pop3.host","xxxx.xxx.com");
                   pop3Props.put("mail.user","[email protected]");
                   pop3Props.setProperty("mail.passwd","");
                   //     String host = "";
                   //     String username = "";
                   //     String password = "";
                     if((pop3Props.getProperty("mail.pop3.ssl") != null) && (pop3Props.getProperty("mail.pop3.ssl").equalsIgnoreCase("true")))
                        System.out.println("........SSL........");
                           String SSL_FACTORY = "javax.net.ssl.SSLSocketFactory";
                           pop3Props.setProperty("mail.pop3.socketFactory.class", SSL_FACTORY);
                           pop3Props.setProperty("mail.pop3.socketFactory.fallback", "false");
                           String portStr = ((pop3Props.getProperty("mail.pop3.port") != null) ? pop3Props.getProperty("mail.pop3.port") : "110");
                           pop3Props.setProperty("mail.pop3.port",  portStr);
                           pop3Props.setProperty("mail.pop3.socketFactory.port", portStr);
                           URLName url = new URLName("pop3://"+pop3Props.getProperty("mail.user")+":"+pop3Props.getProperty("mail.passwd")+"@"+pop3Props.getProperty("mail.host")+":"+pop3Props.getProperty("mail.pop3.port"));
                           session = Session.getInstance(pop3Props, null);
                           store = new POP3SSLStore(session, url);
                     else
                          System.out.println("........Non SSL........");
                           session = Session.getInstance(pop3Props, null);
                           store = session.getStore("pop3");
    session.setDebug(true);
                   store.connect(pop3Props.getProperty("mail.host"), pop3Props.getProperty("mail.user"), pop3Props.getProperty("mail.passwd"));
                     //store.connect(host, username, password);
                     Folder folder = store.getFolder("INBOX");
                     folder.open(Folder.READ_WRITE);
                     Message[] Msgs = folder.getMessages();
                     for(int i = 0; i < Msgs.length; i++)
                       System.out.println(Msgs.getSubject());
                   folder.close(true);
                   store.close();
                   System.out.println(Msgs[0].getSubject() + "test");
                   catch(NoSuchProviderException ec)
                        System.out.println("test1");
                   catch(MessagingException em)
                        System.out.println("\ntest2 :: " + em);
         public static void main( String args[] )
                   ListMailSubjectsLines();
    Thanks,
    ls6

    In case anyone wants to see the format and the final code here it is:
    Login name format:
    pop3Props.setProperty("mail.user","TEST_DOMAIN\\UserID\\mailboxID");
    Code
    import com.sun.mail.pop3.POP3SSLStore;
    import javax.mail.URLName;
    import javax.mail.Session;
    import javax.mail.Store;
    import javax.mail.Folder;
    import javax.mail.Message;
    import javax.mail.NoSuchProviderException;
    import javax.mail.MessagingException;
    import java.util.Properties;
    public class ListMailSubjectLines
         private static void ListMailSubjectsLines()
              try
              Properties pop3Props = new Properties();     
                Session session = null;
              Store store = null;                 
              pop3Props.put("mail.pop3.host","mailHOST");
              pop3Props.setProperty("mail.user","TEST_DOMAIN\\UserID\\mailboxID");
              pop3Props.setProperty("mail.passwd","passWord");               
                if((pop3Props.getProperty("mail.pop3.ssl") != null) && (pop3Props.getProperty("mail.pop3.ssl").equalsIgnoreCase("true")))
                   System.out.println("### SSL ###");
                      String SSL_FACTORY = "javax.net.ssl.SSLSocketFactory";
                      pop3Props.setProperty("mail.pop3.socketFactory.class", SSL_FACTORY);
                      pop3Props.setProperty("mail.pop3.socketFactory.fallback", "false");
                      String portStr = ((pop3Props.getProperty("mail.pop3.port") != null) ? pop3Props.getProperty("mail.pop3.port") : "110");
                      pop3Props.setProperty("mail.pop3.port",  portStr);
                      pop3Props.setProperty("mail.pop3.socketFactory.port", portStr);
                      URLName url = new URLName("pop3://"+pop3Props.getProperty("mail.user")+":"+pop3Props.getProperty("mail.passwd")+"@"+pop3Props.getProperty("mail.pop3.host")+":"+pop3Props.getProperty("mail.pop3.port"));
                      session = Session.getInstance(pop3Props, null);
                      store = new POP3SSLStore(session, url);
                else
                     System.out.println( "### Non SSL ###" );
                      session = Session.getInstance( pop3Props, null );
                      store = session.getStore( "pop3" );
    //System.out.println(session.getStore());
    session.setDebug( true );
                   store.connect(pop3Props.getProperty( "mail.host" ), pop3Props.getProperty("mail.user"), pop3Props.getProperty("mail.passwd"));
                   if( store.isConnected() )
                           System.out.println( "\nCONNECTED\n" );
                   Folder folder = store.getDefaultFolder();
                   folder = folder.getFolder( "INBOX" );
                   folder.open( Folder.READ_WRITE );
                   Message[] Msgs = folder.getMessages();
                   for( int i = 0; i < Msgs.length; i++ )
                                         System.out.println( Msgs.getSubject() );
                   folder.close( true );
                   store.close();
              Folder folder = store.getFolder( "INBOX" );
              //Folder folder = store.getDefaultFolder();
              //folder = folder.getFolder( "INBOX" );
              folder.open( Folder.READ_ONLY );
              Message[] Msgs = folder.getMessages();
              for( int i = 0; i < Msgs.length; i++ )
                   System.out.println( folder.getUnreadMessageCount() );
                   System.out.println( Msgs[i].getSubject() );
                   System.out.println( Msgs[i].getContentType() );
                   System.out.println( Msgs[i].getSize() );
              folder.close( true );
              store.close();
              catch(NoSuchProviderException nSPE)
                   System.err.print( "### Line[88] ### " );
                   System.err.println( nSPE );
              catch(MessagingException mE)
                   System.err.print( "### Line[93] ### " );
                   System.err.println( mE );
    public static void main( String args[] )
              ListMailSubjectsLines();

  • Using List Class in java.awt / java.util ?

    have a program that:
    import java.util.*;
    List list = new LinkedList();
    list = new ArrayList();
    ... read a file and add elements to array
    use a static setter
    StaticGettersSetters.setArray(list);
    next program:
    import java.awt.*;
    public static java.util.List queryArray =
    StaticGettersSetters.getArray();
    If I don't define queryArray with the package and class, the compiler
    gives an error that the List class in java.awt is invalid for queryArray.
    If I import the util package, import java.util.*; , the compiler
    gives an error that the list class is ambiguous.
    Question:
    If you using a class that exists in multiple packages, is the above declaration of queryArray the only way to declare it ?
    Just curious...
    Thanks for your help,
    YAM-SSM

    So what you have to do is explicitly tell the compiler which one you really want by spelling out the fully-resolved class name:
    import java.awt.*;
    import java.sql.*;
    import java.util.*;
    public class ClashTest
        public static void main(String [] args)
            java.util.Date today    = new java.util.Date();
            java.util.List argsList = Arrays.asList(args);
            System.out.println(today);
            System.out.println(argsList);
    }No problems here. - MOD

  • Creating a triangle using polygon class problem, URGENT??

    Hi i am creating a triangle using polygon class which will eventually be used in a game where by a user clicks on the screen and triangles appear.
    class MainWindow extends Frame
         private Polygon[] m_polyTriangleArr;
                       MainWindow()
                              m_nTrianglesToDraw = 0;
             m_nTrianglesDrawn = 0;
                             m_polyTriangleArr = new Polygon[15];
                             addMouseListener(new MouseCatcher() );
            setVisible(true);
                         class MouseCatcher extends MouseAdapter
                             public void mousePressed(MouseEvent evt)
                  Point ptMouse = new Point();
                  ptMouse = evt.getPoint();
                if(m_nTrianglesDrawn < m_nTrianglesToDraw)
                                int npoints = 3;
                        m_polyTriangleArr[m_nTrianglesDrawn]
                      = new Polygon( ptMouse[].x, ptMouse[].y, npoints);
    }When i compile my code i get the following error message:
    Class Expected
    ')' expectedThe two error messages are refering to the section new Polygon(....)
    line. Please help

    Cannot find symbol constructor Polygon(int, int, int)
    Can some one tell me where this needs to go and what i should generally
    look like pleaseI don't think it is a good idea to try and add the constructor that the compiler
    can't find. Instead you should use the constructor that already exists
    in the Polygon class: ie the one that looks like Polygon(int[], int[], int).
    But this requires you to pass two int arrays and not two ints as you
    are doing at the moment. As you have seen, evt.getPoint() only supplies
    you with a single pair of ints: the x- and y-coordinates of where the mouse
    button was pressed.
    And this is the root of the problem. To draw a triangle you need three
    points. From these three points you can build up two arrays: one containing
    the x-coordinates and one containing the y-coordinates. It is these two
    arrays that will be used as the first two arguments to the Polygon constructor.
    So your task is to figure out how you can respond to mouse presses
    correctly, and only try and add a new triangle when you have all three of its
    vertices.
    [Edit] This assumes that you expect the user to specify all three vertices of the
    triangle. If this isn't the case, say what you do expect.

  • Uploading bitmapData using FileReference class ?

    Hi gurus ;)
    Question nr 1.
    Is it possibly to upload bitmapData to server using
    FileReference class ? How should i approach this issue, is there
    any ready classes available for this purpose. I'm generating
    bitmaps inside my Flash/Flex App and need to store them under users
    profile in server.
    Question nr 2.
    Can i upload files from remote server to another using
    FileReference class
    e.g Somehow like :
    uploadURL = new URLRequest();
    uploadURL.url = "
    http://www.[yourDomain
    fileURL.url = "
    http://www.myLocation.com/myfile.JPG";
    file = new FileReference(fileURL.url);
    file.upload(uploadURL);
    This is just an idea, sure not working ;)
    Any ideas are helpful
    Thx
    iquaaani

    I did a small application that uploads a file to the server
    every hour. If the server response that a login is required to
    upload the file, it goes to a login page to do the login and
    retried to upload the file.
    I got the server response in order to know if the file did
    upload correctly or not (I have to send more form data than just
    the file). I didn't try the mime type since it's not relevant for
    my application and usualy this information is not very trust worthy
    anyways.
    I'm not sure what you mean with exceptions, if you are
    referring to HTTP errors, I think there is an event for that, but I
    used the IOError event for this, and it seems to work good
    also.

  • Problem with constructors and using public classes

    Hi, I'm totally new to Java and I'm having a lot of problems with my program :(
    I have to create constructor which creates bool's array of adequate size to create a sieve of Eratosthenes (for 2 ->n).
    Then it has to create public method boolean prime(m) which returs true if the given number is prime and false if it's not prime.
    And then I have to create class with main function which chooses from the given arguments the maximum and creates for it the sieve
    (using the class which was created before) and returns if the arguments are prime or not.
    This is what I've written but of course it's messy and it doesn't work. Can anyone help with that?
    //part with a constructor
    public class ESieve {
      ESieve(int n) {
    boolean[] isPrime = new boolean[n+1];
    for (int i=2; i<=n; i++)
    isPrime=true;
    for(int i=2;i*i<n;i++){
    if(isPrime[i]){
    for(int j=i;i*j<=n;j++){
    isPrime[i*j]=false;}}}
    public static boolean Prime(int m)
    for(int i=0; i<=m; i++)
    if (isPrime[i]<2) return false;
    try
    m=Integer.parseInt(args[i]);
    catch (NumberFormatException ex)
    System.out.println(args[i] + " is not an integer");
    continue;
    if (isPrime[i]=true)
    System.out.println (isPrime[i] + " is prime");
    else
    System.out.println (isPrime[i] + " is not prime");
    //main
    public class ESieveTest{
    public static void main (String args[])
    public static int max(int[] args) {
    int maximum = args[0];
    for (int i=1; i<args.length; i++) {
    if (args[i] > maximum) {
    maximum = args[i];
    return maximum;
    new ESieve(maximum);
    for(int i=0; i<args.length; i++)
    Prime(i);}

    I've made changes and now my code looks like this:
    public class ESieve {
      ESieve(int n) {
       sieve(n);
    public static boolean sieve(int n)
         boolean[] s = new boolean[n+1];
         for (int i=2; i<=n; i++)
    s=true;
    for(int i=2;i*i<n;i++){
    if(s[i]){
    for(int j=i;i*j<=n;j++){
    s[i*j]=false;}}}
    return s[n];}
    public static boolean prime(int m)
    if (m<2) return false;
    boolean x = sieve(m);
    if (x=true)
    System.out.println (m + " is prime");
    else
    System.out.println (m + " is not prime");
    return x;}
    //main
    public class ESieveTest{
    public static int max(int[] args) {
    int maximum = args[0];
    for (int i=1; i<args.length; i++) {
    if (args[i] > maximum) {
    maximum = args[i];
    return maximum;
    public static void main (String[] args)
    int n; int i, j;
    for(i=0;i<=args.length;i++)
    n=Integer.parseInt(args[i]);
    int maximum=max(args[]);
    ESieve S = new ESieve(maximum);
    for(i=0; i<args.length; i++)
    S.prime(i);}
    It shows an error for main:
    {quote} ESieveTest.java:21: '.class' expected
    int maximum=max(args[]); {quote}
    Any suggestions how to fix it?                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

  • End of Page event in ALV report using SALV class[cl_salv_hierseq_table]

    Hi ,
    have been working on a ALV report using the class SALV cl_salv_hierseq_table
    I am facing few issues pertaining to two things:
    1. Displaying some subtotal text along with the subtotals.
    Example refer the standard demo example: SALV_DEMO_HIERSEQ_FORM_EVENTS
    Now instead of A 17 and A26 I would like to show text like Subtotal for the Carrid.for subtotals and grand totals
    Like   Subtotal for A 17 is :      XXXXXXX
              GrandTotal is         :      YYYYYY
    2. We have a page break and a new page for every purchasing group as in the standard example SALV_DEMO_HIERSEQ_FORM_EVENTS for CARRID.
    I need to display some variable values as number of documents ,total number of records etc at the end of each CARRID group before a new page starts for the next CARRID.Please note i do not want it on every page.it should only be diaplyed at the end of page whose next page would be for next CARRID.[basically at end of every carrid]Example:after displaying all details for AA need to display the number of records for that carrid at the end of the page[as page break is based on CARRID]/
    Thanks
    Jyotsna

    at end of page event, for CL_SALV_EVENTS_HIERSEQ, has some useful parameters allowing to know where you are at the time of event
    parameter VALUE is of type CL_SALV_FORM which contains public attribute IF_SALV_FORM~ACCDESCRIPTION; you can slo get contents of it
    about text of total/subtotal, this is normally set in the layout

  • Use of classes Vs tables

    Hi All,
    I have e requirement where i need to select data from tables....... It was told to me that i can make use of classes instead of tables...... I am working on Inbound delivery in EWMmodule.......
    can any one through some light on this....... how can i make use of classes to get data from sap tables.........
    Regards,
    Poonam

    Hi Faisal,
    Just to correct you it's "Methods of Global Persistent Classes".
    Not to hide my ignorance in OOPs, but i don't think persistent classes should be used for mundane selects. It's much easier to write, maintain & troubleshoot a select construct than a persistent class
    You can go through this discussion on: Why do we need Persistent Classes ?
    BR,
    Suhas

  • Help using scanner class to count chars in file

    Hi all, I am learning Java right now and ran into a problem. I need to use the Scanner class to accurately count the number of chars in a file including the line feed chars 10&13.
    This what I have and it currently reports a 201 byte file as having 194 chars:
         File file = new File(plainFile);
         Scanner inputFile = new Scanner(file);
         numberOfChars = 0;
         String line;
         //count characters in file
         while (inputFile.hasNextLine())
              line = inputFile.nextLine();
              numberOfChars += line.length();
    I know there are other ways using BufferedReader, etc but I have to use Scanner class to do this.
    Thanks in advance!

    raichle wrote:
    Wow guys, thanks for the help! I've got a RTFMWell, what's wrong to have a look at the API docs for the Scanner class?
    and directions that go against the specs I said.Is that so strange to suggest a better option? What if I ask a carpenter "how do I build a table with a my stapler?". Should I give the man an attitude if he tells me I'd better use a saw and hammer?
    I'm also aware that it "eats" those chars and obviously looking for a way around that.
    I've looked through the java docs, but as I said, I'm new to this and they're difficult to understand. The class I am auditing req's that this be done using Scanner, but I don't see why you demand an explanation.
    Can anybody give me some constructive help?Get lost?

  • Customizing FD01 and FB70 using PS Class and Characteristics

    Hello SAP Experts
    I have the following issue:
    My client has a requirement where we need to customize the Customer Master  (FD01) screen and the Invoice Posting Screen (FB70). A few additional fields have to be added by creating a separate tab. I was intending to take Abaper's help and do this using user exits but I have been suggested by the cleint to use SAP PS Class and Characteristics feature to do this. Can someone please throw some light on this feature and how can i create custom fields on FD01 and FB70 screens. Is there a way we could customize these screens using PS class and characteristics. Your opinions would be much appreciated.
    Please kindly give your suggestions. Thanks in advance
    Regards,
    Nik

    Joao Paulo,
    Thank you for the response. I have tried to obtain some info from OSS but no luck. Tried all means but there is limited information available.
    Nik

  • How to use aggregation -Average using a class

    Hi Gurus,
       In my report i have used cl_salv_table  and for event i have used cl_salv_events_table, now i want to calculate average for some of the fields as such subtotal calculation . In my normal alv reports i have used the class lcl_event_receiver also, but for the report which iam using a class , i d'not know how to compain both the class  (i.e) cl_salv_table, class lcl_event_receiver. Help me to solve the problem.

    cancelled

Maybe you are looking for

  • How to manage 2 Ipods on one PC?

    I have now 3 Ipods (one Video 60GB and two 4GB Nano, It's a long laundry story related) Can I assign specific songs to one Ipod (for example "Classical" to the 60GB) and assign other specific songs to another Ipod (for example "Techno" on one of the

  • Mac or PC?

    It's time to upgrade and I am just stumped! I've been using PC's all of my life but I keep hearing about how Macs work great. My question is: As it relates to Adobe CS6; Which is better - Mac or PC? I'm using some of everything.

  • Excise error in record

    Hi Experts, My user made a billing document for deemend export in which customer is ED EXEMPT CT3. so there will be no excise duty paid by him.this is the standards scenerio. Now my question is in (one billing document JEX2-A/R BASIC EXCISE showing v

  • Starting Reports Services... 10g AS 10.1.2.0.2

    Hey guys :) Just installed the stand alone forms and reports AS for 10g. When I was using developer suite, it was used to running a batch file that started the reports service.. it executed the command line below: rwserver server= repsrv1 My question

  • Set character encoding for data template xml output

    Hello everyone, in my data template, I have defined the header as <?xml version="1.0" encoding="WINDOWS-1256"?> but when output is generated, it is returned as: <?xml version="1.0" encoding="UTF-8"?> Is there a way for me to force the WINDOWS-1256 en