Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > Java > Java and JDK > Servlets
Password Reminder
Register
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Servlets section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old November 28th, 2005, 04:59 AM
Registered User
 
Join Date: Nov 2005
Location: , , .
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default Calling a command from a servlet

I'm trying to call a SIPp command from a servlet, this is the response I should get:

Resolving 193.5.226.181...
------------------------------ Scenario Screen -------- [1-4]: Change Screen --
  Call-rate(length) Port Total-time Total-calls Remote-host
  10.0(0 ms)/1.000s 5061 0.00 s 0 193.5.226.181:5060(UDP)

  0 new calls during 0.000 s period 0 ms scheduler resolution
  0 concurrent calls (limit 30) Peak was 0 calls, after 0 s
  0 out-of-call msg (discarded)
  1 open sockets

                                 Messages Retrans Timeout Unexpected-Msg
      INVITE ----------> 0 0
         100 <---------- 0 0 0
         180 <---------- 0 0 0
         200 <---------- E-RTD 0 0 0
         ACK ----------> 0 0
        INFO <---------- 0 0 0
         200 ----------> 0 0
        INFO ----------> 0 0
         100 <---------- 0 0 0
         180 <---------- 0 0 0
         200 <---------- E-RTD 0 0 0
        INFO <---------- 0 0 0
         200 ----------> 0 0
        INFO <---------- 0 0 0
         200 ----------> 0 0
             [ 1000 ms]
         BYE ----------> 0 0 0
         200 <---------- 0 0 0
------ [+|-|*|/]: Adjust rate ---- [q]: Soft exit ---- [p]: Pause traffic -----




And if I launch the servelt I get this:
Resolving 193.5.226.181...
And the other part is somehow kicked out.
I'm using the Tomcat application server


Reply With Quote
  #2 (permalink)  
Old December 23rd, 2005, 11:33 AM
Authorized User
 
Join Date: Dec 2005
Location: Bangalore, , India.
Posts: 12
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Put this snippet in your servlet:

Runtime runtime = Runtime.getRuntime();
Process process = runtime.exec("SIPp"); // or whatever
InputStream is = process.getInputStream();
OutputStream os = response.getOutputStream();

int data = 0;
while((data = is.read()) != -1)
{
    os.write((char)data);
}
response.setContentType("text/plain");


Just invoke this servlet and you should see the output
on the browser

________
Adarsh

Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
problem in calling classes in simple Servlet sanna231 J2EE 6 December 23rd, 2012 01:06 AM
Calling java Servlet from ascx page pradeepnair74 BOOK: ASP.NET AJAX Programmer's Reference : with ASP.NET 2.0 or ASP.NET 3.5 ISBN: 978-0-470-10998-4 0 October 7th, 2008 07:31 AM
calling a java servlet from a asp.net page dub_beat ASP.NET 2.0 Basics 0 April 2nd, 2007 08:31 PM
calling a servlet by clicking a menu? pandian Servlets 1 February 4th, 2006 10:28 AM
calling java servlet from javascript bearfacts Javascript How-To 1 August 26th, 2004 04:57 PM



All times are GMT -4. The time now is 06:26 AM.


Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.