Hello:

In Struts 2, I am trying to figure out how to redirect a user to
https when they make a request using http.

When I try to do the redirect, I get this error:

Not Found
The requested URL /https://tweb.retcgroup.com/thymeleweb/login.action was
not found on this server.

Here is my struts.xml file:

<!DOCTYPE struts PUBLIC
    "-//Apache Software Foundation//DTD Struts Configuration 2.0//EN"
    "http://struts.apache.org/dtds/struts-2.0.dtd";>

<struts>
        <!-- Configuration for the default package. -->
        <package name="top" extends="struts-default">
                <interceptors>
        <interceptor name="checkLogin" class="util.LoginInterceptor"/>
                        <interceptor-stack name="baseStack">
                                <interceptor-ref name="checkLogin"/>
                                <interceptor-ref name="defaultStack"/>
      </interceptor-stack>
    </interceptors>

                <default-interceptor-ref name="baseStack"/>

                <action name="*">
        <result name="login">/thymeleweb/login.jsp</result>
        <result type="redirect-action"
name="loginRedirect">https://tweb.retcgroup.com/thymeleweb/login.action</res
ult>
        <result name="success">/{1}.jsp</result>
    </action>
        </package>

        <package name="test" extends="top">
                <action name="*">
        <result name="login">/login.jsp</result>
        <result type="redirect-action"
name="loginRedirect">https://tweb.retcgroup.com/thymeleweb/login.action</res
ult>
        <result name="success">/test/{1}.jsp</result>
    </action>
        </package>
</struts>

Here is my LoginInterceptor:

package util;

import com.opensymphony.xwork2.*;
import com.opensymphony.xwork2.interceptor.AbstractInterceptor;
import java.util.*;
import javax.servlet.http.*;
import org.apache.log4j.*;
import org.apache.struts2.*;

public class LoginInterceptor extends AbstractInterceptor {
  public String intercept(ActionInvocation invocation) throws Exception {
    HttpServletRequest req = ServletActionContext.getRequest();
    if( !"https".equalsIgnoreCase(req.getScheme()))
      return "loginRedirect";
    return "login";
  }
}

Any ideas how to make this work?

Thanks,
        Neil

--
Neil Aggarwal, (214)986-3533, www.JAMMConsulting.com
FREE! Eliminate junk email and reclaim your inbox.
Visit http://www.spammilter.com for details.


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to