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

📄 conductorcontrollerservlet.java

📁 Sun公司Dream项目
💻 JAVA
📖 第 1 页 / 共 5 页
字号:
/*
 * The contents of this file are subject to the terms
 * of the Common Development and Distribution License
 * (the "License").  You may not use this file except
 * in compliance with the License.
 *
 * You can obtain a copy of the license at
 * http://www.opensource.org/licenses/cddl1.php
 * See the License for the specific language governing
 * permissions and limitations under the License.
 *
 * When distributing Covered Code, include this CDDL
 * HEADER in each file and include the License file at
 * http://www.opensource.org/licenses/cddl1.php.  If
 * applicable, add the following below this CDDL HEADER,
 * with the fields enclosed by brackets "[]" replaced
 * with your own identifying information:
 * Portions Copyright [yyyy]
 * [name of copyright owner]
 */

/*
 * $(@)ConductorControllerServlet.java $Revision: 1.3 $ $Date: 2006/09/20 01:40:36 $
 *
 * Copyright 2006 Sun Microsystems, Inc. All Rights Reserved.
 */
/*
 * ConductorControllerServlet.java
 *
 * Created on October 10, 2005, 3:57 PM
 *
 */

package com.sun.sjc.idtv.vod.server.comm;

import java.io.*;
import java.sql.*;
import java.util.*;
import java.util.Date;
import javax.servlet.*;
import javax.naming.*;
import javax.servlet.http.*;
import javax.rmi.PortableRemoteObject;
import javax.ejb.*;
import com.sun.sjc.idtv.vod.server.conductor.*;
import com.sun.sjc.idtv.vod.server.subscriber.*;
import com.sun.sjc.idtv.vod.server.mediacatalog.*;
import com.sun.sjc.idtv.vod.server.billing.*;
import com.sun.sjc.idtv.vod.server.auditing.*;
import com.sun.sjc.idtv.vod.shared.data.*;
import java.util.Random;
import com.sun.dream.*;
import java.net.URLDecoder;
import java.util.logging.Logger;

import org.omc.dream.mmi.common.*;



import javax.crypto.*;
import sun.misc.*;
import java.security.*;
import java.net.*;


import sun.misc.*;

public class ConductorControllerServlet extends HttpServlet{
    
    
    private HashMap osLicenseServerURLMap = new HashMap();
    public static Hashtable smsVerificationTable = new Hashtable();
    
    public static Properties iProperties = new Properties();
    public static  Random randomGenerator = new Random();
    private static final String NOTIFY_JSP = "/notify.jsp";
    private static String SIGNATURE =
            "MIIBSwIBADCCASsGByqGSM44BAEwggEeAoGBALkb2b7x4VPvCDmGWpEbLqE0ZDfq9PmlAynaVVXn2jDckPuX3ldKDzBwSm8Wo0XH20Q4R38ol7gx5yPmCrdH0UBrqvJrr7wQYDYBgRC2vGaaFdVGgumLL+cPZWN2O7olAVTRZGCCUlpqxFRgk5+d1WawFjv6fNYNYbSLEHDKQK3NAhUA+ANZpnjH2aWV/G/Wr5yHBzL3CW0CgYAIO6ZXeLJLz1cUk8mQqaja4wgb1aOAhwURdijheZee8S44/RAQLAuAvme35NoEprjLZ/NgwYfN1N/kWjJ8dmOBAcwz4jK/qS8/U56b8GUdVsMy9a3wRrQqP+ftmRvYMHPHIh6LXs0sQwqtch3igwaHYbevh2PSdh3KNVjGsuZWxQQXAhUAj0ctpqfuQg6+VLNIFKT6AGtkUBk=";
    
    private static Logger logger = Logger.getLogger(ConductorControllerServlet.class.getName());
    VoucherGeneratorHelper voucherGeneratorCreator = new VoucherGeneratorHelper();
    String drmType;
    
    SubscriberManagementSystem sms;
    SubscriberManagementSystemHome smsHome;
    MediaCatalog mediacat;
    MediaCatalogHome mediacatHome;
    conductor cond;
    conductorHome condHome;
    InitialContext initContext = null;
    AuthPlugin authPlugin;
    Class authPluginClass;
    
    String JNDIName;
    
    Object objref;
    /** Creates a new instance of ConductorControllerServlet */
    public ConductorControllerServlet() {
    }
    
    public void init() throws ServletException {
        
        super.init();
        ServletConfig config = this.getServletConfig();
        //String mailDomain = config.getInitParameter(Const.MAIL_DOMAIN);
        String mailSubject = config.getInitParameter(Const.MAIL_SUBJECT);
        String mailFrom = config.getInitParameter(Const.MAIL_FROM);
        String timeoutInterval =
                config.getInitParameter(Const.TIMEOUT_INTERVAL);
        String refreshInterval =
                config.getInitParameter(Const.REFRESH_INTERVAL);
        String licenseServer = config.getInitParameter(Const.LICENSE_SERVER);
        String signature = config.getInitParameter(Const.SIGNATURE);
        String sendSMSVia = config.getInitParameter(Const.SMS_VIA);
        String drmTypesStr = config.getInitParameter(Const.DRM_TYPES);
        if (drmTypesStr == null) {
            throw new ServletException("Missing required parameter: " + Const.DRM_TYPES);
        }
        
        String[] drmTypes = StringUtil.splitString(drmTypesStr, ",");
        for (int i=0; i<drmTypes.length; i++) {
            String lsURL = config.getInitParameter("opera." + drmTypes[i] + ".license_server_url");
            if (lsURL == null) throw new ServletException("Missing license server URL for " +drmTypes[i]);
            osLicenseServerURLMap.put(drmTypes[i], lsURL);
        }
        Map vgClassMap = new HashMap();
        for (int i=0; i<drmTypes.length; i++) {
            String vgClass = config.getInitParameter("opera." + drmTypes[i] + ".voucher_generator_class");
            if (vgClass == null) throw new ServletException("Missing voucher generator class for " +drmTypes[i]);
            vgClassMap.put(drmTypes[i], vgClass);
        }
        Map vgClassConfigMap = new HashMap();
        for (int i=0; i<drmTypes.length; i++) {
            String vgClass = config.getInitParameter("opera." + drmTypes[i] + ".voucher_generator_class.config");
            if (vgClass == null) vgClass = "";
            vgClassConfigMap.put(drmTypes[i], vgClass);
        }
        voucherGeneratorCreator.init(vgClassMap, vgClassConfigMap);
        
        try {
            initContext = new javax.naming.InitialContext();
            
            JNDIName = "java:comp/env/ejb/SubscriberManagementSystem";
            objref = initContext.lookup(JNDIName);
            smsHome = (SubscriberManagementSystemHome)PortableRemoteObject.narrow(objref, SubscriberManagementSystemHome.class);
            sms = smsHome.create();
            
            JNDIName = "java:comp/env/ejb/conductor";
            objref = initContext.lookup(JNDIName);
            condHome = (conductorHome)PortableRemoteObject.narrow(objref, conductorHome.class);
            cond = condHome.create();
            
            
            authPluginClass = (Class) getServletContext().getAttribute("authPluginClass");
            try {
                if (authPluginClass == null) {
                    String authPluginClassName = getServletConfig().getInitParameter("AuthPluginClassName");
                    authPluginClass = Class.forName(authPluginClassName);
                    Class authPluginInterface = Class.forName("com.sun.dream.AuthPlugin");
                    if (authPluginInterface.isAssignableFrom(authPluginClass)) {
                        getServletContext().setAttribute("authPluginClass", authPluginClass);
                    } else {
                        authPluginClass = null;
                        System.err.println("authPluginClass is not valid instance of com.sun.dream.AuthPlugin");
                    }
                }
                if (authPluginClass != null)
                    authPlugin = (AuthPlugin) authPluginClass.newInstance();
            } catch (Exception ex) {
                authPluginClass = null;
                System.err.println("authPluginClass could not be found");
                ex.printStackTrace();
            }
        }catch(Exception e) {
            System.out.println("inside init in servlet exception catch");
        }
        
        
        
        
        
    }
    /**
     * The doGet method of the servlet and handles all http GET request.
     * Required by the servlet specification.
     * @exception throws ServletException and IOException.
     *
     */
    public void doGet(HttpServletRequest request,HttpServletResponse response)
    throws ServletException, IOException {
        
        String jspPath = null;
        String errorMessage = null;
        init();
        
        String action = request.getParameter(Const.ACTION);
        logger.info("CONDUCTOR REQUEST.GETQUERYSTRING() "+request.getQueryString());
        
        try {
            
            if (action.equals(Const.REFRESH)) {
                logger.finer("action is:"+action);
                doRefresh(request, response, true);
            } else {
                String userID = null;
                boolean ssoflag = true;
                userID = authPlugin.decodeToken(request, response);
                if (userID == null) {
                    userID=request.getParameter(Const.USERID);
                    ssoflag = false;
                }
                
                Subscriber userInfo = null;
                String timeoutInterval = null;
                String refreshInterval = null;
                String contentID = null;
                String recall = (String) request.getSession().getAttribute(Const.RECALL);
                //logger.finer("recall value :" +recall);
                /*
                 * retrieving parameters from the request url
                 */
                String simNumber = request.getParameter(Const.SIM);
                //String userID = request.getParameter(Const.USERID);
                String shopID = request.getParameter(Const.SHOPID);
                String movieName = request.getParameter(Const.CONTENTID);
                String blockOnLicenseRequest = request.getParameter(
                        Const.BLOCK_ON_LICENSE_REQUEST_PARAM);
                String licenseServerURL = request.getParameter(Const.LICENSE_SERVER_URL);
                logger.info("licenseServerURL="+licenseServerURL);
                String  licenseSignature = request.getParameter(Const.LICENSE_SIGNATURE);
                logger.finer("userID="+userID);
                if (recall != null && "true".equals(recall)) {
                    request.getSession().setAttribute(Const.RECALL, "false");
                    this.doRefresh(request, response, true);
                } else {
                    //logger.finer("shop id from request" + shopID);
                   /* if (shopID == null || "".equals(shopID.trim())) {
                        request.getSession().invalidate();
                        request.setAttribute("Msg", "shop not found");
                        throw new RightsException(
                                RightsException.NULL_ARGUMENT,
                                "Missing shop ID.");
                    }*/
                    //logger.finer("movie id from request" + movieName);
                    
                    if (movieName == null || "".equals(movieName.trim())) {
                        request.getSession().invalidate();
                        request.setAttribute("Msg", "movieid not found");
                        throw new RightsException(
                                RightsException.NULL_ARGUMENT,
                                "Missing content ID.");
                    }
                    
                    jspPath = request.getParameter(Const.JSP_PATH);
                    
                    /* Obtain the movie informationtion for the movie id
                     * from the resquest url from
                     * conductor bean
                     */
                    
                    long userIdL = 0;

⌨️ 快捷键说明

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