Sunday Nov 18, 2007

Java RESTful web services made easy with NetBeans 6

Web Services have become synonymous with interoperability (A "feature" demanded by the customers that need to make both .NET and Java, IT investments). There are couple of approaches to exposing functionality as a web service. The more established one is using SOAP & WSDL and the "newer" Representational State Transfer (REST) style web services. Of course tooling has not been far behind the trends and all the respectable vendors have some support for web services. JSR 311 has been coming along in describing an API developers can use to build RESTful web services.

In NetBeans 6, you'll find very useful functionality that enables you to build and test a RESTful web service. The best way is to start with with short tutorial. To learn more about the JAX-RS API, take a look at this blog.

By the way, since RESTful Web Services support in Java is still an evolving technology, the tooling resides on the NetBeans update center. Just use the Tools | Plugins menu and look for "RESTfull Web Services" in the Web & Java EE category. Once you install the plugin, you'll also get a few samples that will help you get started.

Get busy!
 

Thursday Nov 01, 2007

PHP coming soon on a NetBeans installation near you

Alexei and the team have been working on a PHP plugin for NetBeans 6. I am hoping they'll be able to release it on the NetBeans 6 update center in early December. The bits will be young, beta quality at best, however I am experimenting with PHP support in NetBeans and I like what I see so far.

The first thing one may do is make sure to get a runtime stack that supports the deployment of PHP applications. Given that many of these apps will have a database backend, this calls for something like MySQL. You'll also need a matching web server, and apache comes to mind :-). Here are few easy steps to get started:

 

  1. SSH Server (for remote access): sudo apt-get install ssh
  2. Database Server: sudo apt-get install mysql-server
  3. Apache HTTP Server: sudo apt-get install apache2
  4. PHP for Apache HTTP Server: sudo apt-get install php5
  5. MYSQL for Apache HTTP Server: sudo apt-get install libapache2-mod-auth-mysql
    sudo apt-get install php5-mysql

Once you install the PHP plugin in NetBeans, use the  "Services" tab to configure the document root for Apache web server installation. On my Ubuntu installation the document root is /var/www/apache2-default. You will likely have to change the permission for the document root, since NetBeans is usually install in user mode and apache required sudo.

To test everything, just create a new PHP Project in the IDE and add the following line of code: phpInfo(); in the default file. Next deploy you page and in your browser look for something like: http://localhost/apache2-default/index.php 


Wednesday Oct 31, 2007

Centering components in a (visual) web form

One of the typical requirements for a web application developer is to build a secure, identity enabled web application. NetBeans supports this usecase either by employing the bundled JavaServer Faces components, or a combination of JSP & HTML. On the backend the user can either use container based authentication, a database or some custom authentication mechanism.

Let's explore what one would have to do to build the a login page in NetBeans. In order to speed up the development, one can choose the visual application features (File | New Project | web | ... "Next" in the first page of the wizard | check the "Visual JSF" option and voila you have a page and a palette full of useful components that you can just drag and drop them in the form (page).

Further my requirement will be to center the group of components in the page. This turned out to be a little tricky so here are some steps that one can follow to work around this NetBeans shortcoming:

1. Select the page in the designer and in the property pane switch to Flow Layout
2. Remove style attribute.
3. In the JSP view of the page, use  <center> and <br> tags to adjust layout.

This works at both design time and run time. Here is an example of the a form that uses a couple of labels, textfields and button to submit the form.

<webuijsf:form binding="#{Page1.form1}" id="form1">
                       <center>
                           <webuijsf:label binding="#{Page1.label1}" id="label1"  text="Label"/>
                           <webuijsf:textField binding="#{Page1.textField1}" id="textField1" />
                           <br/>
                           <br/>
                           <br/>
                           <webuijsf:label binding="#{Page1.label2}" id="label2"  text="Label"/>
                           <webuijsf:textField binding="#{Page1.textField2}" id="textField2" />
                           <br/>
                           <br/>
                           <br/>
                           <webuijsf:button binding="#{Page1.button1}" id="button1"  text="Button"/>
                       </center>
                       <br/>
                   </webuijsf:form>

Many thanks to Jayashri for helping me work out a solution.

Perhaps in a the next installment I'll talk more about authentication and how to deploy on an https port using the Glassfish application server.

Monday Oct 22, 2007

NetBeans ships version 6 beta 2

NetBeans ships beta 2 of the upcoming 6.0 release, today (10/22/07). New NetBeans users may want to start on the docs page, while current users could just download the bits to get the latest bug fixes. If you are new to Java start here, you'll see a variety of online courses - all using NetBeans. Also, I highly recommend subscribing to the mailing lists (NetBeans has developers around the world: St Petersburg - Russia, Prague - Czech Republic, and the US, you'll likely be able to get help around the clock).

Thursday Oct 18, 2007

Woodstock live!

You may be thinking of the 1969 music festival, but I'd like to draw your attention to some cool technology that is currently bundled with NetBeans 6 and shares the same famous name: Woodstock, a set of JavaServer Faces, Ajax enabled components. The design time behavior of the components inside of the IDE is very rich. You'll find them in a palette, have the ability to drag and drop them on a page, easily bind them to heterogeneous data sources: databases, Web Services, EJB's, collections, etc. Building a web application with a consistent look and feel is an exercise that only takes a few minutes.

One can also experience the components (the runtime behavior) outside the NetBeans development environment, by going the java.net project page. This is very cool, since you don't have to install anything to view the components or code review the implementation of the examples listed on the website.



Saturday Aug 11, 2007

"Make NetBeans yours"

Are you a NetBeans user? You may have not noticed that the main www.netbeans.org page has been translated in many languages. The other day I clicked the "Choose page language" drop down at the top of the page and I was impressed: Arabic, Czech (a given, since NetBeans originates from Prague), German, Greek, Spanish, Persian, Romanian (to my pleasant surprise) are just a few of the languages in the list. The really cool part is that most of the translation have been done by folks in the developers community.

There are other goodies if English is not your language of choice:

  • Localized mailing list
  • The NetBeans IDE is localized in Simplified Chinese, Japanese, and Brazilian Portugese
  • If you are into blogs, you may want to take a look at PlanetNetBeans.org, an aggregation of NetBeans related musings from all over the Blogosphere

If you are looking to participate to the growing community, take a look at this page. If you have any questions just email Janice or take a look at her blog.


 

 

Thursday Apr 19, 2007

The answer is NetBeans, what is your question

Here is a preview (take this with a grain of salt) of the NetBeans 6 preview at Java One
http://bits.nbextras.org/netbeans/6.0/nightly/latest/installers/


Most of the functionality that you used to see in Java Studio Creator, Java Studio Enterprise has been open sourced and it is now available in NetBeans. So far there are three profiles (in absence of a better description) available: 

  • Basic ~ Java SE
  • Standard ~ Basic + Java EE (this calls for Glassfish since you'll need a container for deployment)/ME
  • Full ~ Standard + SOA, UML, Ruby
If you want to see all the new & cool features of the IDE, just register for NetBeans Day @ Java One. You'll have a chance to meet many of the key developers and most importantly, you have the ability to influence the future of the product.

On the offensive

I try to stay away from transforming my blog into a marketing tool, however I'll make an exception this time. The NetBeans folks just released an online sample application catalog which illustrates some of the cool apps that NetBeans bundles or that you can download from the update center. I strongly believe that developers learn by example and providing folks with samples enables folks to get up to speed with new technologies, learn new programming techniques, etc.


In a nutshell, one can jump start their next development project with one of the Top 5 NetBeans sample applications spanning the latest enterprise, mobile, and scripting technologies. Get inspired and get started today. 

NetBeans is likely the only IDE you'll ever need!
 

Sunday Apr 15, 2007

Showing folks how to solve real problems

The NetBeans folks are in the process of releasing a few, very cool sample applications. Since developer tools are just means to help engineers solve problems and be more productive, the idea was to put together a set of application that demonstrate the ease of use of certain technologies and solve common problems. The one that really caught my attention is a an app called flickr on rails, and it is written using NetBeans 6 (milestone 8 or later). You read this right. Ruby support in NetBeans. Moreover with version 6 the NetBeans platform has, now, intrinsic support for dynamic languages. If you want more details read about project Schliemann.

If you are a cynic like myself :-) you don't believe unless you see, so here is place where you can see a short movie that describes the building of a flicker like application in NetBeans using Ruby on Rails. If you just want to see the NetBeans @ work here is a screen shot that "speaks" for itself.

 

Keep in mind that NetBeans 6 is still young and even by Java One in mid May, the eng team will still show a preview of the product. If you are interested in improving the Ruby support in NetBeans, just participate. After all NetBeans is one of the oldest open source projects and Tor could use plenty of help.
 

Thursday Jun 22, 2006

Simple, yet powerful

Nowadays I am sitting in a lot of meetings (some are better than others :-) ) and at times I have my Apple notebook with me so I can browse the email headers for urgent stuff. Sun also provides wireless in most of the conference rooms so one can also browse the internet/intranet for topics germane to the conversation. This morning in a presentation related to website editing, HTML editors were discussed. I started playing with the Netbeans 5.5 and I found the plain web project to be quite useful.

In a nutshell I was able to edit (in markup) a HTML page in no time. The palette had most of the  common HTML elements and upon drag and drop in the editor they presented dialogs to customize the behavior and appearance. All the features I expected: syntax sensitive highlighting, code completion, code folding, are there. Pretty cool, especially if you have some level of proficiency. I was a little confused about the taxonomy of the palette: elements such as link are listed in the "HTML" section and others (Button, Text Input, etc. under "HTML Forms"), but I survived. Deployment (to the bundled Tomcat) of the page is one click away. Nice! This obviously enables one to write more interactive content with the help of servlets, JSPs or JavaServer Faces components.

For more advanced web page development one may want to try Java Studio Creator which uses an elegant library of JavaServer Faces components for WYSIWYG development. The cool thing is that it seems that this fall, some of Creator's features will be available in Netbeans 5.5.
About

octav

Search

Archives
« April 2014
SunMonTueWedThuFriSat
  
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
   
       
Today