Hi,

I created a simple java file that perform invocation of a remote service.

i have deployed the class file into the WEB-INF/lib directory of my MT server 
and added the servlet mapping in the web.xml file :

OS: Linux RH 5, Tomcat 7.

MT 8.1. SP1



<servlet>

<servlet-name>RestCall</servlet-name>

<servlet-class>RestCall</servlet-class>

<init-param>

      <param-name>logLocation</param-name>

      <param-value>/prjvl01/bmc/ARSystem/midtier/logs/</param-value>

   </init-param>

</servlet>

<servlet-mapping>

<servlet-name>RestCall</servlet-name>

<url-pattern>/servlets/RestCall</url-pattern>

</servlet-mapping>



for some reason i am unable to invoke the servlet with my params...



attached snip from the simple servlet:

public void doGet(HttpServletRequest request,HttpServletResponse response)

  throws IOException, ServletException

  {

  if (request.getParameter("getURL") != null)

  {

  try {

  String tmpStr = request.getParameter("getURL");



  URL url = new URL(tmpStr);

  HttpURLConnection conn = (HttpURLConnection) url.openConnection();

  conn.setRequestMethod("GET");

  conn.setRequestProperty("Accept", "application/json");



  if (conn.getResponseCode() != 200) {

  throw new RuntimeException("Failed : HTTP error code : "

  + conn.getResponseCode());

  }



  BufferedReader br = new BufferedReader(new InputStreamReader(

  (conn.getInputStream())));



  String output;

  while ((output = br.readLine()) != null) {

  System.out.println(output);

  }



  conn.disconnect();



   } catch (MalformedURLException e) {



  e.printStackTrace();



   } catch (IOException e) {



    e.printStackTrace();

   }

  }



  }



i would really appreciate your help on this....



Tzachi



_______________________________________________________________________________
UNSUBSCRIBE or access ARSlist Archives at www.arslist.org
"Where the Answers Are, and have been for 20 years"

Reply via email to