Visualizzazione dei risultati da 1 a 7 su 7

Discussione: [JSP]hosting Tomcat

  1. #1
    Utente di HTML.it L'avatar di GabbOne
    Registrato dal
    Mar 2006
    Messaggi
    577

    [JSP]hosting Tomcat

    ragazzi conoscete qualcuno che offre hosting gratuito con supporto tomcat e mySql

    spero che esistano visto che sono entrambi gratuiti , comunque continuo a cercare

  2. #2
    Utente di HTML.it
    Registrato dal
    Apr 2007
    Messaggi
    906
    http://www.myjavaserver.com
    Registrazione gratuita, devi solo risolvere un semplice esercizio java.
    Pero' non ti danno troppo spazio, visto che e' gratis.

  3. #3
    Utente di HTML.it L'avatar di GabbOne
    Registrato dal
    Mar 2006
    Messaggi
    577
    scusa ma non sono molto ferrato con l'inglese ... cosa vuole che ci scrivo in quella funzione?

  4. #4
    Utente di HTML.it
    Registrato dal
    Apr 2007
    Messaggi
    906
    L'array di stringhe 'config' contiene dei percorsi URI e i nome handler associati. 2 valori consecutivi(a coppie) rappresentano l'URI e il suo handler. La funzione 'getHandler'deve ritornare il corretto handler per uno specifico URI passato come stringa.

    L'handler il cui URI "matcha" maggiormente vince se piu' di un URI "matcha". Se nessuno "matcha", ritorna "CeAkxsj" .

    Esempio:

    String[] config: { "/", "MainServlet", "/nav", "NavigationServlet" }
    String requestUri: "/nav/test"

    Correct result: "NavigationServlet"

    In questo esempio, config contiene il mappaggio ("/" per "MainServlet" e "/nav" per "NavigationServlet").
    L'URI in ingresso è"/nav/test.nav", "NavigationServlet" e' la scelta corretta perche' "matcha" maggiormente di "MainServlet".

  5. #5
    Utente di HTML.it L'avatar di GabbOne
    Registrato dal
    Mar 2006
    Messaggi
    577
    Provo a postare quello che nel sito è chiamato Master a simple Java programming challenge

    Signup Challenge
    Master a simple Java programming challenge (STATUS: NOT PASSED)

    As the principal engineer of an HTTP web server, you are responsible for implementing the request processing subsystem of the server.
    An incoming request for a specific resource, identified by an URI, must be dispatched to the appropriate handler according to the server configuration which maps URIs to request handlers. 'HandlerFactory.getHandler' must be implemented:

    public class HandlerFactory
    {
    public String getHandler(String[] config, String requestUri)
    {
    }
    }


    The string array 'config' contains URI patterns and handler names. Two consecutive values form a key-value pair comprised of URI pattern and handler. 'requestUri' represents an incoming request, the URI to match against the configured handlers. 'getHandler' must return the correct handler for a given URI as a string value.

    An URI pattern never contains wildcards and represents the start of an URI string, a prefix. Matching must be implemented accordingly. The handler with the longest matching URI pattern wins if more than one pattern matches. If no handler can be found, "eYXxrE" must be returned.

    Example input:

    String[] config: { "/", "MainServlet", "/nav", "NavigationServlet" }
    String requestUri: "/nav/test"

    Correct result: "NavigationServlet"

    In this example, the configuration contains a mapping of "/" to "MainServlet" and "/nav" to "NavigationServlet". In the case of an incoming URI "/nav/test.nav", "NavigationServlet" is the correct choice because its pattern is longer than that of "MainServlet".

    e poi da da riempire questo metodo
    codice:
    public class HandlerFactory
    {
      public String getHandler(String[] config, String requestUri)
      {
        
    
      }
    }


    Un aiutino a compilare questo metodo

  6. #6
    Utente di HTML.it
    Registrato dal
    Apr 2007
    Messaggi
    906
    Sopra ti ho tradotto il testo dell'esercizio.
    In parole povere:
    hai una stringa requestUri e un array di coppie(URI, handler)
    imposti una variabile index int a -1
    scorri l'array di due in due (in modo da valutare solo gli URI e non gli handler) con un ciclo con indice i
    ad ogni iterazione
    1) controlli se requestUri inizia per la sottostringa config[i]
    2) se inizia confronti se config[i].length>config[index.lenght] (naturalmente quando index e' != -1)
    3) se la condizione e' verificata, salvi il valore di i dentro index
    alla fine se index e' uguale a -1 non hai trovato niente, altrimenti restituisci EDIT config[index+1]

  7. #7
    Utente di HTML.it L'avatar di GabbOne
    Registrato dal
    Mar 2006
    Messaggi
    577
    grazie per l'immenso consiglio che hai postato mi ci vorra' un po di tempo prima di scrverlo
    appena pooso aggiorno questo posto

    adesso se manga

Permessi di invio

  • Non puoi inserire discussioni
  • Non puoi inserire repliche
  • Non puoi inserire allegati
  • Non puoi modificare i tuoi messaggi
  •  
Powered by vBulletin® Version 4.2.1
Copyright © 2025 vBulletin Solutions, Inc. All rights reserved.