Hi

I need to convert this php code into jsp code. The code test if there is a post request and if there is the code grab posted params from the post sequence and make a query string of posted variables, than pas this string to an external script to be fetched and return the value received.
Especially I don't know how to do the following :

1 - Test if there is a post request
2 - Build a query string of all posted data
3 - An equivalent to file_get_contents in php

Below is the entire php code :

<?php

$query_stringxyz = "";
if($_SERVER['REQUEST_METHOD'] == 'POST'){
$kvxyz=array();
foreach($_POST as $key=>$value){
$kvxyz[]="$key=$value";
}
$query_stringxyz = join("&",$kvxyz);
$urlxyz = "http://externalwebsite.com/catch.php?" . $query_stringxyz;
$contentxyz = file_get_contents($urlxyz);
}else{
$query_stringxyz = $_SERVER['QUERY_STRING'];
}

?>

Regards