Author Topic: Accessing the web ui on a different url  (Read 4656 times)

monish_advani1234

  • Newbie
  • *
  • Posts: 1
    • View Profile
Accessing the web ui on a different url
« on: December 11, 2009, 12:44:40 PM »
Support,

Is it possible to access the url on https://servername:portnumber/appname instead of https://localhost:portnumber/ajaxswing/apps/appname.

Please let me know.

Thanks.

Monish

Support Team

  • Administrator
  • Hero Member
  • *****
  • Posts: 1074
    • View Profile
Re: Accessing the web ui on a different url
« Reply #1 on: December 11, 2009, 02:29:37 PM »
You can do that in 2 steps:

1. Make ajaxswing the default (root) application in your web server. For Tomcat you can read http://benhutchison.wordpress.com/2008/07/30/how-to-configure-tomcat-root-context/

2. Register a servlet iin web.xml and giving it the name that you want to appear in the URL (default AjaxSwing installation has this example for application WindowsThemeDemo):

  <servlet>
    <servlet-name>WindowsThemeDemo</servlet-name>
    <servlet-class>com.creamtec.ajaxswing.AjaxSwingRouter</servlet-class>
    <init-param>
      <param-name>appName</param-name>
      <param-value>WindowsThemeDemo</param-value>
    </init-param>
    <!-- propsFileName can be used to spacify non-default path to the application properties file
    <init-param>
      <param-name>propsFileName</param-name>
      <param-value>WindowsThemeDemo</param-value>
    </init-param>
    -->
  </servlet>

  <servlet-mapping>
     <servlet-name>WindowsThemeDemo</servlet-name>
     <url-pattern>/WindowsThemeDemo/*</url-pattern>
  </servlet-mapping>

Dev Team

  • Customer
  • Hero Member
  • *
  • Posts: 593
    • View Profile
Re: Accessing the web ui on a different url
« Reply #2 on: December 11, 2009, 03:36:30 PM »
Also if you don't want to make AjaxSwing your root application in tomcat you can use redirect in following method:

1) Download tomcat urlrewrite plugin at http://tuckey.org/urlrewrite/dist/urlrewritefilter-2.6.zip
2) Copy urlrewrite-2.6.0.jar from download to tomcat/webapps/ROOT/WEB-INF/lib/
3) Change tomcat/webapps/ROOT/WEB-INF/web.xml adding following filter:
Code: [Select]
        <filter>
           <filter-name>UrlRewriteFilter</filter-name>
           <filter-class>org.tuckey.web.filters.urlrewrite.UrlRewriteFilter</filter-class>
        </filter>
        <filter-mapping>
           <filter-name>UrlRewriteFilter</filter-name>
           <url-pattern>/*</url-pattern>
        </filter-mapping>
4) Create "urlrewrite.xml" in tomcat/webapps/ROOT/WEB-INF/ with following content:
Code: [Select]
<?xml version="1.0" encoding="utf-8"?>
<urlrewrite>
    <rule>
        <from>/appName</from>
        <to type="redirect">/ajaxswing/apps/appName</to>
    </rule>
</urlrewrite>
4) Restart tomcat, you should be able to get your application at "http://localhost:port/appName"

You can use different URL's and patterns with this method changing rewrite rule.