Java Redirects

Hi,
I have a need to conditionally navigate from a remote web page
which contains some html, some Java, and a signed java
applet, to a local html file. The condition will be based off of
a flag that I determine at run-time in a Java function; when the
condition is true, I want to redirect to something local, and
when the condition is false, I want to redirect to something
remote.
So far, we've tried document.write'ing various things from the the
javascript code (like adding a 0-second redirect, or adding a
'location.href = http://blahblahblah.com'.
I moved on to Java, where I've tried to change location by accessing the DOM through JSObject and by trying various incantations to
getAppletContext().showDocument(). I was hoping that by running
in a secure context (from a SIGNED applet) I'd be able to
bypass these issues, but it doesn't help us directly. We can,
however, with the help of Java, run the browser from the command-
line with the new URL, and that will (sometimes) help us do what
we need, but it seems like a lot to go through to change a
simple URL.
Is there a blessed way to do this, or does this expose some
strange security issue?
TIA

I'm sure it's security. You can't have an href that points to a local resource because clicking that would entail executing that resource. And that would be totally insecure.

Similar Messages

  • Java Redirection Applet

    Hi
    I found this script:
    <script language='JAVASCRIPT' type='TEXT/JAVASCRIPT'>
    <!--
    if ((navigator.appName=="Microsoft Internet Explorer") || (navigator.appName=="Netscape"))
    if (navigator.appName=="Microsoft Internet Explorer")
    window.location = "pc/index.htm";
    else
    window.location = "pc/index.htm";
    else
    window.location = "phone/index.htm";
    //--></script>
    Unfortunately, it's in Javascript and I need it in Java.
    Does anybody know the Java code for this Javascript code? I hope you guys can help me, I'm looking for the Java Redirect Applet for more than two weeks now without results.
    Thanks

    the browser type you can probably use:
    System.getProperty("http.agent");
    But it won't return exactly those same strings.
    For the window.location part, you use the applet method "showDocument()"

  • X4200M2 Java Redirection doesn't work

    We recently received 4 servers. 1 server came with ILOM 1.0.1 (I think) and it was the first I set up. The Java redirection worked great! Ever since I upgraded to ILOM 1.1.1 the Java redirection has not worked. On shipping ILOM, when I chose 8 or 16 bit color, Safari had me download a jnlp file which when double-clicked, opened Java and prompted me for my ILOM password, etc. Since the upgrade to the newest version, when I click "Launch Redirection" (regardless of 8 or 16 bit) the ILOM's webserver hangs and it unresponsive. The only way I know how to get it to come back up is by pulling out the power plugs. How can I get Java redirection working again? Should I downgrade my ILOM and firmware?
    Edit: I see that this is a known issue. Guess I'll wait for the next release...
    Message was edited by:
    aivey06

    Hi,
    I have the same issue with a X4100 M2 server, the only way to access the remote console is by writing directly the URL.
    Where did you see is a known issue? I have some other problem like, for some reason, the letter 'b' is sent continuously

  • Finding Java Redirect Target Code

    Hello,
    I am searching for a code that can redirect a targeted page, for example if I have index.html on one tab and I open a new one, the index.html have the name: Index.Home and with the other tab I open say; redirection.html, I want it to target index.html by its name or file name (index.html/either is fine) and the change it to the site I enter in the code (example if I entered http://google.ca/ = it would redirect index.html to google.ca).
    Is there such Java Code? Is there a Similar Code? Is there even a HTML Code? (I have attempted to find all of the named, mostly HTML)

    TroyErvin wrote:
    I have searched google a million times I still do not understand, I need a full code, with the target factor in it, but I can't find it. with google or yahoo.Yeah, looks like you are looking at the wrong technology (you probably want JavaScript) and haven't done a very good job of choosing Google search terms.
    Try again with different search terms this time realizing you don't need Java (or even JavaScript).

  • Our java (redirects) which worked with 4.1sp9; don't work with 6.0sp3... why?

     

    Sharmin,
    When I changed the Start script from
    PRODUCT_BIN=uxwdog to
    PRODUCT_BIN=ns-httpd
    The server instance won't start. It gives the following error:
    start failed. (2: unknown early startup error)
    ./ns-httpd: illegal option - - e
    Usage: ./ns-httpd [-v] [-f conf_file] [-d conf_dir]
    Does this look familiar?
    Thanks,
    Steve

  • SSL termination and redirect

    We have moved SSL termination to a loadbalancer (F5) from the Sun webservers. The load balancer after terminating SSL goes to the http listener on the webservers. We have some NSAPI code that does a redirect. It used to do the redirect based on the original scheme of the listener (if http then the redirect was http based. If https then redirect https). Of course, now all redirects come back http even though the user may have an https session.
    For weblogic we can feed a header from the F5 (WL-PROXY-SSL) and it would recognize that a load balancer was used for SSL termination and perform java redirects using the correct scheme. Is there any header like this I can feed to the Sun Webserver so it recognizes that a loadbalancer has terminated the SSL session and any redirects should be https?

    It might be easiest to configure separate HTTP listeners (e.g. separate ports) for SSL and non-SSL requests. You can configure which scheme should be used in self-referencing URLs (such as those used in redirects) per HTTP listener. In Sun Java System Web Server 7.0, you can do that using the admin GUI, CLI, or by editing the server.xml configuration. If you edit server.xml, you need to specify the <server-name> element in the appropriate <http-listener> element.

  • Calling an Abap Web Service from IBM WebSphere with a MYSAPSSO2 Cookie

    Hello,
    I have the following problem :
    I have to develop a proof of concept between IBM Web Sphere 5.1 and SAP AS JAVA 7.0.
    I have created an IBM sevlet in Web Sphere, I use a specific redirect from an SAP AS Java to call it, this way I can have a SAP Logon Ticket, and I manage to call an ABAP module function with JCO with SSO.
    Scenario 1 : browser  + authentication --> AS Java redirect servlet MYSAPSSO2 cookie -> IBM WebSphere servlet JCO -> Abap module function (ECC5)
    This scenario works fine.
    I have to do the same scenario with a Web Service and I don't know what to do.
    I try to use jax-rpc handlers but I don't know how to pass my cookie from my servlet to my handler.
    Scenario 2 : browser + authentication --> AS Java redirect servlet MYSAPSSO2 cookie -> IBM WebSphere servlet JCO -> Abap Web Service (ECC5)
    Has someone already done that  ?
    Regards,  Julien.

    Julien,
    Why are you using 5.1....go for 6.0 and its cake walk, i have integrated WebSphere 6.0 with R/3 uysing xi.....in a week.
    Scenario changed to:--
    Browser+ authentication --> WebSphere AS servlet request --> XI --> RFC/bapi --> abap webService
    Hope that helps
    Regards
    Ravi

  • Would like to redirect java error ExceptionHelper.java

    Hi All,
    I think this might be the right forum... anyway, I'd like to redirect this java exception handler to a different URL. Pretty simple.
    I've tried this line of code, but I can't compile... might just be in the wrong place, line 348 :
    response.sendRedirect(response.encodeRedirectURL('http://dev.sheridan.edu/uportal/errors/') );This is the whole exception file. Thank youf or your help.. I'm a newbie...
    * Copyright � 2001 The JA-SIG Collaborative.  All rights reserved.
    * Redistribution and use in source and binary forms, with or without
    * modification, are permitted provided that the following conditions
    * are met:
    * 1. Redistributions of source code must retain the above copyright
    *    notice, this list of conditions and the following disclaimer.
    * 2. Redistributions in binary form must reproduce the above copyright
    *    notice, this list of conditions and the following disclaimer in
    *    the documentation and/or other materials provided with the
    *    distribution.
    * 3. Redistributions of any form whatsoever must retain the following
    *    acknowledgment:
    *    "This product includes software developed by the JA-SIG Collaborative
    *    (http://www.jasig.org/)."
    * THIS SOFTWARE IS PROVIDED BY THE JA-SIG COLLABORATIVE "AS IS" AND ANY
    * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
    * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
    * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE JA-SIG COLLABORATIVE OR
    * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
    * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
    * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
    * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
    * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
    * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
    * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
    * OF THE POSSIBILITY OF SUCH DAMAGE.
    package org.jasig.portal;
    import java.io.PrintWriter;
    import java.util.ArrayList;
    import java.util.Iterator;
    import java.util.List;
    import javax.servlet.http.HttpServletResponse;
    import org.apache.commons.logging.Log;
    import org.apache.commons.logging.LogFactory;
    public class ExceptionHelper {
        private static final Log log = LogFactory.getLog(ExceptionHelper.class);
        // List of strings to match in traceback for various containers
         // This array must be expanded as additional Application Server
         // containers become better known
        public static final String boundaries[] =
                  "at javax.servlet.http.HttpServlet."
         * Generate traceback only to the Servlet-container interface.
         * @param ex any throwable exception
         * @return stack trace string without container layers
        public static String shortStackTrace(Throwable ex) {
             if (ex == null)
                  return "";
            java.io.StringWriter sw = new java.io.StringWriter();
            ex.printStackTrace(new java.io.PrintWriter(sw));
            sw.flush();
            String stktr = sw.toString();
            return trimStackTrace(stktr);
         * Trims a String representation of a Stack Trace to remove
         * the portion of the trace that is in the servlet container layer.
         * @param stackTrace - String result of printStackTrace
         * @return the stack trace with portions of the trace that dive into the container
         * layer removed.
        static String trimStackTrace(String stackTrace) {
            StringBuffer trimmedTrace = new StringBuffer();
            // a List of Strings to be trimmed and appended to the buffer
            // these represent elements in the causal chain
            List fragments = new ArrayList();
            int causeCut = (stackTrace.indexOf("Caused by"));
            if (causeCut > 0) {
                // there are one or more Caused by fragments to consider
                // we traverse stackTrace, parsing out fragments for later processing
                // and updating stackTrace to contain the remaining unparsed portion
                // as we go
                while (stackTrace.length() > 0) {
                    if (stackTrace.startsWith("Caused by")){
                        // don't count the "Caused by" leading the stackTrace
                        causeCut = stackTrace.substring(9).indexOf("Caused by");
                        if (causeCut > 0)
                            causeCut += 9;
                    } else {
                        causeCut = stackTrace.indexOf("Caused by");
                    if (causeCut > -1) {
                        // stackTrace currently includes multiple fragments
                        // parse out the first and leave the rest for next iteration
                        fragments.add(stackTrace.substring(0, causeCut));
                        stackTrace = stackTrace.substring(causeCut);
                    } else {
                        // stackTrace currently is a bare fragment
                        // grab it
                        fragments.add(stackTrace);
                        stackTrace = "";
            } else {
                // there's ony a single Throwable in the chain
                fragments.add(stackTrace);
            // now that we have fragments to consider
            for (Iterator iter = fragments.iterator(); iter.hasNext();){
                String consideredFragment = (String) iter.next();
                // flag to indicate that a trimmed form of this fragment has been appended
                // to the trimmed stack trace buffer
                boolean appended = false;
                for (int i=0; i < boundaries.length; i++) {
                    int cut = consideredFragment.indexOf(boundaries);
    if (cut > 0) {
    // stack trace includes a trace through our container
    // in which we are not interested: trim it.
    // grab the desired portion up to the boundary
    trimmedTrace.append(consideredFragment.substring(0, cut).trim());
    trimmedTrace.append("\n");
    appended = true;
    break;
    if (! appended) {
    // a trimmed version of this fragment was not appended
    // because it doesn't need to be trimmed -- append the whole thing.
    trimmedTrace.append(consideredFragment.trim());
    trimmedTrace.append("\n");
    return trimmedTrace.toString();
    * Generic Exception Handler called from catch clause
    * @param eid the ErrorID (as seen from catch)
    * @param parm
    * @param ex the Exception caught
    * @throws PortalException
    public static void genericHandler(ErrorID eid, String parm, Throwable ex)
    throws PortalException {
    // *** Handle PortalExceptions ***
         // Log it if logging was deferred in .signal() call
         // Rethrow it
    if (ex instanceof PortalException) {
         if (((PortalException)ex).isLogPending())
              traceToLog(eid,parm,ex);
                   throw (PortalException) ex;
    // *** Handle all other Exceptions ***
    // Log the message and traceback
    traceToLog(eid, parm, ex);
    // Create a derived PortalException chained to this
    PortalException nex;
    if (ex instanceof Exception) {
    nex = new PortalException(eid, (Exception) ex);
    } else {
         // Sorry, at this point PortalExceptions don't chain to
         // non-Exception subclasses of Throwable
    nex = new PortalException(eid);
    nex.setLogPending(false);
    ProblemsTable.store(nex);
    throw nex;
         public static void genericHandler(ErrorID eid, Throwable ex)
              throws PortalException {
                   genericHandler(eid,null,ex);
         * Create PortalException from ErrorID and throw it. Maybe trace it.
         * @param eid ErrorId
         * @param parm Additional error information
         * @param tracenow Trace now or defer till first catch.
         * @throws PortalException
    public static void signal(ErrorID eid, String parm, boolean tracenow)
    throws PortalException {
    PortalException nex = new PortalException(eid);
              nex.setParameter(parm);
    signal(nex,tracenow);
    * Create PortalException from Errorid, trace, and throw it.
    * @param eid ErrorID to use to generate PortalException
    * @param parm Additional error information
    * @throws PortalException
    public static void signal(ErrorID eid, String parm) throws PortalException {
         signal(eid,parm,true);
    * Throw PortalException provided by caller, maybe trace it.
    * @param nex Exception provided by caller
    * @param tracenow Trace now, or later after first catch.
    * @throws PortalException
    private static void signal(PortalException nex, boolean tracenow)
    throws PortalException {
    if (tracenow) {
         traceToLog(nex.getErrorID(), nex.getParameter(), nex);
         ProblemsTable.store(nex);
    throw nex;
    * Generate, trace, and throw Portal Exception given ErrorID.
    * @param eid ErrorID
    * @throws PortalException
    public static void signal(ErrorID eid)
         throws PortalException {
         signal(eid,null,true);
    * Common logic for generating log entry of errors
    * @param eid ErrorID with initial message
    * @param parm Parameter string to append to eid msg
    * @param ex Old exception
    private static void traceToLog(ErrorID eid, String parm, Throwable ex) {
         if (ex !=null &&
              ex instanceof PortalException) {
                   if (!((PortalException)ex).isLogPending())
                        return; // This PortalException was already logged.
                   else
                        ((PortalException)ex).setLogPending(false);
    String logmsg = errorInfo(eid, parm, ex);
    log.error( logmsg);
    * Generate error string for logging or /problems online display
    * @param eid Error ID
    * @param parm Parameter string
    * @param ex Exception
    * @return Multiline text with message and traceback
    public static String errorInfo(ErrorID eid, String parm, Throwable ex) {
              StringBuffer errorinfobuffer = new StringBuffer(1000);
              if (eid!=Errors.legacy)
         errorinfobuffer.append(eid.getMessage()); // Error ID message
    else
         errorinfobuffer.append(ex.getMessage());
              if (parm != null) { // Parameter data
                   errorinfobuffer.append("\n [specific data: ");
                   errorinfobuffer.append(parm);
                   errorinfobuffer.append("] ");
              errorinfobuffer.append("\n");
              if (ex!=null)
                   errorinfobuffer.append(shortStackTrace(ex)); // Stack trace
              return errorinfobuffer.toString();
    * Generic Top-Level Exception Handler caled from catch clause
    * (doesn't rethrow exception)
    * @param eid Error ID
    * @param parm Parameter string
    * @param ex Exception caught
    public static void genericTopHandler(ErrorID eid, String parm, Throwable ex) {
    // If this is an already logged Portal Exception, we are done
    if (ex instanceof PortalException &&
         !((PortalException)ex).isLogPending()) {
         return;
    traceToLog(eid, parm, ex);
    if (ex instanceof PortalException) // already in the table
         return;
              // Create a derived PortalException (just for Problems Table)
              PortalException nex=null;
              if (ex instanceof Exception)
                   nex = new PortalException(eid, (Exception) ex);
              else
                   nex = new PortalException(eid);
              ProblemsTable.store(nex);
         public static void genericTopHandler(ErrorID eid, Throwable ex) {
              genericTopHandler(eid, null, ex);
    * Generate HTML page to send to end user after fatal error
    * @param resp Servlet response object
    * @param e PortalException received at Servlet code.
         public static void generateErrorPage(HttpServletResponse resp, Exception e) {
              resp.setContentType("text/html");
              try {
                   response.sendRedirect(response.encodeRedirectURL('http://dev.sheridan.edu/uportal/errors/') );
                   PrintWriter out = resp.getWriter();
                   out.println("<h1>Cannot start uPortal</h1>");
                   out.println("<p>Sorry, but a problem is preventing the Portal from starting. "+
                        "The error must be corrected by system administrators. Try again later.</p>");
                   //out.println("<p><a href='http://www.yale.edu/portal'>Click here to display the static Yaleinfo page.</a></p>");     
                   out.println("<!--");
                   ErrorID eid = Errors.bug;
                   String parm = "";
                   if (e instanceof PortalException) {
                        PortalException pe = (PortalException)e;
                        if (pe.errorID!=null)
                             eid=pe.errorID;
                        if (pe.parameter!=null)
                             parm=pe.parameter;     
                   out.println(errorInfo(eid,parm,e));
                   out.println("-->");     
                   out.flush();
              } catch (Exception ex) {

    I've tried this line of code, but I can't compile...
    might just be in the wrong place, line 348 :
    response.sendRedirect(response.encodeRedirectURL ('http://dev.sheridan.edu/uportal/errors/') );
    Use double quotes instead of single quotes!
    Single quotes are for char literals, not string literals.
    And next time please copy and paste the complete error message, instead of just saying "it doesn't compile".

  • I'm having 10.8.3 and today 17-Apr I had installed latest java 7 update. Now when ever I test java page it just redirects the page to Java download on both Firefox and safari. I tried deleting the cache from Java Sec Panel - temp ile but still same proble

    I'm having 10.8.3 and today 18-Apr Thursday I had installed latest java 7 update. Now when ever I test java page it just redirects the page to Java download on both Firefox and safari. I tried deleting the cache from Java Sec Panel - temp ile but still same prob.

    Make sure that the plugin is not automatically disabled in Firefox:
    Clinton

  • BEx Queries redirecting to Java Web instead of ABAP Web in browser?

    When I execute BEx Reports on Web, the reports are redirecting to EP host which is Java Web instead of BW Dev host server(ABAP Web). As a result, the reports are not working in Java Web. When I check the same in RSRT for the same report using ABAP Web, it is working.
    So, how can we set ABAP Web as default web functionality instead of Java Web(Portal) for the BEx reports when we execute them on the Web/Browser?
    Thanks,
    Raju
    Edited by: Raju Dupadally on Sep 5, 2011 9:20 AM
    Edited by: Raju Dupadally on Sep 5, 2011 9:21 AM

    Hi raju,
    When you get into RSPOR_SETUP program in SA38, it will show you three options like
    1) Determine Input Values
    2) Check Configuration
    3) Complete Configuration
    You have to go with all the options one by one.
    You have to specify the ABAP Server name which you wanted...
    Don't check any Variants while executing..
    Regards,
    Suman

  • Forwarding/Redirecting throws java.io.FileNotFoundException but file exists

    http://www.mydomain.com/common/handler.jsp:
    <jsp:forward page="/common/error_page.jsp" />This throws a java.io.FileNotFoundException:
    java.io.FileNotFoundException: resource not found: /common/error_page.jspHowever, I can go to http://www.mydomain.com/common/error_page.jsp and verify that it does indeed exist.
    Why would it throw a FileNotFoundException if not only does the forwarding page exist but exists within the exact same web module?
    I checked ibm-web-ext.xml for the "common" web module to notice that fileServingEnabled="true".
    Any ideas why this is happening?

    A forward is relative to the context root - not the server's root.
    So assuming you have a web application called "common", and "common" is its context name, then "/" would already refer to http://www.mydomain.com/common/
    Thus your forward should just be to "/handler.jsp"
    A redirect is slightly different, because it is resolved on the client, not the server.
    So if you had a web context "myContext"
    You access it with http://www.mydomain.com/myContext
    <jsp:forward page="/mypage.jsp"> (or getRequestDispatcher("/mypage.jsp")) would refer you to http://www.mydomain.com/myContext/mypage.jsp.
    to achieve the same destination with a redirect you would have to have
    response.sendRedirect("/myContext/mypage.jsp");

  • Redirecting java compilation errors to a file

    Hi,
    How do I redirect java compilation errors to a file while using a dos environment ? Help needed asap.
    Gayathri

    javac FileName.java 2> errorFileName

  • Java displays not being redirected to the DISPLAY environment variable

    I am running Solaris 8 and am using java se 1.4.1.
    I have a java application that is running in the background on BOX 1. It needs to use the JOptionPane.showmessage() function.
    When I remote onto Box 1 from Box 2, and run the java application, the message boxes from the JOptionPane.showmessage() are displayed on Box 1 instead of getting redirected to box 2. I know that the display setting are ok, since I can start other applications and get the displays sent to box 2.
    Is this a java bug?
    thanks
    Ben

    Hi Balus,
    Thank you for your reply, yes the response is absolutely empty just an empty page like:
    <html><body></body></html>In the logs I can see the normal trace about the error but nothing else.
    I found a "solution" that is working fine but I'm not sure if is the best to do, basically
    I'm throwing again the ServletException generated in the JSP an then is working:
    void autoForward(String forwardTo, HttpServletRequest request,
                HttpServletResponse response, ServletContext servContext,int errorCode)
                throws ServletException {
            try {
                addErrors(request,errorCode);
                RequestDispatcher dispatcher = servContext.getRequestDispatcher(forwardTo);
                dispatcher.forward(request, response);
            } catch (ServletException ex) {
                throw new ServletException(ExceptionUtils.getRootCause(ex));

  • How to redirect in java code not the jsp or any other

    hello
    can any one help me how to redirect in java pages the code must be in java function not in jsp or any thing else
    thanks in advance

    Function? Don't you rather mean method?
    Anyway, in JSF you can send a redirect using ExternalContext#redirect(). If your JSF environment is on top of JSP/Servlet, then under the hood it basically invokes HttpServletResponse#sendRedirect() and FacesContext#responseComplete().

  • File Redirection in java

    I have a program that uses file redirection to read using System.in. Is there anyway to throw an exception if the file redirection isn't in the command line
    Here is my code:
    public static void main(String[] args) throws IOException {
            Scanner sc = new Scanner(System.in);
            InetAddress addr = InetAddress.getLocalHost();
            String msgReply, hostName, fromAddress, toAddress, temp;
            String data = "";
            int portNum = 25;
            hostName = args[0];
            fromAddress = args[1];
            toAddress = args[2];
            Socket theSocket = new Socket(hostName, portNum);
            BufferedReader in = new BufferedReader(new InputStreamReader(theSocket.getInputStream()));
            OutputStreamWriter out = new OutputStreamWriter(theSocket.getOutputStream());
            BufferedWriter wrt = new BufferedWriter(out);
            msgReply = in.readLine();
            Main.msgCheck(msgReply);
            System.out.println(msgReply);
            wrt.write("HELO " + addr.getHostAddress() + "\r\n");
            wrt.flush();
            msgReply = in.readLine();
            Main.msgCheck(msgReply);
            System.out.println(msgReply);
            wrt.write("MAIL FROM:" + fromAddress + "\r\n");
            wrt.flush();
            msgReply = in.readLine();
            Main.msgCheck(msgReply);
            System.out.println(msgReply);
            wrt.write("RCPT TO:" + toAddress + "\r\n");
            wrt.flush();
            msgReply = in.readLine();
            Main.msgCheck(msgReply);
            System.out.println(msgReply);
            wrt.write("DATA \r\n");
            wrt.flush();
            in.readLine();
                while (sc.hasNext()) {
                    temp = sc.nextLine();
                    if (temp.startsWith(".")) {
                        data += "." + temp + "\r\n";
                    } else {
                        data += temp + "\r\n";
            wrt.write(data + "\r\n");
            wrt.flush();
            wrt.write(".\r\n");
            wrt.flush();
            msgReply = in.readLine();
            Main.msgCheck(msgReply);
            System.out.println(msgReply);
            System.out.println(data);
            wrt.write("QUIT \r\n");
            wrt.flush();
            msgReply = in.readLine();
            Main.msgCheck(msgReply);
            System.out.println(msgReply);
            System.exit(0);
        public static void msgCheck(String msgReply) {
            if (msgReply.startsWith("5") || msgReply.startsWith("4")) {
                System.exit(0);
    }  //end Main classCommand line should look like:
    java Main smtp.google.com [email protected] [email protected] <test.txt
    Is there anyway to check for:
    java Main smtp.google.com [email protected] [email protected]
    Thanks

    No. And why should you care about that anyway? If I don't redirect from the file, that gives me the opportunity to type in the message I want to send, instead of having to put it into a file beforehand. Or I could write a program that produces the message and pipe its output into your program:
    java PoliteMessageGenerator | java Main smtp.google.com [email protected] [email protected]
    No, that's a feature and not a bug.

Maybe you are looking for

  • How can I set a file to hidden

    Hi all How can I set a file to hidden from within Java. This is what I have tried so far but with out any luck     String[] cmd = new String[3];     cmd[0] = "cmd.exe";     cmd[1] = "attrib +h";     cmd[2] = "\""+"C:/program files/Licence.xml"+"\"";

  • RE: local variable cross-talk?

    Jeff A global can be considered as a variable to the entire code, where lots of different vi's can operate it. Locals only have any meaning within their own vi, or instances of their own vi. If anything writes to a particular global, whether in reent

  • Editing a Payment Proposal to remove payment block

    I am running a payment proposal in which I have a document which is blocked for payment.  I have removed the payment block by editing the payment proposal (change line items screen).  When ticking the change, rather than going back to the edit paymen

  • Is it possible to configure CF10 or CF11 to use Xerces XML parser instead of Saxon XML parser?

    Could anyone tell me if it is possible to configure CF10 or CF 11 to use the older Xerces XML parser instead of the Saxon XML parser. I am in the process of migrating a website from CF8 to CF11. Several sections rely on XML transformation, which no l

  • Adobe Application Manager Crash

    While trying to open a newly installed occurrence of CS6 applications on Mac OS X 9.1, Adobe Application Manager keeps crashing after I enter my login information.