javauis/m2g_qt/javasrc/com/nokia/microedition/m2g/connection/common/M2GConnectionProxyImpl.java
changeset 80 d6dafc5d983f
parent 56 abc41079b313
child 87 1627c337e51e
equal deleted inserted replaced
78:71ad690e91f5 80:d6dafc5d983f
       
     1 /*
       
     2 * Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies).
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description:
       
    15 *
       
    16 */
       
    17 
       
    18 package com.nokia.microedition.m2g.connection.common;
       
    19 
       
    20 import javax.microedition.io.Connector;
       
    21 import javax.microedition.io.StreamConnection;
       
    22 import javax.microedition.io.ConnectionNotFoundException;
       
    23 import java.io.IOException;
       
    24 import java.lang.IllegalArgumentException;
       
    25 import com.nokia.microedition.m2g.connection.*;
       
    26 
       
    27 /**
       
    28  * Connection proxy class
       
    29  */
       
    30 public class M2GConnectionProxyImpl extends M2GConnectionProxy
       
    31 
       
    32 {
       
    33     //--------------------------------------------------
       
    34     // METHODS
       
    35     //--------------------------------------------------
       
    36     /**
       
    37      * Ctor.
       
    38      */
       
    39     public M2GConnectionProxyImpl()
       
    40     {
       
    41     }
       
    42 
       
    43     /**
       
    44      * Open a connection.
       
    45      * @see M2GConnectionProxy#open()
       
    46        */
       
    47     public void open(M2GUrlTokenizer aTokenizer) throws IOException
       
    48     {
       
    49         iBaseUrl   = aTokenizer.getBaseUrl();
       
    50         iSuffixUrl = null; // can't have DRM suffix when opening from stream
       
    51         iConnectionPolicy = new M2GConnectionPolicyImpl();
       
    52         try
       
    53         {
       
    54             iConnection = (StreamConnection)Connector.open(
       
    55                               aTokenizer.getUrl());
       
    56             iInputStream = iConnection.openInputStream();
       
    57         }
       
    58         catch (ConnectionNotFoundException e)
       
    59         {
       
    60             throw new IllegalArgumentException(e.getMessage());
       
    61         }
       
    62     }
       
    63 }