// StreetRouterImpl.java // Implementation of the StreetRouter CORBA object import java.util.*; import java.io.*; import java.net.*; public class StreetRouterImpl extends Proxy._StreetRouterImplBase { // Constructor of this class public StreetRouterImpl (String name) { super(name); return; } // Implementation of the method lookupdirections // The parameters would something like: // frocity: stanford // fromstate: california // tocity: san francisco // tostate: california // // The result of calling this method is a string with street directions // from one point ot the other public String lookupdirections(String fromcity, String fromstate, String tocity, String tostate) { try { // Here we build the URL and connect to the web server URL url = new URL("http://www.mapquest.com/cgi-bin/mqtrip?OPC=-1&ADDR_ORIGIN=&CITY_ORIGIN="+fromcity.replace(' ', '+')+"&STATE_ORIGIN="+fromstate+"&DPC=-1&ADDR_DESTINATION=&CITY_DESTINATION="+tocity.replace(' ', '+')+"&STATE_DESTINATION="+tostate+"&quest_mode=trip&results_display_mode=text"); URLConnection connection=url.openConnection(); DataInputStream d = new DataInputStream(connection.getInputStream()); // Extracting the directions String directions="Directions from "+fromcity+", "+fromstate+" to "+tocity+", "+tostate+":"; String line = d.readLine(); String substring = ""; try { do { line = d.readLine(); if (line.indexOf(substring) != -1) directions=directions+"\n"+line.substring(line.indexOf(substring)+substring.length(),line.indexOf("