struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Legolas Woodland <legola...@gmail.com>
Subject I get exception : Path http://www.mywebsite.com/ does not start with a "/" character
Date Tue, 04 Apr 2006 06:52:43 GMT
Hi
Thank you for reading my post
when i click on some of my links in the web application
The server return an exception like :


java.lang.IllegalArgumentException: Path http://www.mysite.com/ does not
start with a "/" character

org.apache.struts.action.RequestProcessor.doForward(RequestProcessor.java:1062) 


org.apache.struts.action.RequestProcessor.processForwardConfig(RequestProcessor.java:455)



org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:279) 

   org.apache.struts.action.ActionServlet.process(ActionServlet.java:1482)
   org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:525)
   javax.servlet.http.HttpServlet.service(HttpServlet.java:709)
   javax.servlet.http.HttpServlet.service(HttpServlet.java:802)

com.opensymphony.module.sitemesh.filter.PageFilter.parsePage(PageFilter.java:118) 


com.opensymphony.module.sitemesh.filter.PageFilter.doFilter(PageFilter.java:52) 



For example the above exception come from clicking a link that change 
the language.
which produce a url like :

http://www.mysite.com/ChangeLocale.do;jsessionid=2B7855F5F585B96C83B68FBC6B4E78D4?Lang=en



when the browser shows the exception if i click GO button of
browser again it will works fine.


The source code for changeLocale action is as follow :


public class ChangeLocaleAction
   extends Action
{

  
   public ActionForward execute( ActionMapping mapping, ActionForm form,
                                 HttpServletRequest request,
                                 HttpServletResponse response )
   {
      ChangeLocaleForm theForm      = (ChangeLocaleForm)form;
      String           forward      = Constants.FORWARD_SUCCESS;
      String s=request.getParameter("Lang");           
      String           localeString = 
s;//request.getAttribute("Lang").toString();
  
      //theForm.getLocaleString();
      HttpSession      session      = request.getSession( true );
      int              headLen      = localeString.length();
      String           language     = Constants.LANGUAGE_EN;
      String           country      = Constants.COUNTRY_US;

      if( headLen == 2 )
      {
         language = localeString;
      }

      if( headLen == 5 )
      {
         language = localeString.substring( 0, 2 );
         country  = localeString.substring( 3 );
      }
//      System.out.println("This is the language : 
====>"+language+"******This is the country : ====>    "+ country);
      Locale newLocale = new Locale( language, country );
      session.setAttribute("Language",language);

      session.setAttribute( Globals.LOCALE_KEY, newLocale );

      ActionForward myForward = null;
      String myPath="/welcome.jsp";
      if 
((request.getHeader("Referer")!=null)&&(request.getHeader("Referer")!=""))
      try{
        
          myPath=request.getHeader("Referer");
         myPath=StringUtils.substringAfter(myPath,request.getContextPath());
          if 
((request.getHeader("Referer")!=null)&&(request.getHeader("Referer")!="")){
          if(myPath=="/" || StringUtils.contains(myPath,"Locale")) 
myPath="/welcome.jsp?la="+language;
                  myForward= new 
ActionForward("lastPath",myPath,false,false);
          return myForward;
          }
          }
      catch(Exception npe){
         npe.printStackTrace();
           }
     
    //  [End]path redirection end here
    
    

     
         
      if (language=="hr")    {      
session.setAttribute("LastPageInclude","/ContentPages/welcome.hr.jsp");
           }
      if (language=="en")         { 
session.setAttribute("LastPageInclude","/ContentPages/welcome.en.jsp");
      }
      forward="forwarder";
      return mapping.findForward( forward );
          
         
   }
}



How i can fix this problem , it was working fine before i migrate to new 
server.
Thank you for looking at my code.




Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message