Tuesday, March 9, 2010

jboss plugin for auto-deploying artifact during build

This is VERY handy for automatically deploying your artifact/war after a maven build is completed. Simply add the mvn goal jboss:hard-deploy to your maven command.
<plugin>
   <groupId>org.codehaus.mojo</groupId>
   <artifactId>jboss-maven-plugin</artifactId>
   <version>1.4</version>
   <configuration>
      <jbossHome>${jboss.home}</jbossHome>
      <serverName>default</serverName>
      <fileName>target/my-app.war</fileName>
   </configuration>
</plugin>

Saturday, March 6, 2010

Tunneling PUT and DELETE from ExtJS to Jersey ReST

Here is how you can invoke AJAX POSTs in ExtJS that map to PUT and/or DELETE methods in your Jersey ReST services.

The first step is to configure Jersey to allow this:
<init-param>
    <param-name>com.sun.jersey.spi.container.ContainerRequestFilters</param-name>
    <param-value>com.sun.jersey.api.container.filter.PostReplaceFilter</param-value>
</init-param>
The next step is to issue the AJAX request (in this case we're going to issue a POST but tell Jersey to invoke the PUT mapped method instead):
Ext.Ajax.request({
    headers : {
        'X-HTTP-Method-Override' : 'PUT'
    },
    method: 'POST',
    url: '/my-api/some-service',
    params: {
        name : someObj.name,
        date : someObj.date,
        amount : someObj.amount
    },
    success: this.onSaveSuccess.createDelegate(this),
    failure: this.onSaveFailure.createDelegate(this)
});

Friday, March 5, 2010

CSS for flowing boxes in a DataView

Here is some CSS that can be used to flow/float boxes inside an ExtJS DataView:

.dataViewNode {
   width: 10em;
   float: left;
   height: auto;
   overflow: hidden;
   position: relative;
   margin: 4px;
   z-index: 5;
   text-align: center;
   padding: 2px 0 0 0;
   font-size: 0.8em;
}