IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)
Navigation

Inscrivez-vous gratuitement
pour pouvoir participer, suivre les réponses en temps réel, voter pour les messages, poser vos propres questions et recevoir la newsletter

Tomcat et TomEE Java Discussion :

[Tomcat]connexion a une servlet


Sujet :

Tomcat et TomEE Java

  1. #1
    Membre du Club
    Profil pro
    Inscrit en
    Février 2003
    Messages
    59
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Février 2003
    Messages : 59
    Points : 41
    Points
    41
    Par défaut [Tomcat]connexion a une servlet
    Bonjour

    voila je vais peut être m'offrir un hebergement java/tomcat et je souhaite avoir une information avant de franchir le pas :

    Si j'ai une application cliente java sur mon ordinateur, est il possible de me connecter à distance à une servlet afin de receuillir des informations qui se trouve dans une base de données chez mon hebergeur ?

    Faut-il des droits speciaux ou autres ? et avec quel méthode proceder ?

    merci




    [Modéré par Didier]
    Ajout de tag dans le titre
    Lire les règles du forum : Règles du forum Java

  2. #2
    Membre actif Avatar de austin P.
    Inscrit en
    Juin 2004
    Messages
    182
    Détails du profil
    Informations personnelles :
    Âge : 50

    Informations forums :
    Inscription : Juin 2004
    Messages : 182
    Points : 239
    Points
    239
    Par défaut
    ce type de réponse se trouveront surement dans la FAQ de l'hébergeur

  3. #3
    Membre du Club
    Profil pro
    Inscrit en
    Février 2003
    Messages
    59
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Février 2003
    Messages : 59
    Points : 41
    Points
    41
    Par défaut
    bah euh non, l'hebergeur est tres tres avart en explication (3€ /mois...)

  4. #4
    Rédacteur
    Avatar de lunatix
    Homme Profil pro
    Architecte technique
    Inscrit en
    Novembre 2002
    Messages
    1 960
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Val de Marne (Île de France)

    Informations professionnelles :
    Activité : Architecte technique

    Informations forums :
    Inscription : Novembre 2002
    Messages : 1 960
    Points : 3 736
    Points
    3 736
    Par défaut
    Citation Envoyé par kaiser2003
    bah euh non, l'hebergeur est tres tres avart en explication (3€ /mois...)
    3€ par mois pour un hebergement tomcat ? c ou ???

  5. #5
    Membre du Club
    Profil pro
    Inscrit en
    Février 2003
    Messages
    59
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Février 2003
    Messages : 59
    Points : 41
    Points
    41
    Par défaut
    http://www.eatj.com il y a egalement un compte gratuit que j'essaie actuellement.

    Mais bon apparement faut faire gaffe a ce qu'on fait :

    Je fesait des essai sur le fichier server.xml et j'ai du me tromper => Bilan, mon site ne marche plus et je peut plus y acceder...

  6. #6
    Membre actif Avatar de austin P.
    Inscrit en
    Juin 2004
    Messages
    182
    Détails du profil
    Informations personnelles :
    Âge : 50

    Informations forums :
    Inscription : Juin 2004
    Messages : 182
    Points : 239
    Points
    239
    Par défaut
    on peux peut etre t'aider mais il faudrait que tu sois plus explicatif sur ton problème (une trace, un fichier de conf, etc...)

  7. #7
    Membre du Club
    Profil pro
    Inscrit en
    Février 2003
    Messages
    59
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Février 2003
    Messages : 59
    Points : 41
    Points
    41
    Par défaut
    ah et bien ca va être difficile, mais bon je peux toujours expliquer ce que je veux faire :

    Imaginons par exemple que je developpe une application d'annuaire telephonique en java (application a executer sur un poste client). Toutes les donnees (nom, tel...) doivent etre enregistrer sur une base de donnees chez un hebergeur. Il faut donc que mon application se connecte a la base de donnees distante. Or, je ne desire pas utiliser JDBC dans cette application pour cause de securite (l'application contiendra le mot de passe du SGBD). J'ai fait pas mal de recherche avec des methode de crypto, mais le problème demeure helas puisque la cle est recupérable. Donc la seule solution que je voit, c'est de me connecter à une application serveur (style servlet) qui elle contiendra le mot de passe et effectura la requete puis enverra le resultat à l'application cliente.

    Donc je veux juste savoir si c'est possible cette histoire sachant que mon hebergeur n'ouvre que le port 80.

    voila, en esperant avoir ete un peut plus clair.

    je peux te donner, le contenu du fichier server.xml :
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    68
    69
    70
    71
    72
    73
    74
    75
    76
    77
    78
    79
    80
    81
    82
    83
    84
    85
    86
    87
    88
    89
    90
    91
    92
    93
    94
    95
    96
    97
    98
    99
    100
    101
    102
    103
    104
    105
    106
    107
    108
    109
    110
    111
    112
    113
    114
    115
    116
    117
    118
    119
    120
    121
    122
    123
    124
    125
    126
    127
    128
    129
    130
    131
    132
    133
    134
    135
    136
    137
    138
    139
    140
    141
    142
    143
    144
    145
    146
    147
    148
    149
    150
    151
    152
    153
    154
    155
    156
    157
    158
    159
    160
    161
    162
    163
    164
    165
    166
    167
    168
    169
    170
    171
    172
    173
    174
    175
    176
    177
    178
    179
    180
    181
    182
    183
    184
    185
    186
    187
    188
    189
    190
    191
    192
    193
    194
    195
    196
    197
    198
    199
    200
    201
    202
    203
    204
    205
    206
    207
    208
    209
    210
    211
    212
    213
    214
    215
    216
    217
    218
    219
    220
    221
    222
    223
    224
    225
    226
    227
    228
    229
    230
    231
    232
    233
    234
    235
    236
    237
    238
    239
    240
    241
    242
    243
    244
    245
    246
    247
    248
    249
    250
    251
    252
    253
    254
    255
    256
    257
    258
    259
    260
    261
    262
    263
    264
    265
    266
    267
    268
    269
    270
    271
    272
    273
    274
    275
    276
    277
    278
    279
    280
    281
    282
    283
    284
    285
    286
    287
    288
    289
    290
    291
    292
    293
    294
    295
    296
    297
    298
    299
    300
    301
    302
    303
    304
    305
    306
    307
    308
    309
    310
    311
    312
    313
    314
    315
    316
    317
    318
    319
    320
    321
    322
    323
    324
    325
    326
    327
    328
    329
    330
    331
    332
    333
    334
     
    <Server port="8225" shutdown="SHUTDOWN" debug="0">
     
     
      <!-- Comment these entries out to disable JMX MBeans support -->
      <!-- You may also configure custom components (e.g. Valves/Realms) by 
           including your own mbean-descriptor file(s), and setting the 
           "descriptors" attribute to point to a ';' seperated list of paths
           (in the ClassLoader sense) of files to add to the default list.
           e.g. descriptors="/com/myfirm/mypackage/mbean-descriptor.xml"
      -->
      <Listener className="org.apache.catalina.mbeans.ServerLifecycleListener" debug="0" />
      <Listener className="org.apache.catalina.mbeans.GlobalResourcesLifecycleListener" debug="0" />
     
      <!-- Global JNDI resources -->
      <GlobalNamingResources>
     
        <!-- Test entry for demonstration purposes -->
        <Environment name="simpleValue" type="java.lang.Integer" value="30" />
     
        <!-- Editable user database that can also be used by
             UserDatabaseRealm to authenticate users -->
        <Resource name="UserDatabase" auth="Container" type="org.apache.catalina.UserDatabase" description="User database that can be updated and saved">
        </Resource>
        <ResourceParams name="UserDatabase">
          <parameter>
            <name>factory</name>
            <value>org.apache.catalina.users.MemoryUserDatabaseFactory</value>
          </parameter>
          <parameter>
            <name>pathname</name>
            <value>conf/tomcat-users.xml</value>
          </parameter>
        </ResourceParams>
     
      </GlobalNamingResources>
     
      <!-- A "Service" is a collection of one or more "Connectors" that share
           a single "Container" (and therefore the web applications visible
           within that Container).  Normally, that Container is an "Engine",
           but this is not required.
     
           Note:  A "Service" is not itself a "Container", so you may not
           define subcomponents such as "Valves" or "Loggers" at this level.
       -->
     
      <!-- Define the Tomcat Stand-Alone Service -->
      <Service name="Catalina">
     
        <!-- A "Connector" represents an endpoint by which requests are received
             and responses are returned.  Each Connector passes requests on to the
             associated "Container" (normally an Engine) for processing.
     
             By default, a non-SSL HTTP/1.1 Connector is established on port 8080.
             You can also enable an SSL HTTP/1.1 Connector on port 8443 by
             following the instructions below and uncommenting the second Connector
             entry.  SSL support requires the following steps (see the SSL Config
             HOWTO in the Tomcat 5 documentation bundle for more detailed
             instructions):
             * If your JDK version 1.3 or prior, download and install JSSE 1.0.2 or
               later, and put the JAR files into "$JAVA_HOME/jre/lib/ext".
             * Execute:
                 %JAVA_HOME%\bin\keytool -genkey -alias tomcat -keyalg RSA (Windows)
                 $JAVA_HOME/bin/keytool -genkey -alias tomcat -keyalg RSA  (Unix)
               with a password value of "changeit" for both the certificate and
               the keystore itself.
     
             By default, DNS lookups are enabled when a web application calls
             request.getRemoteHost().  This can have an adverse impact on
             performance, so you can disable it by setting the
             "enableLookups" attribute to "false".  When DNS lookups are disabled,
             request.getRemoteHost() will return the String version of the
             IP address of the remote client.
        -->
     
        <!-- Define a non-SSL Coyote HTTP/1.1 Connector on port 8080 -->
        <Connector port="9225" maxThreads="150" minSpareThreads="25" maxSpareThreads="75" enableLookups="false" redirectPort="8443" acceptCount="100" debug="0" connectionTimeout="20000" disableUploadTimeout="true" />
        <!-- Note : To disable connection timeouts, set connectionTimeout value
         to 0 -->
     
    	<!-- Note : To use gzip compression you could set the following properties :
     
    			   compression="on" 
    			   compressionMinSize="2048" 
    			   noCompressionUserAgents="gozilla, traviata" 
    			   compressableMimeType="text/html,text/xml"
    	-->
     
        <!-- Define a SSL Coyote HTTP/1.1 Connector on port 8443 -->
        <!--
        <Connector port="8443" 
                   maxThreads="150" minSpareThreads="25" maxSpareThreads="75"
                   enableLookups="false" disableUploadTimeout="true"
                   acceptCount="100" debug="0" scheme="https" secure="true"
                   clientAuth="false" sslProtocol="TLS" />
        -->
     
        <!-- Define a Coyote/JK2 AJP 1.3 Connector on port 8009 -->
        <Connector port="7225" enableLookups="false" redirectPort="8443" debug="0" protocol="AJP/1.3" />
     
        <!-- Define a Proxied HTTP/1.1 Connector on port 8082 -->
        <!-- See proxy documentation for more information about using this. -->
        <!--
        <Connector port="8082" 
                   maxThreads="150" minSpareThreads="25" maxSpareThreads="75"
                   enableLookups="false"
                   acceptCount="100" debug="0" connectionTimeout="20000"
                   proxyPort="80" disableUploadTimeout="true" />
        -->
     
        <!-- An Engine represents the entry point (within Catalina) that processes
             every request.  The Engine implementation for Tomcat stand alone
             analyzes the HTTP headers included with the request, and passes them
             on to the appropriate Host (virtual host). -->
     
        <!-- You should set jvmRoute to support load-balancing via JK/JK2 ie :
        <Engine name="Standalone" defaultHost="localhost" debug="0" jvmRoute="jvm1">         
        --> 
     
        <!-- Define the top level container in our container hierarchy -->
        <Engine name="Catalina" defaultHost="localhost" debug="0">
     
          <!-- The request dumper valve dumps useful debugging information about
               the request headers and cookies that were received, and the response
               headers and cookies that were sent, for all requests received by
               this instance of Tomcat.  If you care only about requests to a
               particular virtual host, or a particular application, nest this
               element inside the corresponding <Host> or <Context> entry instead.
     
               For a similar mechanism that is portable to all Servlet 2.4
               containers, check out the "RequestDumperFilter" Filter in the
               example application (the source for this filter may be found in
               "$CATALINA_HOME/webapps/examples/WEB-INF/classes/filters").
     
               Request dumping is disabled by default.  Uncomment the following
               element to enable it. -->
          <!--
          <Valve className="org.apache.catalina.valves.RequestDumperValve"/>
          -->
     
          <!-- Global logger unless overridden at lower levels -->
          <Logger className="org.apache.catalina.logger.FileLogger" prefix="catalina_log." suffix=".txt" timestamp="true" />
     
          <!-- Because this Realm is here, an instance will be shared globally -->
     
          <!-- This Realm uses the UserDatabase configured in the global JNDI
               resources under the key "UserDatabase".  Any edits
               that are performed against this UserDatabase are immediately
               available for use by the Realm.  -->
          <Realm className="org.apache.catalina.realm.UserDatabaseRealm" debug="0" resourceName="UserDatabase" />
     
          <!-- Comment out the old realm but leave here for now in case we
               need to go back quickly -->
          <!--
          <Realm className="org.apache.catalina.realm.MemoryRealm" />
          -->
     
          <!-- Replace the above Realm with one of the following to get a Realm
               stored in a database and accessed via JDBC -->
     
          <!--
          <Realm  className="org.apache.catalina.realm.JDBCRealm" debug="99"
                 driverName="org.gjt.mm.mysql.Driver"
              connectionURL="jdbc:mysql://localhost/authority"
             connectionName="test" connectionPassword="test"
                  userTable="users" userNameCol="user_name" userCredCol="user_pass"
              userRoleTable="user_roles" roleNameCol="role_name" />
          -->
     
          <!--
          <Realm  className="org.apache.catalina.realm.JDBCRealm" debug="99"
                 driverName="oracle.jdbc.driver.OracleDriver"
              connectionURL="jdbc:oracle:thin:@ntserver:1521:ORCL"
             connectionName="scott" connectionPassword="tiger"
                  userTable="users" userNameCol="user_name" userCredCol="user_pass"
              userRoleTable="user_roles" roleNameCol="role_name" />
          -->
     
          <!--
          <Realm  className="org.apache.catalina.realm.JDBCRealm" debug="99"
                 driverName="sun.jdbc.odbc.JdbcOdbcDriver"
              connectionURL="jdbc:odbc:CATALINA"
                  userTable="users" userNameCol="user_name" userCredCol="user_pass"
              userRoleTable="user_roles" roleNameCol="role_name" />
          -->
     
          <!-- Define the default virtual host
               Note: XML Schema validation will not work with Xerces 2.2.
           -->
          <Host name="localhost" debug="0" appBase="webapps" unpackWARs="true" autoDeploy="true" xmlValidation="false" xmlNamespaceAware="false">
     
            <!-- Defines a cluster for this node,
                 By defining this element, means that every manager will be changed.
                 So when running a cluster, only make sure that you have webapps in there
                 that need to be clustered and remove the other ones.
                 A cluster has the following parameters:
     
                 className = the fully qualified name of the cluster class
     
                 name = a descriptive name for your cluster, can be anything
     
                 debug = the debug level, higher means more output
     
                 mcastAddr = the multicast address, has to be the same for all the nodes
     
                 mcastPort = the multicast port, has to be the same for all the nodes
     
                 mcastFrequency = the number of milliseconds in between sending a "I'm alive" heartbeat
     
                 mcastDropTime = the number a milliseconds before a node is considered "dead" if no heartbeat is received
     
                 tcpThreadCount = the number of threads to handle incoming replication requests, optimal would be the same amount of threads as nodes 
     
                 tcpListenAddress = the listen address (bind address) for TCP cluster request on this host, 
                                    in case of multiple ethernet cards.
                                    auto means that address becomes
                                    InetAddress.getLocalHost().getHostAddress()
     
                 tcpListenPort = the tcp listen port
     
                 tcpSelectorTimeout = the timeout (ms) for the Selector.select() method in case the OS
                                      has a wakup bug in java.nio. Set to 0 for no timeout
     
                 printToScreen = true means that managers will also print to std.out
     
                 expireSessionsOnShutdown = true means that 
     
                 useDirtyFlag = true means that we only replicate a session after setAttribute,removeAttribute has been called.
                                false means to replicate the session after each request.
                                false means that replication would work for the following piece of code:
                                <%
                                HashMap map = (HashMap)session.getAttribute("map");
                                map.put("key","value");
                                %>
                 replicationMode = can be either 'pooled', 'synchronous' or 'asynchronous'.
                                   * Pooled means that the replication happens using several sockets in a synchronous way. Ie, the data gets replicated, then the request return. This is the same as the 'synchronous' setting except it uses a pool of sockets, hence it is multithreaded. This is the fastest and safest configuration. To use this, also increase the nr of tcp threads that you have dealing with replication.
                                   * Synchronous means that the thread that executes the request, is also the
                                   thread the replicates the data to the other nodes, and will not return until all
                                   nodes have received the information.
                                   * Asynchronous means that there is a specific 'sender' thread for each cluster node,
                                   so the request thread will queue the replication request into a "smart" queue,
                                   and then return to the client.
                                   The "smart" queue is a queue where when a session is added to the queue, and the same session
                                   already exists in the queue from a previous request, that session will be replaced
                                   in the queue instead of replicating two requests. This almost never happens, unless there is a 
                                   large network delay.
            -->             
            <!--
                When configuring for clustering, you also add in a valve to catch all the requests
                coming in, at the end of the request, the session may or may not be replicated.
                A session is replicated if and only if all the conditions are met:
                1. useDirtyFlag is true or setAttribute or removeAttribute has been called AND
                2. a session exists (has been created)
                3. the request is not trapped by the "filter" attribute
     
                The filter attribute is to filter out requests that could not modify the session,
                hence we don't replicate the session after the end of this request.
                The filter is negative, ie, anything you put in the filter, you mean to filter out,
                ie, no replication will be done on requests that match one of the filters.
                The filter attribute is delimited by ;, so you can't escape out ; even if you wanted to.
     
                filter=".*\.gif;.*\.js;" means that we will not replicate the session after requests with the URI
                ending with .gif and .js are intercepted.
            -->
     
            <!--
            <Cluster className="org.apache.catalina.cluster.tcp.SimpleTcpCluster"
                     managerClassName="org.apache.catalina.cluster.session.DeltaManager"
                     expireSessionsOnShutdown="false"
                     useDirtyFlag="true">
     
                <Membership 
                    className="org.apache.catalina.cluster.mcast.McastService"
                    mcastAddr="228.0.0.4"
                    mcastPort="45564"
                    mcastFrequency="500"
                    mcastDropTime="3000"/>
     
                <Receiver 
                    className="org.apache.catalina.cluster.tcp.ReplicationListener"
                    tcpListenAddress="auto"
                    tcpListenPort="4001"
                    tcpSelectorTimeout="100"
                    tcpThreadCount="6"/>
     
                <Sender
                    className="org.apache.catalina.cluster.tcp.ReplicationTransmitter"
                    replicationMode="pooled"/>
     
                <Valve className="org.apache.catalina.cluster.tcp.ReplicationValve"
                       filter=".*\.gif;.*\.js;.*\.jpg;.*\.htm;.*\.html;.*\.txt;"/>
            </Cluster>
            -->        
     
     
     
            <!-- Normally, users must authenticate themselves to each web app
                 individually.  Uncomment the following entry if you would like
                 a user to be authenticated the first time they encounter a
                 resource protected by a security constraint, and then have that
                 user identity maintained across *all* web applications contained
                 in this virtual host. -->
            <!--
            <Valve className="org.apache.catalina.authenticator.SingleSignOn"
                       debug="0"/>
            -->
     
            <!-- Access log processes all requests for this virtual host.  By
                 default, log files are created in the "logs" directory relative to
                 $CATALINA_HOME.  If you wish, you can specify a different
                 directory with the "directory" attribute.  Specify either a relative
                 (to $CATALINA_HOME) or absolute path to the desired directory.
            -->
            <!--
            <Valve className="org.apache.catalina.valves.AccessLogValve"
                     directory="logs"  prefix="localhost_access_log." suffix=".txt"
                     pattern="common" resolveHosts="false"/>
            -->
     
            <!-- Logger shared by all Contexts related to this virtual host.  By
                 default (when using FileLogger), log files are created in the "logs"
                 directory relative to $CATALINA_HOME.  If you wish, you can specify
                 a different directory with the "directory" attribute.  Specify either a
                 relative (to $CATALINA_HOME) or absolute path to the desired
                 directory.-->
            <Logger className="org.apache.catalina.logger.FileLogger" directory="logs" prefix="localhost_log." suffix=".txt" timestamp="true" />
     
          </Host>
     
        </Engine>
     
      </Service>
     
    </Server>

  8. #8
    Membre actif Avatar de austin P.
    Inscrit en
    Juin 2004
    Messages
    182
    Détails du profil
    Informations personnelles :
    Âge : 50

    Informations forums :
    Inscription : Juin 2004
    Messages : 182
    Points : 239
    Points
    239
    Par défaut
    tu peut utiliser la solution de servlet qui renvoient des tableaux de chaines représentants le résultat de la requete ou du xml

  9. #9
    Membre du Club
    Profil pro
    Inscrit en
    Février 2003
    Messages
    59
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Février 2003
    Messages : 59
    Points : 41
    Points
    41
    Par défaut
    oui c'est se que comptait faire mais peux tu me dire des noms de methode pour acceder a la servlet et pour que le servlet me reponde histoire de savoir ou cherhcer.

    merci

  10. #10
    Membre habitué
    Inscrit en
    Juillet 2004
    Messages
    152
    Détails du profil
    Informations forums :
    Inscription : Juillet 2004
    Messages : 152
    Points : 173
    Points
    173
    Par défaut
    C'est un truc comme ca que tu cherches ?

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
        URL url = new URL("http://www.google.fr");
     
        URLConnection conn = url.openConnection();
     
        InputStream is = conn.getInputStream();
        byte[] bytes = new byte[1024];
        int len = 0;
     
        while ((len = is.read(bytes)) != -1) {
          System.out.println(new String(bytes, 0, len));
        }

  11. #11
    Membre du Club
    Profil pro
    Inscrit en
    Février 2003
    Messages
    59
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Février 2003
    Messages : 59
    Points : 41
    Points
    41
    Par défaut
    oui merci dude ca doit ressembler a ca mais si je veux recevoir des objets serialisés de la servlet quel code je peux bien faire ds la servlet et dans mon appli ?

    (je sais je sis un peu insistant mais bon...)

  12. #12
    Membre habitué
    Inscrit en
    Juillet 2004
    Messages
    152
    Détails du profil
    Informations forums :
    Inscription : Juillet 2004
    Messages : 152
    Points : 173
    Points
    173
    Par défaut
    Ben essaye avec un ObjectOutputSteam dans ta servlet et un ObjectInputStream dans ton appli

  13. #13
    Membre du Club
    Profil pro
    Inscrit en
    Février 2003
    Messages
    59
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Février 2003
    Messages : 59
    Points : 41
    Points
    41
    Par défaut
    ah bah oui je suis un peu con moi... Merci beaucoup ca devrait allez

  14. #14
    En attente de confirmation mail
    Inscrit en
    Avril 2005
    Messages
    2
    Détails du profil
    Informations forums :
    Inscription : Avril 2005
    Messages : 2
    Points : 2
    Points
    2
    Par défaut la réponse ?
    Salut,

    Moi j'ai un problème identique. J'aimerai me connecter à une page WEB quelconque afin de récupérer les données de la page.

    Voici mon code :
    public static void main(String[] args) throws Exception {
    //URL yahoo = new URL("http://syssta:8080/");
    //URL yahoo = new URL("http://www.yahoo.fr");
    URL yahoo = new URL("http://localhost:8080/");
    URLConnection yc = yahoo.openConnection();
    BufferedReader in = new BufferedReader(
    new InputStreamReader(
    yc.getInputStream()));
    String inputLine;

    while ((inputLine = in.readLine()) != null)
    System.out.println(inputLine);
    System.out.println(yahoo.getHost());
    in.close();
    }


    Lorsque je me connecte au poste syssta, aucun problème mais pour le cas de yahoo et de mon poste cela ne fonctionne pas. Comment faire ?

    Merci

+ Répondre à la discussion
Cette discussion est résolue.

Discussions similaires

  1. Réponses: 0
    Dernier message: 23/05/2013, 05h22
  2. Réponses: 4
    Dernier message: 05/01/2012, 17h26
  3. Problem de connexion d'une servlet avec une base de données Postgres
    Par lhaj-boolean dans le forum Servlets/JSP
    Réponses: 1
    Dernier message: 01/02/2010, 09h39
  4. [TOMCAT] Problème de timeout d'une servlet
    Par tuxor dans le forum Tomcat et TomEE
    Réponses: 5
    Dernier message: 18/09/2007, 12h04
  5. [Tomcat]Connexion à une DataSource Oracle
    Par iceman dans le forum Tomcat et TomEE
    Réponses: 2
    Dernier message: 04/08/2003, 16h48

Partager

Partager
  • Envoyer la discussion sur Viadeo
  • Envoyer la discussion sur Twitter
  • Envoyer la discussion sur Google
  • Envoyer la discussion sur Facebook
  • Envoyer la discussion sur Digg
  • Envoyer la discussion sur Delicious
  • Envoyer la discussion sur MySpace
  • Envoyer la discussion sur Yahoo