Use Microsoft Internet Information Server as Java

Source: Internet
Author: User

This tool greatly simplifies your work. The getParameterNames method has a format similar to the following:
Public Enumeration getParameterNames ()
{
Return (
New EnumerationComposite (
New RequestDictionary [] {
Request. getQueryString (),
Request. getForm ()}));
}
The next most common method for responding to objects is getSession. A session object is another core object that is mapped to each other between ASP and servlet. Therefore, the session you provide must have your own adapter. I will explain it later. But before I describe it, please first look at the request method:
Public HttpSession getSession (boolean flag)
{
Return (new SessionAdapter ());
}
In this article, the last method of the request object to be rewritten is getCookies. As the name suggests, it returns the set of cookies provided by the client. The cookie object of ASP makes me feel embarrassed. It seems to be used as a set of its own, but it introduces many methods with ambiguous functions. However, I can fully parse the script to rewrite the servlet. Because Enumeration is returned in ASP and an array is returned in servlet, copyInto is an uncommon method in the Vector class. This is the only trick. Note that. ms. iis. asp package and javax. servlet. in the http packet, the class names are identical, so we have to specify the package name of each Cookie object. The code is as follows:
Public javax. servlet. http. Cookie [] getCookies ()
{
Vector tmpList = new Vector ();
CookieDictionary aspCookies = this. request. getCookies ();
IEnumerator e = aspCookies. keys ();
While (e. hasMoreItems ())
    {
String key = (String) e. nextItem ();
String val = aspCookies. getCookie (key). getValue ();
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.