package com.ibm.servconn;
import java.net.*;
import java.io.*;
import java.util.*;
import com.ibm.aurora.*;
public class URLForward {
private String theURL;
private String method;
public URLForward( String theURL ) {
this(theURL,"POST");
}
public URLForward( String theURL, String method ) {
this.theURL = theURL;
this.method = method;
}
public String[] execute() throws BehaviorException {
Vector v = new Vector();
try {
URL theServlet = new URL(theURL);
// establish a connection with the server, but do not connect to
the servlet yet
HttpURLConnection theConnection
= (HttpURLConnection)theServlet.openConnection();
theConnection.setRequestMethod(method);
// now we can connect to the page
theConnection.connect();
// read the results from the servlet as a String
BufferedReader in = new BufferedReader(new
InputStreamReader(theConnection.getInputStream()));
String inputLine;
while ((inputLine = in.readLine()) != null) {
v.addElement(inputLine);
}
in.close();
String da[] = new String[v.size()];
v.copyInto(da);
return da;
}
// have to handle these somehow
catch( MalformedURLException mue ) {
throw new BehaviorException("Malformed URL
address",ServConnBhvrErrors.MALFORMED_URL,mue);
}
catch( IOException ioe ) {
throw new BehaviorException("IOException - the translator might be
down",ServConnBhvrErrors.CANT_CONNECT_TO_SERVER,ioe);
}
}
}
Eric Lubin
T/L 443-6954 External: 561-443-6954
Notes ID: elubin@ibmusm20 External: [EMAIL PROTECTED]
Sebastian Schulz <[EMAIL PROTECTED]> on 05/18/2001
10:58:33 AM
Please respond to [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
cc:
Subject: RequestDispatcher.forward()
hi,
has somebody a work-around to produce the
same behavior as if RequestDispatcher.forward()
would work with absolute URL's?
tanks in advance!
basti