Insert Witty Irony Here

vince kraemer's Weblog


20071231 Monday December 31, 2007

GIGAOM on SIP

I found this message about SIP in my reader today. If you are thinking about doing SIP application development, you might want to look at the capabilities that we are adding to NetBeans to develop SIP Applications and the Sailfin project.

(2007-12-31 10:43:15.0) Permalink

20071218 Tuesday December 18, 2007

All's well in Wellington... At Last!

After the writer's strike sent my favorite shows dark for so long, I was beginning to despair. But good news came today from a world apart, basking in a summertime glow!

My kids are thrilled that their friend may be playing the role of Gandalf once again. They enjoyed seeing Sir Ian McKellen play Lear last spring in Stratford-upon-Avon, but Lear is hard to love... especially when you are 10 and 11.

(2007-12-18 21:42:00.0) Permalink

Using the Test Agent to Debug ClickToDial

I have a rough cut of a write up that describes using the Test Agent to debug the ClickToDial sample app. It is screenshot heavy and verbage light. Since this is a wiki page, please feel free to extend it as seen fit.

(2007-12-18 20:21:40.0) Permalink

20071217 Monday December 17, 2007

SIP Application Development Module Suite for NetBeans 6.0

I have been waiting for some issues to get resolved recently. A couple of them got cleared up in the last week which allowed me to get some updates to folks that are doing SIP application development.

I was able to make a couple minor changes to the development module.

  • Updated the Servlet template to use Freemarker
  • Converted the servlet to conform to the JSR 289 Public Review.
    Of course you know that JSR 289 just published their Public Review... right?
  • Integrated the plumbing for context sensitive help.
    Now, if somebody would start to develop the content for that help.... please?
  • Upgraded the generated sip.xml to conform to sip-app-1_1.xsd instead of sip-app_1_0.dtd.

You may have noticed that I said 'Suite' in the title. I am not trying to put on airs. Yvo Bogers contributed a new "module" that you can see in the list of available modules on the SailFin project's document list.

The new module is a collection of four NBM's that implement a SIP protocol level test agent. There is a document that describes the test agent functionality. You can use this this module to fire SIP requests and generate responses.

This test agent makes it possible to deploy and test the ClickToDial sample from inside NetBeans on a single computer and see the protocol level messages as they go through the SIP Servlets. Stay tuned for an updated version of the ClickToDial write up, with screen shots and the like, that shows you how to do this.

I have done all my recent testing in NetBeans 6.0.

(2007-12-17 19:19:26.0) Permalink

20071212 Wednesday December 12, 2007

Never 'Run' a Web App again!

No..

The last web app hasn't been developed... though some of the ideas that I have seen floated on TechCrunch seem like they are 'A Web App Too Far'. I am talking about how I "do" web-app development in NetBeans.

When you are debugging a Java application in NetBeans, you have the option to 'Apply Code Changes'. You can read this chapter of the NetBeans Field Guide about debugging that describes the 'Apply Code Changes' feature.

You can use this feature of the debugger to significantly reduce the number of times that you deploy a web app that has been targeted to GlassFish.

The best explanation is an example... [To play along at home, I recommend that you get NetBeans 6.0 and GlassFish V2.]

  1. Start the IDE
  2. Create a new Web Application project that targets a GlassFish domain. (I will call my project WA1 [double-u a one])
  3. Create a new Servlet in the project.
  4. Use the Debug item on the project's right-click menu.
    (This compiles the project code, starts the server in debug mode, attaches the NetBeans debug session to the server's JVM, deploys the web app and opens the browser on something like http://localhost:8080/WA1. When the browser opens, it will probably say something like "Hello World!" and the browsers title bar will probably say something like "JSP Page".)
  5. Change the code in the servlet that you created two steps back from
        protected void processRequest(HttpServletRequest request, HttpServletResponse response)
        throws ServletException, IOException {
            response.setContentType("text/html;charset=UTF-8");
            PrintWriter out = response.getWriter();
            try {
                /* TODO output your page here
                out.println("<html>");
                out.println("<head>");
                out.println("<title>Servlet NewServlet</title>");  
                out.println("</head>");
                out.println("<body>");
                out.println("<h1>Servlet NewServlet at " + request.getContextPath () + "</h1>");
                out.println("</body>");
                out.println("</html>");
                */
            } finally { 
                out.close();
            }
        } 
    
    TO
        protected void processRequest(HttpServletRequest request, HttpServletResponse response)
        throws ServletException, IOException {
            response.setContentType("text/html;charset=UTF-8");
            PrintWriter out = response.getWriter();
            try {
                //* TODO output your page here
                out.println("<html>");
                out.println("<head>");
                out.println("<title>Servlet NewServlet</title>");  
                out.println("</head>");
                out.println("<body>");
                out.println("<h1>Servlet NewServlet at " + request.getContextPath () + "</h1>");
                out.println("</body>");
                out.println("</html>");
                //*/
            } finally { 
                out.close();
            }
        } 
    
    Notice that the changes are in the commenting style of the TODO line and the closing asterisk-slash...
  6. Press the 'Apply Code Changes' icon in the Debug toolbar or use the Apply Code Changes item from the Run menu.
  7. Switch to your browser and change the URL in the address bar from (something like) http://localhost:8080/WA1 to (something like) http://localhost:8080/WA1/NewServlet.
    At this point the browser should have something like
    Servlet NewServlet at /WA1
    
    in the main window and 'Servlet NewServlet' in the title bar.
So there you have it. You just made a change to a running web application and the changes were applied to the running web app WITHOUT a deploy.

FINE PRINT: This depends on a couple of very important things.

  1. Directory deployment of web applications to Glassfish. If you turn off directory deployment, this will not work. The updated class needs to get to the right directory for the server to get the changed class file. Archive deployment put the class into directories under the domain's "root".
  2. The web app needs to be "stand-alone". A web app that is deployed as part of an enterprise application project will not compile the code for the changed class into the directory where the server expects it to be. The build process of the enterprise application copies the class file of sub module to a special location, to meet the server's exploded application layout constraints.
  3. Doesn't apply to classes that are part of a Java Library project that used by your web app. This is really similar to the difference between a stand alone web app and a web app inside an enterprise application project.
  4. The change that you make to the class is fairly constrained. If your change "breaks the rules", the 'Apply Code Changes' processing will fail. The error message will look something like this
    The virtual machine does not support this operation: schema change not implemented
    /Users/vbk/NetBeansProjects/WA1/nbproject/build-impl.xml:616: ...
    /Users/vbk/NetBeansProjects/WA1/nbproject/build-impl.xml:232: ...
    BUILD FAILED (total time: 0 seconds)
    
    The class that you were trying to replace will be unharmed on the server. If you run into this type of error, you can just use the project's Debug item to recompile the project and redeploy it.

(2007-12-12 22:17:18.0) Permalink

Calendar

« December 2007 »
SunMonTueWedThuFriSat
      
1
2
3
4
5
6
7
8
9
10
11
13
14
15
16
19
20
21
22
23
24
25
26
27
28
29
30
     
Today

RSS Feeds

XML
All
/5 in 5
/Compile Time
/Ease of Evolution
/General
/GlassFish
/Gotchas
/Java
/Music
/NetBeans
/Sailfin

About Me

Photo of Vince Kraemer
Short Bio

Search

Links


Navigation



Subscribe with Bloglines Add to Technorati Favorites

Referers

Today's Page Hits: 447