R
RC
To get all httpd environment variables in CGI/Perl
is very easy as below:
print "Content-type: text/plain\n\n";
if ($ENV{'REQUEST_METHOD'} eq "POST") {
read (STDIN,$in,$ENV{'CONTENT_LENGTH'});
print "$in\n";
}
foreach $var (sort(keys(%ENV))) {
$val = $ENV{$var};
$val =~ s|\n|\\n|g;
$val =~ s|"|\\"|g;
print "${var}=\"${val}\"\n";
}
But how to do that in JSP/Servlet?
I know javax.servlet.http.HttpServletRequest
has many getXXXX() methods. But it is not
enought get all the environment variables.
Does anyone out there know a/some method(s)
in JSP/Servlet can get all httpd environment
variables?
Thank Q very much in advance!
is very easy as below:
print "Content-type: text/plain\n\n";
if ($ENV{'REQUEST_METHOD'} eq "POST") {
read (STDIN,$in,$ENV{'CONTENT_LENGTH'});
print "$in\n";
}
foreach $var (sort(keys(%ENV))) {
$val = $ENV{$var};
$val =~ s|\n|\\n|g;
$val =~ s|"|\\"|g;
print "${var}=\"${val}\"\n";
}
But how to do that in JSP/Servlet?
I know javax.servlet.http.HttpServletRequest
has many getXXXX() methods. But it is not
enought get all the environment variables.
Does anyone out there know a/some method(s)
in JSP/Servlet can get all httpd environment
variables?
Thank Q very much in advance!