⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 weatherservlet.jad

📁 < J2EE应用开发详解>>一书全部的源代码. 本书基于J2EE 1.4平台
💻 JAD
字号:
// Decompiled by DJ v2.5.5.45 Copyright 2000 Atanas Neshkov  Date: 2003-11-10 23:21:32
// Home Page : http//members.fortunecity.com/neshkov/dj.html  - Check often for new version!
// Decompiler options: packimports(3) 
// Source File Name:   WeatherServlet.java

package com.j2ee14.ch21;

import java.io.IOException;
import java.net.URL;
import javax.servlet.RequestDispatcher;
import javax.servlet.ServletException;
import javax.servlet.http.*;
import javax.xml.namespace.QName;
import javax.xml.rpc.Service;
import javax.xml.rpc.ServiceFactory;

// Referenced classes of package com.j2ee14.ch21:
//            WeatherForecastService

public class WeatherServlet extends HttpServlet
{

    public WeatherServlet()
    {
        UrlString = "http://localhost:8000/WeatherForecastService?WSDL";
        nameSpaceUri = "urn:WeatherForecast";
        serviceName = "MyWeatherForecastService";
        portName = "WeatherForecastServicePort";
    }

    public void doGet(HttpServletRequest httpservletrequest, HttpServletResponse httpservletresponse)
        throws ServletException, IOException
    {
        String s = httpservletrequest.getParameter("action");
        String s1 = httpservletrequest.getParameter("zone");
        String s2 = "/index.jsp";
        try
        {
            URL url = new URL(UrlString);
            ServiceFactory servicefactory = ServiceFactory.newInstance();
            Service service1 = servicefactory.createService(url, new QName(nameSpaceUri, serviceName));
            WeatherForecastService weatherforecastservice = (WeatherForecastService)service1.getPort(new QName(nameSpaceUri, portName), class$com$j2ee14$ch21$WeatherForecastService != null ? class$com$j2ee14$ch21$WeatherForecastService : (class$com$j2ee14$ch21$WeatherForecastService = class$("com.j2ee14.ch21.WeatherForecastService")));
            if(s.equals("/getTemperature"))
            {
                float f = weatherforecastservice.getTemperature(s1);
                httpservletrequest.setAttribute("tempture", new Float(f));
                s2 = "/viewTempture.jsp";
            } else
            if(s.equals("getDescription"))
            {
                String s3 = weatherforecastservice.getDescription(s1);
                httpservletrequest.setAttribute("description", s3);
                s2 = "/viewDescription.jsp";
            } else
            if(s.equals("createNewWeatherRecoder"))
            {
                float f1 = Float.parseFloat(httpservletrequest.getParameter("tempture"));
                weatherforecastservice.createNewWeatherRecoder(s1, f1);
                s2 = "/sucess.html";
            } else
            if(s.equals("modifyWeatherRecoder"))
            {
                float f2 = Float.parseFloat(httpservletrequest.getParameter("tempture"));
                weatherforecastservice.modifyWeatherRecoder(s1, f2);
                s2 = "/sucess.html";
            }
        }
        catch(Exception exception)
        {
            s2 = "/error.jsp";
            exception.printStackTrace();
        }
        RequestDispatcher requestdispatcher = httpservletrequest.getRequestDispatcher(s2);
        requestdispatcher.forward(httpservletrequest, httpservletresponse);
    }

    public void service(HttpServletRequest httpservletrequest, HttpServletResponse httpservletresponse)
        throws ServletException, IOException
    {
        doGet(httpservletrequest, httpservletresponse);
    }

    static Class class$(String s)
    {
        try
        {
            return Class.forName(s);
        }
        catch(ClassNotFoundException classnotfoundexception)
        {
            throw new NoClassDefFoundError(classnotfoundexception.getMessage());
        }
    }

    String UrlString;
    String nameSpaceUri;
    String serviceName;
    String portName;
    static Class class$com$j2ee14$ch21$WeatherForecastService; /* synthetic field */
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -