The exploration of URL redirection of JSP server resin

Source: Internet
Author: User
Tags filter
The simplest js| servers are URL conversions based on the URL rewrite steering (Rewrite) modules in various Web servers:
This will almost certainly not modify the implementation of the program to map news.jsp?id=234 such links into news/234.html, from the outside looks like static links. Resin server can be set up via webinfo web.xml: URL rewrite powerful enough to write a book.


When I need to map news.jsp?id=234 to news/234.html, just set the web.xml below the directory where Web-inf resides:

and add the following statement
<filter filter-name= ' rewrite '
filter-class= ' Com.caucho.filters.RewriteFilter ' >
<init>
<rewrite pattern= "/(\d+) \.html" target= "/\news.jsp\?id=$1"/>
<rewrite pattern= "/value_ (. +) \.html" target= "/\news.jsp\?t=$1"/> This sentence is set as a different parameter.
</init>
</filter>

<filter-mapping url-pattern= '/* ' filter-name= ' rewrite '/>





Other methods you can explore, rewrite is very powerful.
This setting allows you to access the original dynamic page through a link such as 1234.htm.
There are some benefits from URL rewrite:


Hidden background implementation: This is very useful in the background of the migration of the application platform: When migrating from JSP to ASP platform, for the front users, do not feel the background of the application of changes;
Simplified data validation: Because like (\d+) such parameters, can effectively control the number of the format or even the number of digits;
For example, when we need to migrate applications from news.jsp?id=234 to news.php?query=234, the performance of the front desk can remain news/234.html. From the implementation of application and foreground performance separation: the stability of the URL is maintained, and the use of mod_rewrite can even forward requests to other backend servers.





Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.