P.H.
P.H.

Reputation: 5

Java url-pattern all subdomains redirect

is there any possibility in Java's web.xml of redirect all subdomains to one servlet?

For example:

<url-pattern>*.</url-pattern>

Upvotes: 1

Views: 683

Answers (1)

Yogendra Singh
Yogendra Singh

Reputation: 34387

You can definitely do that but I think you would like to define your URL pattern using *.ext or *.* as below:

    <url-pattern>*.*</url-pattern>

This is also used by some populare MVC frameworks such as struts where UL pattern

    <servlet-mapping>
        <servlet-name>action</servlet-name>
        <url-pattern>*.do</url-pattern>
   </servlet-mapping>

is mapped to Struts controller servlet.

Upvotes: 1

Related Questions