Target on redirect

Is there a way to target a different frame or bust out of frames while doing
          a redirect to another servlet or page? I tried the following and it doesn't
          work.
          response.setHeader("Window-target:","_top");
          response.sendRedirect("/form?xmlUrl=daydata.xmap&xslUrl=dayDat.xsl");
          

          This may not be what you want, but you can do a redirect by MetaElement in
          htmlKona
          hp.getBody()
          .addElement( new MetaElement( 1, "your new url") );
          1 is the number of seconds to redirect to the new site.
          David Thompson wrote:
          > Is there a way to target a different frame or bust out of frames while doing
          > a redirect to another servlet or page? I tried the following and it doesn't
          > work.
          > response.setHeader("Window-target:","_top");
          > response.sendRedirect("/form?xmlUrl=daydata.xmap&xslUrl=dayDat.xsl");
          

Similar Messages

  • Channel level filter question

    Dear All,
    I have created a channel level filter as follows:
    tcp_channel smtp nomx single_sys subdirs 20 dequeue_removeroute maxjobs 7 pool SMTP_POOL maytlsserver allowswitchchannel saslswitchchannel tcp_auth missingrecipientpolicy 4 sourcefilter file:///opt/SUNWmsgsr/config/tcp_channel.filter
    my filter is written as such:
    if anyof(header :contains ["from","sender"] "[email protected]") {redirect $[email protected]; discard; }
    However, this filter just succeeded with a static redirected user by means {redirect [email protected]; discard; }
    How can I use the $U to target the redirection to the original recipient?
    Example:
    an email was sent to [email protected] and another one to [email protected] how would the filter know that the recipient is to be [email protected] or [email protected]?
    ./imsimta version
    Sun Java(tm) System Messaging Server 6.3-5.02 (built Oct 12 2007; 32bit)
    libimta.so 6.3-5.02 (built 17:15:31, Oct 12 2007; 32bit)
    Thanks,
    Lewis

    Lewis_SUN wrote:
    I have created a channel level filter as follows:
    tcp_channel smtp nomx single_sys subdirs 20 dequeue_removeroute maxjobs 7 pool SMTP_POOL maytlsserver allowswitchchannel saslswitchchannel tcp_auth missingrecipientpolicy 4 sourcefilter file:///opt/SUNWmsgsr/config/tcp_channel.filterIs this meant to be a source and destination channel or just a source channel?
    my filter is written as such:
    if anyof(header :contains ["from","sender"] "[email protected]") {redirect $[email protected]; discard; }
    However, this filter just succeeded with a static redirected user by means {redirect [email protected]; discard; }
    How can I use the $U to target the redirection to the original recipient?Not sure what you mean by this.
    Perhaps it would help if you described what you were trying to achieve e.g. I want a copy of any email with a From:/Sender: header set to "[email protected]" to be sent to [email protected], but only for emails coming in via a specific channel??
    Example:
    an email was sent to [email protected] and another one to [email protected] how would the filter know that the recipient is to be [email protected] or [email protected]?
    There are ways to achieve this but this issue may be irrelevant depending on what you actual goal is.
    Regards,
    Shane.

  • ACE: url rediection

    Hi,
    I need to do url redirection. I've worked on CSS alot so far but I'm new bie to ACE.
    for example - my CSS config for url rediction is as follow:
    service server1:443
      ip address 192.168.1.1
      protocol tcp
      port 443
      keepalive type ssl
      active
    service server2:443
      ip address 192.168.1.2
      protocol tcp
      port 443
      keepalive type ssl
      active
    service server1:80
      type redirect
      redirect-string "https://mail.google.com/exchange"
      ip address 192.168.1.1
      no prepend-http
      active
    service server2:80
      type redirect
      redirect-string "https://mail.google.com/exchange"
      ip address 192.168.1.2
      no prepend-http
      active
    owner mail  
      content mail.google.com:443
        vip address 10.10.10.1
        port 443
        protocol tcp
        application ssl
        add service server1:443
        add service server2:443
        advanced-balance sticky-srcip
        active
      content mail.google.com:80
        vip address 10.10.10.1
        protocol tcp
        port 80
        url "/*"
        add service server1:80
        add service server2:80
        active
    what would be equivalent ACE config? please advise....

    probe tcp generic-tcp
      interval 5
      passdetect interval 20
      passdetect count 2
      connection term forced
    exit
    rserver server1
      ip add 192.168.1.1
      inservice
    exit
    rserver server2
      ip add 192.168.1.2
      inservice
    exit
    rserver redirect https-target
      webhost-redirection https://mail.google.com/exchange
      inservice
    exit
    serverfarm redirect secure-redirect
      rserver https-target
      inservice
    exit
    serverfarm host SF443
      failaction purge
      predictor leastconns
      probe generic-tcp
      rserver server1 443
        inservice
      rserver server2 443
        inservice
    exit
    exit
    sticky ip-netmask 255.255.255.255 address source SF443-SG
      timeout 3600
      replicate sticky //only required if HA is in use
      serverfarm SF443
    exit
    class-map match-any www-CM
      2 match virtual-address 10.10.10.1 255.255.255.255 tcp eq www
    exit
    class-map match-any https-CM
      2 match virtual-address 10.10.10.1 255.255.255.255 tcp eq 443
    exit
    policy-map type loadbalance first-match http-PM
      class class-default
        serverfarm secure-redirect
    exit
    exit
    policy-map type loadbalance first-match https-PM
      class class-default
        sticky-serverfarm SF443-SG
    exit
    exit
    policy-map multi-match LBR-LB
      class www-CM
        loadbalance vip inservice
        loadbalance policy http-PM
        loadbalance vip icmp-reply
      class https-CM
        loadbalance vip inservice
        loadbalance policy https-PM
        loadbalance vip icmp-reply
    exit
    exit
    interface vlan xxx
      ip address xxx
      alias xxx
      peer ip address xxx
      access-group input xxx
      service-policy input LBR-LB
      no shutdown
    exit

  • Universal Installation Option Configuration

    Hi
    I did everything about UIO: installed Apache, installed UIO libraries, configured httpd.conf, configured UIO to run on discovery mode, captured customer information, configured UIO to do not run on discovery mode and made the settings for intercept requests and reponses. Everything seems to be fine, but everytime that I make a test on my customer system, it doesn't seem to work. I just don't know why. Here's a piece of my configuration file:
              <RequestInterceptor id="Phase2RedirectCustSystemPageRequest" desc="Redirect Customer System login page requests to UIO login page" enabled="false">
                   <RequestUrl url="/custsystem"/>
                   <RequestUrl url="/custsystem/"/>
                   <RequestUrl url="/custsystem/index.asp"/>
                   <Target action="redirect-client" url="/oasa/"/>
              </RequestInterceptor>
              <ResponseInterceptor id="InvalidLoginResponse" desc="Invalid login response from Customer System">
                   <ResponseUrl url="/custsystem/login.asp"/>
                   <Conditions>
                        <PageContainsText text="Invalid user"/>
                   </Conditions>
                   <Target action="redirect-client" url="/oasa/"/>
              </ResponseInterceptor>
    I have some questions on this:
    1. Will this work?
    2. Do I have to register Phase2RedirectCustSystemPageRequest or InvalidLoginResponse on somewhere on Risk Manager?
    3. Is there some configuration that I have to check?
    4. SA is checked true to uio proxy mode (bharosa.uio.proxy.mode.flag=true). Models, KBAs, Entities, Rules are imported on Risk Manager. What configuration is missing?
    Thanks for anyone attention
    Paulo

    Hi,
    I´m having a similar issue here. The PageContainsText condition does not work at all. Every time I use it in a response interceptor I always get a no match.
    Checking the logs I see that everything is working fine, the page returned from the server has the text I want to match but PageContainsText always says that it does not match the text in the page.
    I´m using UIO version 10g (10.1.4.5)
    Anyone has a hint on this?
    Regards,
    Ivens

  • EJB / Thread / URLConnection

    All,
    I have an EJB that needs to talk to an outside vendor using http. I could not find
    an elegant way to specify the timeout in the HttpURLConnection and thus I ended up
    implementing this using threads.
    I was wondering if this approach has some issues (since threads usage is not exactly
    recommended with EJBs).
    Here is the code snippet
    URLConnectionThread uct = new URLConnection(host, inMesg)
    uct.start();
    uct.join(timeout)
    if (uct.isAlive == true) uct.interrupt.
    URLConnectionThread class opens the connection and get the input/output stream.
    I know that this timeout issue is fixed in JDK 1.4 but we can not afford to upgrade
    at this time.
    Thanks,

    Hrm. I use this hack for quite a while and it works perfectly. Of course it works
    only with Sun's JVM ;-)
    Here is the test error:
    java.io.InterruptedIOException: Read timed out
    at java.net.SocketInputStream.socketRead(Native Method)
    at java.net.SocketInputStream.read(SocketInputStream.java:86)
    at java.io.BufferedInputStream.fill(BufferedInputStream.java:186)
    at java.io.BufferedInputStream.read1(BufferedInputStream.java:225)
    at java.io.BufferedInputStream.read(BufferedInputStream.java:280)
    at java.io.FilterInputStream.read(FilterInputStream.java:114)
    at java.io.PushbackInputStream.read(PushbackInputStream.java:164)
    at sun.net.www.http.HttpClient.parseHTTPHeader(HttpClient.java:649)
    at sun.net.www.http.HttpClient.parseHTTP(HttpClient.java:613)
    at HttpClientTimeout.parseHTTP(HttpClientTimeout.java:39)
    at sun.net.www.http.HttpClient.parseHTTP(HttpClient.java:621)
    at HttpClientTimeout.parseHTTP(HttpClientTimeout.java:39)
    at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:506)
    at java.net.HttpURLConnection.getResponseCode(HttpURLConnection.java:230)
    at TestTimeout.main(TestTimeout.java:9)
    And here are all .java files (for 1.3) :
    TestTimeout.java
    import java.io.*;
    import java.net.*;
    public class TestTimeout {
    public static void main(String[] args) {
         try {
         URL url = new URL(null, "http://www.cnn.com", new HttpTimeoutHandler(10));
         HttpURLConnection conn = (HttpURLConnection)url.openConnection();
         System.out.println(conn.getResponseCode());
         } catch(Throwable t) {
         t.printStackTrace();
    HttpClientTimeout.java
    import sun.net.www.http.HttpClient;
    import java.net.*;
    import java.io.*;
    import sun.net.www.MessageHeader ;
    import sun.net.ProgressEntry ;
    public class HttpClientTimeout extends HttpClient
    public HttpClientTimeout(URL url, String proxy, int proxyPort) throws IOException
         super(url, proxy, proxyPort);
    public HttpClientTimeout(URL url) throws IOException
         super(url, null, -1);
    private int timeout = -1;
    public void SetTimeout(int i) throws SocketException {
         timeout = i;
         serverSocket.setSoTimeout(i);
    public boolean parseHTTP(MessageHeader header, ProgressEntry entry)
         throws java.io.IOException
         if( this.timeout != -1 ) {
         try {
              serverSocket.setSoTimeout(this.timeout) ;
         } catch( SocketException e ) {
              throw new java.io.IOException("unable to set socket timeout!") ;
         return super.parseHTTP(header, entry) ;
    /* This class has no public constructor for HTTP. This method is used to
    * get an HttpClient to the specifed URL. If there's currently an
    * active HttpClient to that server/port, you'll get that one.
    * no longer syncrhonized -- it slows things down too much
    * synchronize at a higher level
    public static HttpClientTimeout GetNew(URL url)
         throws IOException {
         /* see if one's already around */
         HttpClientTimeout ret = (HttpClientTimeout) kac.get(url);
         if (ret == null) {
         ret = new HttpClientTimeout (url); // CTOR called openServer()
         } else {
         ret.url = url;
         // don't know if we're keeping alive until we parse the headers
         // for now, keepingAlive is false
         return ret;
    public void Close() throws IOException
         serverSocket.close();
    public Socket GetSocket()
         return serverSocket;
    HttpTimeoutFactory.java
    import java.net.*;
    public class HttpTimeoutFactory implements URLStreamHandlerFactory
         int fiTimeoutVal;
         public HttpTimeoutFactory(int iT) { fiTimeoutVal = iT; }
         public URLStreamHandler createURLStreamHandler(String str)
              return new HttpTimeoutHandler(fiTimeoutVal);
    HttpTimeoutHandler.java
    import java.net.*;
    import java.io.IOException;
    public class HttpTimeoutHandler extends sun.net.www.protocol.http.Handler
         int fiTimeoutVal;
         HttpURLConnectionTimeout fHUCT;
         public HttpTimeoutHandler(int iT) { fiTimeoutVal = iT; }
    protected java.net.URLConnection openConnection(URL u) throws IOException {
              return fHUCT = new HttpURLConnectionTimeout(u, this, fiTimeoutVal);
    String GetProxy() { return proxy; }          // breaking encapsulation
    int GetProxyPort() { return proxyPort; } // breaking encapsulation
         public void Close() throws Exception
              fHUCT.Close();
         public Socket GetSocket()
              return fHUCT.GetSocket();
    HttpURLConnectionTimeout.java
    import java.net.*;
    import java.io.*;
    import sun.net.www.http.HttpClient;
    public class HttpURLConnectionTimeout extends sun.net.www.protocol.http.HttpURLConnection
         int fiTimeoutVal;
    HttpTimeoutHandler fHandler;
         HttpClientTimeout fClient;
         public HttpURLConnectionTimeout(URL u, HttpTimeoutHandler handler, int iTimeout) throws IOException
         super(u, handler);
              fiTimeoutVal = iTimeout;
         public HttpURLConnectionTimeout(URL u, String host, int port) throws IOException
         super(u, host, port);
    public void connect() throws IOException {
         if (connected) {
         return;
         try {
         if ("http".equals(url.getProtocol()) /* && !failedOnce <- PRIVATE */ ) {
              // for safety's sake, as reported by KLGroup
              synchronized (url)
                   http = HttpClientTimeout.GetNew(url);
              fClient = (HttpClientTimeout)http;
              ((HttpClientTimeout)http).SetTimeout(fiTimeoutVal);
         } else {
              // make sure to construct new connection if first
              // attempt failed
              http = new HttpClientTimeout(url, fHandler.GetProxy(), fHandler.GetProxyPort());
         ps = (PrintStream)http.getOutputStream();
         } catch (IOException e) {
         throw e; }
              // this was missing from the original version
              connected = true;
    * Create a new HttpClient object, bypassing the cache of
    * HTTP client objects/connections.
    * @param url     the URL being accessed
    protected HttpClient getNewClient (URL url)
    throws IOException {
              HttpClientTimeout client = new HttpClientTimeout (url, (String)null, -1);
              try {
              client.SetTimeout(fiTimeoutVal);
              } catch (Exception e)
              { System.out.println("Unable to set timeout value"); }
         return (HttpClient)client;
    * opens a stream allowing redirects only to the same host.
    public static InputStream openConnectionCheckRedirects(URLConnection c)
         throws IOException
    boolean redir;
    int redirects = 0;
    InputStream in = null;
    do {
    if (c instanceof HttpURLConnectionTimeout) {
    ((HttpURLConnectionTimeout) c).setInstanceFollowRedirects(false);
    // We want to open the input stream before
    // getting headers, because getHeaderField()
    // et al swallow IOExceptions.
    in = c.getInputStream();
    redir = false;
    if (c instanceof HttpURLConnectionTimeout) {
    HttpURLConnectionTimeout http = (HttpURLConnectionTimeout) c;
    int stat = http.getResponseCode();
    if (stat >= 300 && stat <= 305 &&
    stat != HttpURLConnection.HTTP_NOT_MODIFIED) {
    URL base = http.getURL();
    String loc = http.getHeaderField("Location");
    URL target = null;
    if (loc != null) {
    target = new URL(base, loc);
    http.disconnect();
    if (target == null
    || !base.getProtocol().equals(target.getProtocol())
    || base.getPort() != target.getPort()
    || !HostsEquals(base, target)
    || redirects >= 5)
    throw new SecurityException("illegal URL redirect");
    redir = true;
    c = target.openConnection();
    redirects++;
    } while (redir);
    return in;
    // Same as java.net.URL.hostsEqual
         static boolean HostsEquals(URL u1, URL u2)
    final String h1 = u1.getHost();
    final String h2 = u2.getHost();
    if (h1 == null) {
    return h2 == null;
    } else if (h2 == null) {
    return false;
    } else if (h1.equalsIgnoreCase(h2)) {
    return true;
    // Have to resolve addresses before comparing, otherwise
    // names like tachyon and tachyon.eng would compare different
    final boolean result[] = {false};
    java.security.AccessController.doPrivileged(
    new java.security.PrivilegedAction() {
    public Object run() {
    try {
    InetAddress a1 = InetAddress.getByName(h1);
    InetAddress a2 = InetAddress.getByName(h2);
    result[0] = a1.equals(a2);
    } catch(UnknownHostException e) {
    } catch(SecurityException e) {
    return null;
    return result[0];
         void Close() throws Exception
              fClient.Close();
         Socket GetSocket()
              return fClient.GetSocket();
    Ashish <[email protected]> wrote:
    Thanks for your help.
    I'm still having problems though. I changed the code to look like your sample code.
    It compiles and runs okay but the timeout thing does not take affect.
    Do I need to alter the classpath or something ? In my test code, I'm not even running
    under weblogic. It's a standalone client trying to connect to a url. (though it has
    weblogic.jar in front of the classpath).
    <[email protected]> wrote:
    You need to update HttpClientTimeout (see below) for 1.3 and use it
    like this:
    URL url = new URL(null, "http://...", new HttpTimeoutHandler(timeout));
    HttpURLConnection conn = (HttpURLConnection)url.openConnection();
    (you will also need to modify weblogic.policy to allow your code to specify
    handler).
    --- HttpClientTimeout.java ---
    import sun.net.www.http.HttpClient;
    import java.net.*;
    import java.io.*;
    import sun.net.www.MessageHeader ;
    import sun.net.ProgressEntry ;
    public class HttpClientTimeout extends HttpClient
    public HttpClientTimeout(URL url, String proxy, int proxyPort) throws
    IOException
         super(url, proxy, proxyPort);
    public HttpClientTimeout(URL url) throws IOException
         super(url, null, -1);
    private int timeout = -1;
    public void SetTimeout(int i) throws SocketException {
         timeout = i;
         serverSocket.setSoTimeout(i);
    public boolean parseHTTP(MessageHeader header, ProgressEntry entry)
         throws java.io.IOException
         if( this.timeout != -1 ) {
         try {
              serverSocket.setSoTimeout(this.timeout) ;
         } catch( SocketException e ) {
              throw new java.io.IOException("unable to set socket timeout!") ;
         return super.parseHTTP(header, entry) ;
    /* This class has no public constructor for HTTP. This method is used
    to
    * get an HttpClient to the specifed URL. If there's currently an
    * active HttpClient to that server/port, you'll get that one.
    * no longer syncrhonized -- it slows things down too much
    * synchronize at a higher level
    public static HttpClientTimeout GetNew(URL url)
         throws IOException {
         /* see if one's already around */
         HttpClientTimeout ret = (HttpClientTimeout) kac.get(url);
         if (ret == null) {
         ret = new HttpClientTimeout (url); // CTOR called openServer()
         } else {
         ret.url = url;
         // don't know if we're keeping alive until we parse the headers
         // for now, keepingAlive is false
         return ret;
    public void Close() throws IOException
         serverSocket.close();
    public Socket GetSocket()
         return serverSocket;
    Ashish <[email protected]> wrote:
    I tried using the http://www.logicamente.com/sockets.html but it didn't
    work for me.
    The timeout parameter I specify is completely ignored.
    Did you get it to work ?
    Appreciate your help.
    Ashish.
    <[email protected]> wrote:
    Just use a different HTTP client implementation -
    http://www.innovation.ch/java/HTTPClient/ for example :
    HTTPConnection conn = new HTTPConnection("someserver", port);
    conn.setTimeout(...);
    HTTPResponse res = conn.Get("/...");
    InputStream in = res.getInputStream();
    This hack also works, if you want to keep using java.net APIs:
    http://www.logicamente.com/sockets.html
    Ashish <[email protected]> wrote:
    All,
    I have an EJB that needs to talk to an outside vendor using http. I
    could
    not find
    an elegant way to specify the timeout in the HttpURLConnection and thusI ended up
    implementing this using threads.
    I was wondering if this approach has some issues (since threads usageis not exactly
    recommended with EJBs).
    Here is the code snippet
    URLConnectionThread uct = new URLConnection(host, inMesg)
    uct.start();
    uct.join(timeout)
    if (uct.isAlive == true) uct.interrupt.
    URLConnectionThread class opens the connection and get the input/outputstream.
    I know that this timeout issue is fixed in JDK 1.4 but we can not affordto upgrade
    at this time.
    Thanks,--
    Dimitri
    Dimitri
    Dimitri

  • JSP Servlet JDBC connection

    Below is the code for handling login.
    However I am new to servlets, and I am wondering is the code below correct?
    Can anyone give me some advice if it is not correct?
    package gcd;
    import java.io.*;
    import java.sql.*;
    import java.util.*;
    import javax.servlet.*;
    import javax.servlet.http.*;
    import com.mysql.jdbc.*;
    public class LoginHandler extends HttpServlet
    public void doPost(HttpServletRequest req, HttpServletResponse res)
    throws ServletException, IOException
    res.setContentType("text/html");
    PrintWriter out = res.getWriter();
    //Load the driver
    Class.forName("com.mysql.jdbc.Driver");
    //Get a connection to the database
    java.sql.Connection connection=java.sql.DriverManager.getConnection("jdbc:mysql://localhost/gcdBB_db");
    //Create a statement object
    java.sql.Statement statement = connection.createStatement();
    Enumeration parameters = request.getParameterNames();
    if(parameters.hasMoreElements())
    // Get the user's account number, and password
    String username = req.getParameter("username");
    String password = req.getParameter("password");
    statement.executeUpdate("INSERT INTO users (username,password) VALUES ('"+username+"','"+password+"')");
    // Check the name and password for validity
    if (!allowUser(username, password))
    out.println("<HTML><HEAD><TITLE>Access Denied</TITLE></HEAD>");
    out.println("<BODY>Your login and password are invalid.<BR>");
    out.println("You may want to <A HREF=\"Login.jsp\">try again</A>");
    out.println("</BODY></HTML>");
    else
    // Valid login. Make a note in the session object.
    HttpSession session = req.getSession();
    session.setAttribute("logon.isDone", account); // just a marker object
    // Try redirecting the client to the page he first tried to access
    try
    String target = (String) session.getAttribute("login.target");
    if (target != null)
    res.sendRedirect(target);
    return;
    catch (Exception ignored) { }
    // Couldn't redirect to the target. Redirect to the site's home page.
    res.sendRedirect("/");
    protected boolean allowUser(String username, String password)
    return true; // trust everyone
    }

    I made the following changes as suggested, to the LoginHandlaer code.
    I also want to ask about the code for ProtectedResources. Do I need to inlude anything in the program. Will I need to include code for the JDBC connection?
    Are the 2 java servlets below correct, as I want JSP-Servlet-JSP operation for login? I can also include the code for Login.jsp if requested?
    PS: I am using Tomcat 3.1 as my server.
    package gcd;
    import java.io.*;
    import java.sql.*;
    import java.util.*;
    import javax.servlet.*;
    import javax.servlet.http.*;
    import com.mysql.jdbc.*;
    public class LoginHandler extends HttpServlet
         public void doPost(HttpServletRequest request, HttpServletResponse response)
         throws ServletException, IOException
                   response.setContentType("text/jsp");
              PrintWriter out = response.getWriter();
              try
                   //Load the driver
                   Class.forName("com.mysql.jdbc.Driver");
                        //Get a connection to the database
                        java.sql.Connection connection=java.sql.DriverManager.getConnection("jdbc:mysql://localhost/gcdBB_db");
                        //Create a statement object
                        java.sql.Statement statement = connection.createStatement();
                        Enumeration parameters = request.getParameterNames();
                        // Get the user's username, and password
                        String username = request.getParameter("username");
                        String password = request.getParameter("password");
                        statement.executeUpdate("INSERT INTO users (username,password) VALUES ('"+username+"','"+password+"')");
                   // Check the username and password for validity
                   if (!allowUser(username, password))
                        out.println("<HTML><HEAD><TITLE>Access Denied</TITLE></HEAD>");
                        out.println("<BODY>Your login and password are invalid.<BR>");
                        out.println("You may want to <A HREF=\"Login.jsp\">try again</A>");
                        out.println("</BODY></HTML>");
                   else
                        // Valid login. Make a note in the session object.
                        HttpSession session = request.getSession();
                        session.setAttribute("logon.isDone", username); // just a marker object
                        // Try redirecting the client to the page he first tried to access
                        try
                             String target = (String) session.getAttribute("login.target");
                             if (target != null)
                                  response.sendRedirect(target);
                                  return;
                        catch (Exception ignored) { }
                             // Couldn't redirect to the target. Redirect to the site's home page.
                             response.sendRedirect(request.getContextPath() + "http://localhost:8080/jsp/gcdBB");
                   catch (ClassNotFoundException e)
                        out.println("Could not load database driver: " + e.getMessage());
                   catch(SQLException e)
                        out.println("SQLException caught: " + e.getMessage());
         protected boolean allowUser(String username, String password)
              return true; // trust everyone
    package gcd;
    import java.io.*;
    import java.sql.*;
    import java.util.*;
    import javax.servlet.*;
    import javax.servlet.http.*;
    import com.mysql.jdbc.*;
    public class ProtectedResources extends HttpServlet
         public void doGet(HttpServletRequest request, HttpServletResponse response)
         throws ServletException, IOException
              response.setContentType("text/plain");
              PrintWriter out = response.getWriter();
              // Get the session
              HttpSession session = request.getSession();
              // Does the session indicate this user already logged in?
              Object done = session.getAttribute("logon.isDone"); // marker object
              if (done == null)
                   // No logon.isDone means he hasn't logged in.
                   // Save the request URL as the true target and redirect to the login page.
                   session.setAttribute("login.target",
                   HttpUtils.getRequestURL(request).toString());
                   response.sendRedirect(request.getContextPath() + "http://localhost:8080/jsp/gcdBB/Login.jsp");
                   return;
              // If we get here, the user has logged in and can see the bulletin boards
              out.println("The GCD Computing Bulletin Board awaits you!");
    Any help would be greatly appreciated!

  • How to define target window when redirecting within frames using servlet?

    Howdy:
    Is there a way to define target window when redirecting within frames using servlets?
    How to do it in JSP as well?
    T.I.A.
    Oriental Spirit

    Your servlet (or JSP) can't decide where it is going to be displayed. The browser has already decided that when it makes the request to your servlet.

  • How do I set redirect to a specific target

    response.setStatus(301);
    response.setHeader("Location", "http://www.google.com");
    response.setHeader("Connection", "close");is the code I use to set a redirection from my jsp page.
    This page resides in an iframe in the main page and I would like to set the target to "_parent".
    Any idea how I could do this?

    Someone else can correct me if I'm wrong, but there is no way to make a redirect change the target. That has to be set from the client side html. You could create a JSP page that serves as a redirect proxy. So instead of redirecting to google, redirect to your own JSP page that has a dynamic onLoad function that will then redirect to google with a target of _parent.  Not the prettiest, but it might do what you want.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

  • Enabling SAML V2 redirection to target application

    Hi Gurus,
    I have been facing to issues for which I cannot find any relevant information. I have been trying to enable SSO SAML 2 on our SAP Netweaver Platform and I am not able to configure everything.
    I followed the step by step implementation described here:
    http://wiki.scn.sap.com/wiki/display/Security/Single+Sign-On+with+SAML+2.0+and+ABAP+Systems+Supporting+SAP+Logon+Tickets
    The only difference lays in the fact that the provider is an external one and not hosted by NW.
    The SAML V2 is activated and the SAML backbone  of my customer redirects to the endpoint URL I gave for a test (our java portal address). So this is more or less fine.
    But my business case is different as redirecting to a fixed URL: I want to allow any user to run any BEx queries to be authenticated via SAML 2 backbone and to be redirected to the initially targetted query.
    Meaning:
    A user is accessing the following URL:
    http://<server_name>/irj/servlet/prt/portal/prtroot/pcd!3aportal_content!2fcom.sap.pct!2fplatform_add_ons!2fcom.sap.ip.bi!2fiViews!2fcom.sap.ip.bi.bex?QUERY=<query_id>
    The actual situation: the user is getting redirected to the SSO backbone and back to the endpoint I gave meaning:
    http://<server_name>/irj/portal
    What I would like to have as a behaviour is to:
    1- the user request any URL hosted on our Java (it can be BEx query as well as a Web Dynpro application called)
    2- he is getting authenticated by the SSO Backbone and redirected to the original URL
    I am not an admin and it is hard for me to find the relevant information.
    Thanks for helping me!
    Cheers,
    Cyril.

    Hello,
    although an answer to my question was provided it doesn't really solve the problem because in order to be able to get the patch that fixes the flaw it requires as described at the bottom of the page of My Oracle Support website that "This site is intended solely for use by authorized Oracle customers, partners, and employees."
    I'm not currently part of any of this groups so access to such resources is denied for me. So, i would kindly request from someone to explain to me the purpose of this kind of policy. Oracle Apex and Oracle Database XE are suppossed to be free products. Why are patches of discovered bugs on these products require special privileges to access them ? I say this because now i have to wait for several weeks or even months for the next release of APEX to be able to continue my study.
    I would really love to hear a comment on this issue.
    Thank you very much.

  • Folder Redirection policy is not applied to a user, when the server target is changed, but works after resetting the windows profile.

    Folder Redirection policy is not applied to a user, when the server target is changed. 
    After server target is changed via group policy, when user login  (roaming profile)first time, the the new server target has not been applied, instead it's pointing to the old folder redirection path.
    But if we reset the windows profile (roaming ), the new folder redirection works, can you please specify a solutions that the new folder redirection works when the user login for the first time. so it reduce the time on resetting users profile.
    it seems that we need to delete the old folder redirection path from the user profile (roaming user profile) via group policy or similar solutions..
    Many Thanks

    >   But when the specific users login they all get the same error, it
    Is the old server removed from the domain? Seems so - or some other
    authentication related issue, hard to tell from here...
    > seems that the roaming user profiles still keeps the old server details,
    Yes - if you change redirection targets, FR moves content from old to
    new, and only if this ends sucessfully, it will update the redirection
    target.
    Make the old redirection target accessible to the user and you'll be fine.
    Martin
    Mal ein
    GUTES Buch über GPOs lesen?
    NO THEY ARE NOT EVIL, if you know what you are doing:
    Good or bad GPOs?
    And if IT bothers me - coke bottle design refreshment :))

  • Redirection, target and session

    Hi,
    I'm a french developer, and i'm facing a problem for which i haven't found a solution yet.
    Let me explain :
    I'm developing a web application in JSP. In this webapp, I try to use sessions, but, when I redirects the user to a new page - in a target frame - using JavaScript, it seems that I loose the session..
    In fact, I have noted that the session ID was different in the two pages.
    It seems too, that one can not use the response.sendRedirect on a target frame.. but this expression seems to be the one to use with the sessions..
    I'm lost..
    Is there somebody to help me?

    From your first description the session id seems to be lost during the JavaScript-redirect. If you have to use JavaScript, make sure that cookies are enabled for tracking the session id or the redirection url is created using response.encodeURL() in order to enable url rewriting.
    Example:
    out.println("<a href=\"" + response.encodeURL(request.getContextPath() + "/whatever") + "\">Link Description</a>");Maybe you should print the session id to a server side log file and into the response to compare the session ids and find out at which point the session id changes.
    Carsten

  • 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).

  • Rt6_redirect: source isn't a valid nexthop for redirect target

    I create a ipv6 tunnel for my ipv4 network, so I can visit ipv6 websites, such as http://ipv6.google.com, like this:
    # ip tunnel add sit1 mode sit remote $ISATAP_SERVER local $LOCAL_IP ttl 64
    # ip link set dev sit1 up
    # ip addr add 2001:da8:8000:d010:0:5efe:$LOCAL_IP/64 dev sit1
    # ip -6 route add default dev sit1 metric 1
    where $ISATAP_SERVER is the ip address of the remote server, and $LOCAL_IP is my ipv4 address.
    This is the route info for ipv6:
    $ ip -6 route
    2001:da8:8000:d010::/64 via :: dev sit1 proto kernel metric 256
    fe80::/64 dev eth0 proto kernel metric 256
    fe80::/64 via :: dev sit1 proto kernel metric 256
    default dev sit1 metric 1
    Now I can visit ipv6 websites, and everything seems OK.
    But when I check the log file /var/log/everything.log, I get much information like this:
    Mar 4 19:46:29 localhost kernel: [ 8073.183872] rt6_redirect: source isn't a valid nexthop for redirect target
    It seems there‘s something wrong with the route for ipv6, but I can't figure it out.
    I've googled this for a long time, but many is about the source file route.c, nothing helpful.
    Any ideas? Thanks!

    Thanks cor-el, but the problem is solved, as far as the redirect issue.
    Maybe I should have started a new topic.....maybe I will....
    I just thought since the issue I was having because I had reset the referrer header, was explained through this thread, it would be easier than explaining it again in a new topic.
    At least 1 of those programs I listed, as best I can understand, allows for customized referrer header, site by site. I just can't understand the other one though.
    But you know what, I think I'll just start a new topic, and ask if anyone has experience with these, or can explain the one I can't understand.
    Thanks again :-)

  • Cma and target URIs for redirect

    Using CMA with a server that has multiple applications deployed. If I browse to a protected resource in the application where my login actions live, I am able to access the target URL for redirect upon successful authentication via ServietAutentication.getTargetURLForFormAuthentication(HttpSession). However, if I browse to a protected resource in any of the other applications I successfully authenticate, but HttpSession is missing the weblogic.formauth.targeturl internal attribute and therefore null is returned from ServietAutentication.getTargetURLForFormAuthentication(HttpSession). Im not sure if I have a problem with the container configurations of my webapps or if I dont have weblogic server configured properly. I am deploying all my applications exploded. Any ideas or direction would be appriciated.

    Hej Lars,
    I've tried using SimpleTimer on T610 and it works fine.
    I tried the following:
    <SimpleResult>
    <SimpleTimer timer="3000" target="../../utils/dummyLink.xml"/>
    <SimpleContainer>
    <SimpleText wrapmode="wrap">
    <SimpleTextItem>You should be redirected to a new site in 3 seconds.</SimpleTextItem>
    </SimpleText>
    </SimpleContainer>
    </SimpleResult>
    Can you see if the above works for you? If not, then it could be related to the mapping of transformers. Which transformer have you mapped to, and which version/patchset are you using?
    Also, in the Webtool Service Designer you can use the "Debug" feature to print out the returned device markup.

  • The Page is directly getting redirected to the next page

    I have tried using response.redirect("filename.jsp") in the two buttons as shown below but the pages are getting directly to the next page without loading the first page.Even though i write a .js file and include it in the jsp file that method is not getting called into the jsp page.Please advice.....stuck here.
    <%@ page contentType="text/html; charset=iso-8859-1" language="java" import="java.sql.*" errorPage="" %>
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
    <title>Main</title>
    <script src="All.js">
    </script>
    </head>
    <body>
    <form name="one" >
    <h1>Please Choose : </h1>
    <table width="158" border="1">
    <tr>
    <td>
    <input type="button" value="Insert Record" onclick=""/>
    <a href="# onclick="insert();"></a>
    </td>
    </tr>
    <tr>
    <td align="left" valign="middle"><input type="submit" value="Delete/View" /><a href="# onclick="" target="insert()"></a></td>
    <!--td align="left" valign="middle"><input type="submit" value="Delete/View" /><a href="# onClick="insert();" target="_self""></a></td-->
    </tr>
    </table>
    </form>
    </body>
    </html>

    where you use response.redirect()? What is in insert()?

Maybe you are looking for