Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
Clear All
new posts

    RESTful add with XML format

    Hello,

    I am using the RestDataSource example from the SmartGWT showcase as a basis to build a POC. I am now looking to pass parameters from my client to my server and generate custom XML responses on the server.

    After reading the user guide and searching through the wiki and forum, I cannot quite figure out where to start. Any advice or examples?

    NB: I am using smartgwt-4.1p.

    ------
    Edit: SOLVED - see last answer below.
    Last edited by darkane; 5 Jun 2014, 09:31.

    #2
    See the RestDataSource docs and QuickStart Guide. If you are trying to build a custom XML protocol, you should not start from RestDataSource, start from DataSource instead.

    Comment


      #3
      Yes, thanks, I was actually looking at these documents but having trouble making sense of the parts about Request and Response transformation for XML data, without examples.

      To be clear about my issue, I want to replace one of the "Edited Value" parameters in the code below (from the SmartGWT Showcase) and see the change reflected in my ListGrid.

      Code:
              final IButton updateButton = new IButton("Update Country (US)");
              updateButton.setWidth(150);
              updateButton.addClickHandler(new ClickHandler() {
                  public void onClick(ClickEvent event) {
                      countryGrid.updateData(createRecord("US", "Edited Value", "Edited Value", "Edited Value"));
                  }
              });
              hLayout.addMember(updateButton);
      After re-reading the documents, I think the part most relevant to my issue is the following in the ClientDataIntegration Javadoc:
      "To use the RestDataSource, simply write server code that can parse RestDataSource requests and produce the required responses[...]. The Smart GWT public wiki contains examples of integration with .NET's ASP.NET MVC as well as PHP with Doctrine."

      So I am now busy looking at these examples, .NET. FYI, the link to the PHP example is broken (but can be found through a search).
      Last edited by darkane; 22 May 2014, 09:58.

      Comment


        #4
        Json FETCH from a RestDatasource, using Jersey

        Edit: added console logs

        Hello again -

        I changed my mind on using XML after realizing the the Datasources support of XML is limited and that Json may also be more indicated for my particular project.

        My question is now how to implement a simple client and server using a RestDataSource and Json. I do not have an existing REST server, so I do not need to implement my own DataSource. I am trying to do a simple FETCH on a Jersey server for now and even that is not working.

        I looked at the code samples, but they show only the client side and the Json messages, so that only partially helps.

        Client.java
        Code:
         public VLayout createLayout() {
        
                VLayout layout = new VLayout(15);
                layout.setAutoHeight();
        
                //overrides here are for illustration purposes only
                RestDataSource countryDS = new RestDataSource();
        
                DataSourceTextField countryCode = new DataSourceTextField("country_code", "Country Code");
                countryDS.setDataFormat(DSDataFormat.JSON);
        countryDS.setFetchDataURL("http://localhost:8888/Xdstools3/rest/jsonServices/loadItems");
                // These lines are not required for this sample to work, but they demonstrate how you can configure RestDataSource
                // with OperationBindings in order to control settings such as whether to use the GET, POST or PUT HTTP methods,
                // and whether to send data as URL parameters vs as posted JSON or XML messages.
                OperationBinding fetch = new OperationBinding();
                fetch.setOperationType(DSOperationType.FETCH);
                fetch.setDataProtocol(DSProtocol.POSTPARAMS);
                fetch.setDataURL("http://localhost:8888/Xdstools3/rest/jsonServices/loadItems");
                OperationBinding add = new OperationBinding();
                add.setOperationType(DSOperationType.ADD);
                add.setDataProtocol(DSProtocol.POSTMESSAGE);
                add.setDataURL("http://localhost:8888/Xdstools3/rest/jsonServices/add");
                OperationBinding update = new OperationBinding();
                update.setOperationType(DSOperationType.UPDATE);
                update.setDataProtocol(DSProtocol.POSTMESSAGE);
                OperationBinding remove = new OperationBinding();
                remove.setOperationType(DSOperationType.REMOVE);
                remove.setDataProtocol(DSProtocol.POSTMESSAGE);
                countryDS.setOperationBindings(fetch, add, update, remove);
        
                countryCode.setPrimaryKey(true);
                countryCode.setCanEdit(false);
                DataSourceTextField countryName = new DataSourceTextField("country_name", "Country");
                countryDS.setFields(countryCode, countryName);
        
        
                final ListGrid countryGrid = new ListGrid();
                countryGrid.setWidth(500);
                countryGrid.setHeight(224);
                countryGrid.setDataSource(countryDS);
                countryGrid.setEmptyCellValue("--");
        
        
                ListGridField codeField = new ListGridField("country_code");
                ListGridField nameField = new ListGridField("country_code");
                countryGrid.setFields(codeField, nameField);
                countryGrid.setSortField(0);
                countryGrid.setDataPageSize(50);
                countryGrid.setAutoFetchData(true);
        
                layout.addMember(countryGrid);
        
                HLayout hLayout = new HLayout(15);
        
                final IButton addButton = new IButton("Add new Country");
                addButton.setWidth(150);
                addButton.addClickHandler(new ClickHandler() {
                    public void onClick(ClickEvent event) {
                        countryGrid.addData(createRecord("A1", "Test"));
                    }
                });
                hLayout.addMember(addButton);
        
                final IButton updateButton = new IButton("Update Country (US)");
                updateButton.setWidth(150);
                updateButton.addClickHandler(new ClickHandler() {
                    public void onClick(ClickEvent event) {
                        countryGrid.updateData(createRecord("US", "Edited Value"));
                    }
                });
                hLayout.addMember(updateButton);
        
                final IButton removeButton = new IButton("Remove Country (UK)");
                removeButton.setWidth(150);
                removeButton.addClickHandler(new ClickHandler() {
                    public void onClick(ClickEvent event) {
                        ListGridRecord record = new ListGridRecord();
                        record.setAttribute("countryCode", "UK");
                        countryGrid.removeData(record);
                    }
                });
                hLayout.addMember(removeButton);
        
                layout.addMember(hLayout);
        
        
        return layout;
        Server code
        Code:
        @Path("/jsonServices")
        public class RestServerTest {
        
        @GET
            @Path("/loadItems}")
            @Consumes(MediaType.APPLICATION_JSON)
            public Response consumeJSON() {
                 Record test1 = new Record("USA", "US");
                String output = test1.toString();
                return Response.status(200).entity(output).build();
            }
        What the Record.toString() returns:
        Code:
        @Override
            public String toString() {
                return new StringBuffer(" country_name : ").append(this.countryName)
                        .append(" country_code : ").append(this.countryCode).toString();
            }
        web.xml
        Code:
        <!DOCTYPE web-app PUBLIC
         "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
         "http://java.sun.com/dtd/web-app_2_3.dtd" >
        
        <web-app>
        	<display-name>Document Sharing Toolkit</display-name>
        
        	<!-- The filter is necessary so the simulator response headers can be captured 
        		for the message log -->
        	<!-- add filters and servlets here later (cf older versions of toolkit for 
        		how-to) -->
        
        	<!-- Example servlet loaded into servlet container -->
        	<servlet>
        		<servlet-name>restService</servlet-name>
        		<servlet-class>com.sun.jersey.spi.container.servlet.ServletContainer</servlet-class>
                <init-param>
                    <param-name>com.sun.jersey.config.property.packages</param-name>
                    <param-value>gov.nist.toolkit.xdstools3</param-value>
                </init-param>
                <init-param>
                    <param-name>com.sun.jersey.api.json.POJOMappingFeature</param-name>
                    <param-value>true</param-value>
                </init-param>
                <load-on-startup>1</load-on-startup>
        	</servlet>
        
        	<servlet-mapping>
        		<servlet-name>restService</servlet-name>
        		<url-pattern>/rest/*</url-pattern>
        	</servlet-mapping>
        
        
            <!-- Default page to serve -->
            <welcome-file-list>
                <welcome-file>Xdstools3.html</welcome-file>
            </welcome-file-list>
        
        
        </web-app>
        I get the following error:
        Transport error - HTTP code: 0 for URL: http://localhost:8888/Xdstools3/rest/jsonServices/add in Chrome and in my code editor console. When debugging under IE, the Listgrid tries to load the data then just times out.

        Here's the relevant part of the Smartgwt console debug logs:
        Code:
        11:24:50.505:MUP2[E]:DEBUG:RPCManager:XMLHttpRequest POST to http://localhost:8888/Xdstools3/rest/jsonServices/loadItems contentType: application/x-www-form-urlencoded; charset=UTF-8 with body -->_operationType=fetch&_startRow=0&_endRow=61&_sortBy=country_code&_textMatchStyle=substring&_componentId=isc_ListGrid_2&_dataSource=isc_RestDataSource_0&isc_metaDataPrefix=_&isc_dataFormat=json<--
        11:28:50.528:TMR3:DEBUG:RPCManager:Result string for transaction 0: [
        {response: Obj}
        ]
        11:28:50.548:TMR3:WARN:RPCManager:getHttpHeaders called with a null XmlHttpRequest object
        11:28:50.573:TMR3:INFO:RPCManager:rpcResponse(unstructured) results -->{response: Obj}<--
        11:28:50.854:TMR3:WARN:RPCManager:Operation timed outundefined - response: {data: "Operation timed out",
        startRow: 0,
        status: -100,
        endRow: 0,
        totalRows: 0,
        httpResponseCode: undef,
        httpResponseText: undef,
        transactionNum: 0,
        clientContext: Obj,
        internalClientContext: Obj,
        httpHeaders: undef,
        context: Obj,
        invalidateCache: false,
        queueStatus: 0}
        It seems that the Json response I am getting is empty, but I have no idea why. Could you point me to the right direction?
        Last edited by darkane; 3 Jun 2014, 07:32.

        Comment


          #5
          Alright, so it ended up that I was actually passing an empty response from my server to my client. Exactly what the Smartgwt console indicated, but it did take me a while to realize that generating the transport response wasn't done automatically by Jersey. I needed to actually write XML or Json into it at some point, which I wasn't doing.

          As a note, such a beginner's mistake would have probably been obvious to any experienced user looking at my code, so I guess this forum is not very monitored nor very active. This tells me I am better off not recommending to my team to buy the pro version in the future. The lack of more complete examples is also in my opinion a big issue with Smartgwt because it takes way too much time to figure out very simple things.


          So for other beginners in REST and Smartgwt, who do not have a pre-existing server and can choose any technology, here's an example using a Jersey/Spring server, a SmartGWT RESTDataSource, and XML messaging. I haven't looked into making it work with Json yet.

          These links were helpful:
          - http://forums.smartclient.com/showthread.php?t=13673
          - http://blog.technowobble.com/2010/08...y-restful.html

          The server (Jersey-Spring, FETCH only)
          Code:
          package gov.nist.toolkit.xdstools3.client.restDatasourceTest;
          
          import gov.nist.toolkit.xdstools3.client.restDatasourceTest.message.Message;
          import gov.nist.toolkit.xdstools3.client.restDatasourceTest.util.DSResponse;
          import gov.nist.toolkit.xdstools3.client.restDatasourceTest.util.MessageDSRequest;
          import gov.nist.toolkit.xdstools3.client.restDatasourceTest.util.MessageDSResponse;
          import gov.nist.toolkit.xdstools3.client.restDatasourceTest.util.OperationType;
          
          import javax.ws.rs.*;
          import javax.ws.rs.core.MediaType;
          
          
          	@POST
          	@Produces( { MediaType.APPLICATION_XML})
          	@Consumes( { MediaType.TEXT_XML })
          	@Path("/read")
          	public String read(MessageDSRequest request) {
          
                          System.out.println("success on server");
          
                  StringBuffer sb = new StringBuffer();
                  sb.append("<response>");
                  sb.append("<status>0</status>");
                  sb.append("<startRow>" + "0" + "</startRow>");
                  sb.append("<endRow>" + "50" + "</endRow>");
                  sb.append("<totalRows>10000</totalRows>");
                  sb.append("<data>");
          
                      sb.append("<record><id>idtest</id><value>Value</value></record>");
                  sb.append("</data>");
                  sb.append("</response>");
          
                  return sb.toString();
          	}
          
          }

          The client (Smartgwt RESTDatasource)
          Code:
             RestDataSource dataSource = new MessageDS();
                  final ListGrid messageGrid = new ListGrid();
                  messageGrid.setHeight(300);
                  messageGrid.setWidth(500);
                  messageGrid.setTitle("Messages");
                  messageGrid.setDataSource(dataSource);
                  messageGrid.setAutoFetchData(true);
                  messageGrid.setCanEdit(true);
                  messageGrid.setCanRemoveRecords(true);
                  messageGrid.setListEndEditAction(RowEndEditAction.NEXT);
          
                  ListGridField idField = new ListGridField("id", "Id", 40);
                  idField.setAlign(Alignment.LEFT);
                  ListGridField messageField = new ListGridField("value", "Message");
                  messageGrid.setFields(idField, messageField);
          
                  layout.addMember(messageGrid);
          
                  HLayout hLayout = new HLayout(15);
          
                  IButton updateButton = new IButton("Add message");
                  updateButton.addClickHandler(new com.smartgwt.client.widgets.events.ClickHandler() {
                      public void onClick(com.smartgwt.client.widgets.events.ClickEvent event) {
                          Record message = new ListGridRecord();
                          message.setAttribute("value", "...");
                          messageGrid.addData(message);
                      }
                  });
          
          
          
                  hLayout.addMember(updateButton);
          
                  layout.addMember(hLayout);
          The RESTDatasource
          Code:
          package gov.nist.toolkit.xdstools3.client.restDatasourceTest;
          
          import com.smartgwt.client.data.OperationBinding;
          import com.smartgwt.client.data.RestDataSource;
          import com.smartgwt.client.data.fields.DataSourceTextField;
          import com.smartgwt.client.types.DSOperationType;
          import com.smartgwt.client.types.DSProtocol;
          
          /**
           * SmartGWT datasource for accessing {@link gov.nist.toolkit.xdstools3.client.restDatasourceTest.message.Message} entities over http in a RESTful manner.
           */
          public class MessageDS extends RestDataSource {
          	
          	public MessageDS() {
          		setID("MessageDS");
          		DataSourceTextField messageId = new DataSourceTextField("id");
          		messageId.setPrimaryKey(true);
          		messageId.setCanEdit(false);
          		
          		DataSourceTextField messageValue = new DataSourceTextField("value");
          		setFields(messageId, messageValue);
          		
          		OperationBinding fetch = new OperationBinding();
          		fetch.setOperationType(DSOperationType.FETCH);
          		fetch.setDataProtocol(DSProtocol.POSTMESSAGE);
          		OperationBinding add = new OperationBinding();
          		add.setOperationType(DSOperationType.ADD);
          		add.setDataProtocol(DSProtocol.POSTMESSAGE);
          		OperationBinding update = new OperationBinding();
          		update.setOperationType(DSOperationType.UPDATE);
          		update.setDataProtocol(DSProtocol.POSTMESSAGE);
          		OperationBinding remove = new OperationBinding();
          		remove.setOperationType(DSOperationType.REMOVE);
          		remove.setDataProtocol(DSProtocol.POSTMESSAGE);
          		setOperationBindings(fetch, add, update, remove);
          				
          		setFetchDataURL("rest/message/read");
          		setAddDataURL("rest/message/add");
          		setUpdateDataURL("rest/message/update");
          		setRemoveDataURL("rest/message/remove");
          	}
          }
          web.xml
          Code:
          <!DOCTYPE web-app PUBLIC
           "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
           "http://java.sun.com/dtd/web-app_2_3.dtd" >
          
          <web-app>
          	<display-name>Document Sharing Toolkit</display-name>
          
          	<!-- The filter is necessary so the simulator response headers can be captured 
          		for the message log -->
          	<!-- add filters and servlets here later (cf older versions of toolkit for 
          		how-to) -->
          
          
          	<servlet>
          		<servlet-name>jersey</servlet-name>
          		<servlet-class>com.sun.jersey.spi.container.servlet.ServletContainer</servlet-class>
                  <init-param>
                      <param-name>com.sun.jersey.config.property.packages</param-name>
                      <param-value>gov.nist.toolkit.xdstools3</param-value>
                  </init-param>
                  <init-param>
                      <param-name>com.sun.jersey.api.json.POJOMappingFeature</param-name>
                      <param-value>true</param-value>
                  </init-param>
                  <load-on-startup>1</load-on-startup>
          	</servlet>
          
          
           <servlet-mapping>
          		<servlet-name>jersey</servlet-name>
          		<url-pattern>/rest/*</url-pattern>
          	</servlet-mapping>
          
          
              <!-- Default page to serve -->
              <welcome-file-list>
                  <welcome-file>Xdstools3.html</welcome-file>
              </welcome-file-list>
          
          
          </web-app>
          pom.xml (I am under Maven - this could help you figure out some of the dependencies)
          Code:
          <?xml version="1.0"?>
          <project
                  xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
                  xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
              <modelVersion>4.0.0</modelVersion>
          
              <parent>
                  <groupId>gov.nist.toolkit</groupId>
                  <artifactId>toolkit2</artifactId>
                  <version>v2-maven-alpha</version>
              </parent>
          
              <artifactId>xdstools3</artifactId>
              <!-- <version>3.0.0dev</version>  -->
              <packaging>war</packaging>
              <name>xdstools3</name>
              <properties>
                  <!-- Convenience property to set the GWT version -->
                  <gwtVersion>2.5.1</gwtVersion>
                  <roo.version>1.1.0.M2</roo.version>
                  <spring.version>4.0.5.RELEASE</spring.version> <!-- 3.0.3.RELEASE -->
                  <webappDirectory>${project.build.directory}/${project.build.finalName}</webappDirectory>
                  <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
                  <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
              </properties>
          
              <repositories>
                  <repository>
                      <id>internal-nist-repo-third-party</id>
                      <url>http://vm-070.nist.gov:8081/nexus/content/repositories/thirdparty/</url>
                  </repository>
                  <repository>
                      <id>internal-nist-repo-snapshots</id>
                      <url>http://vm-070.nist.gov:8081/nexus/content/repositories/snapshots/</url>
                  </repository>
                  <repository>
                      <id>smartgwt</id>
                      <url>http://www.smartclient.com/maven2</url>
                  </repository>
                  <repository>
                      <id>maven2-repository.dev.java.net</id>
                      <name>Java.net Repository for Maven</name>
                      <url>http://download.java.net/maven/2/</url>
                  </repository>
                  <repository>
                      <id>spring-maven-release</id>
                      <name>Spring Maven Release Repository</name>
                      <url>http://maven.springframework.org/release</url>
                  </repository>
                  <repository>
                      <id>spring-maven-milestone</id>
                      <name>Spring Maven Milestone Repository</name>
                      <url>http://maven.springframework.org/milestone</url>
                  </repository>
                  <repository>
                      <id>spring-roo-repository</id>
                      <name>Spring Roo Repository</name>
                      <url>http://spring-roo-repository.springsource.org/release</url>
                  </repository>
                  <repository>
                      <id>JBoss Repo</id>
                      <url>https://repository.jboss.org/nexus/content/repositories/releases</url>
                      <name>JBoss Repo</name>
                  </repository>
                  <repository>
                      <id>gwt-repo</id>
                      <url>http://google-web-toolkit.googlecode.com/svn/2.1.0.M2/gwt/maven</url>
                      <name>Google Web Toolkit Repository</name>
                  </repository>
              </repositories>
          
          
              <url>http://maven.apache.org</url>
              <dependencies>
                  <dependency>
                      <groupId>log4j</groupId>
                      <artifactId>log4j</artifactId>
                      <version>1.2.17</version>
                  </dependency>
                  <dependency>
                      <groupId>junit</groupId>
                      <artifactId>junit</artifactId>
                      <scope>test</scope>
                  </dependency>
                  <dependency>
                      <groupId>com.google.gwt</groupId>
                      <artifactId>gwt-user</artifactId>
                      <scope>provided</scope>
                  </dependency>
                  <dependency>
                      <groupId>com.google.gwt</groupId>
                      <artifactId>gwt-servlet</artifactId>
                      <scope>runtime</scope>
                      <version>${gwtVersion}</version>
                  </dependency>
                  <dependency>
                      <groupId>com.smartgwt</groupId>
                      <artifactId>smartgwt</artifactId>
                      <version>4.1p</version>
                  </dependency>
                  <dependency>
                      <groupId>com.smartgwt</groupId>
                      <artifactId>smartgwt-skins</artifactId>
                      <version>4.1p</version>
                  </dependency>
          
                  <dependency>
                      <groupId>${project.groupId}</groupId>
                      <artifactId>actortransaction</artifactId>
                      <version>v2-maven-alpha</version>
                  </dependency>
                  <dependency>
                      <groupId>${project.groupId}</groupId>
                      <artifactId>http</artifactId>
                      <version>v2-maven-alpha</version>
                  </dependency>
                  <dependency>
                      <groupId>${project.groupId}</groupId>
                      <artifactId>site-management</artifactId>
                      <version>v2-maven-alpha</version>
                  </dependency>
                  <!--<dependency>-->
                  <!--<groupId>com.sun.jersey</groupId>-->
                  <!--<artifactId>jersey-server</artifactId>-->
                  <!--<version>1.9</version>-->
                  <!--</dependency>-->
                  <!--<dependency>-->
                  <!--<groupId>com.sun.jersey</groupId>-->
                  <!--<artifactId>jersey-client</artifactId>-->
                  <!--<version>1.9</version>-->
                  <!--</dependency>-->
                  <!--<dependency>-->
                  <!--<groupId>com.sun.jersey</groupId>-->
                  <!--<artifactId>jersey-json</artifactId>-->
                  <!--<version>1.9</version>-->
                  <!--</dependency>-->
                  <dependency>
                  <groupId>com.sun.jersey</groupId>
                  <artifactId>jersey-server</artifactId>
                  <version>1.3</version>
                  </dependency>
                  <dependency>
                      <groupId>com.sun.jersey.contribs</groupId>
                      <artifactId>jersey-spring</artifactId>
                      <version>1.3</version>
                      <!-- jersey-spring depends on Spring 2.5.6, so exluding as we're on 3.0.0X -->
                      <exclusions>
                          <exclusion>
                              <groupId>org.springframework</groupId>
                              <artifactId>spring</artifactId>
                          </exclusion>
                          <exclusion>
                              <groupId>org.springframework</groupId>
                              <artifactId>spring-core</artifactId>
                          </exclusion>
                          <exclusion>
                              <groupId>org.springframework</groupId>
                              <artifactId>spring-beans</artifactId>
                          </exclusion>
                          <exclusion>
                              <groupId>org.springframework</groupId>
                              <artifactId>spring-context</artifactId>
                          </exclusion>
                          <exclusion>
                              <groupId>org.springframework</groupId>
                              <artifactId>spring-web</artifactId>
                          </exclusion>
                          <exclusion>
                              <groupId>org.springframework</groupId>
                              <artifactId>spring-webmvc</artifactId>
                          </exclusion>
                      </exclusions>
                  </dependency>
          
                  <!-- ROO dependencies -->
                  <dependency>
                      <groupId>org.springframework.roo</groupId>
                      <artifactId>org.springframework.roo.annotations</artifactId>
                      <version>${roo.version}</version>
                      <scope>compile</scope>
                  </dependency>
          
                  <!-- Spring dependencies -->
                  <dependency>
                      <groupId>org.springframework</groupId>
                      <artifactId>spring-web</artifactId>
                      <version>${spring.version}</version>
                      <exclusions>
                          <exclusion>
                              <groupId>commons-logging</groupId>
                              <artifactId>commons-logging</artifactId>
                          </exclusion>
                      </exclusions>
                  </dependency>
                  <dependency>
                      <groupId>org.springframework</groupId>
                      <artifactId>spring-webmvc</artifactId>
                      <version>${spring.version}</version>
                      <exclusions>
                          <exclusion>
                              <groupId>commons-logging</groupId>
                              <artifactId>commons-logging</artifactId>
                          </exclusion>
                      </exclusions>
                  </dependency>
                  <dependency>
                      <groupId>org.springframework</groupId>
                      <artifactId>spring-core</artifactId>
                      <version>${spring.version}</version>
                      <exclusions>
                          <exclusion>
                              <groupId>commons-logging</groupId>
                              <artifactId>commons-logging</artifactId>
                          </exclusion>
                      </exclusions>
                  </dependency>
                  <dependency>
                      <groupId>org.springframework</groupId>
                      <artifactId>spring-test</artifactId>
                      <version>${spring.version}</version>
                      <scope>test</scope>
                      <exclusions>
                          <exclusion>
                              <groupId>commons-logging</groupId>
                              <artifactId>commons-logging</artifactId>
                          </exclusion>
                      </exclusions>
                  </dependency>
                  <dependency>
                      <groupId>org.springframework</groupId>
                      <artifactId>spring-context</artifactId>
                      <version>${spring.version}</version>
                  </dependency>
                  <dependency>
                      <groupId>org.springframework</groupId>
                      <artifactId>spring-aop</artifactId>
                      <version>${spring.version}</version>
                  </dependency>
                  <dependency>
                      <groupId>org.springframework</groupId>
                      <artifactId>spring-aspects</artifactId>
                      <version>${spring.version}</version>
                  </dependency>
                  <dependency>
                      <groupId>org.springframework</groupId>
                      <artifactId>spring-tx</artifactId>
                      <version>${spring.version}</version>
                  </dependency>
                  <dependency>
                      <groupId>commons-beanutils</groupId>
                      <artifactId>commons-beanutils-bean-collections</artifactId>
                      <version>1.8.3</version>
                  </dependency>
          
                  <!-- Hibernate dependencies -->
                  <dependency>
                      <groupId>org.hibernate</groupId>
                      <artifactId>hibernate-core</artifactId>
                      <version>3.5.1-Final</version>
                      <exclusions>
                          <exclusion>
                              <groupId>cglib</groupId>
                              <artifactId>cglib</artifactId>
                          </exclusion>
                          <exclusion>
                              <groupId>net.sf.ehcache</groupId>
                              <artifactId>ehcache</artifactId>
                          </exclusion>
                          <exclusion>
                              <groupId>asm</groupId>
                              <artifactId>asm</artifactId>
                          </exclusion>
                          <exclusion>
                              <groupId>asm</groupId>
                              <artifactId>asm-attrs</artifactId>
                          </exclusion>
                          <exclusion>
                              <groupId>javax.transaction</groupId>
                              <artifactId>jta</artifactId>
                          </exclusion>
                      </exclusions>
                  </dependency>
                  <dependency>
                      <groupId>org.hibernate</groupId>
                      <artifactId>hibernate-entitymanager</artifactId>
                      <version>3.5.1-Final</version>
                      <exclusions>
                          <exclusion>
                              <groupId>cglib</groupId>
                              <artifactId>cglib</artifactId>
                          </exclusion>
                          <exclusion>
                              <groupId>dom4j</groupId>
                              <artifactId>dom4j</artifactId>
                          </exclusion>
                      </exclusions>
                  </dependency>
                  <dependency>
                      <groupId>org.hibernate.javax.persistence</groupId>
                      <artifactId>hibernate-jpa-2.0-api</artifactId>
                      <version>1.0.0.Final</version>
                  </dependency>
                  <dependency>
                      <groupId>org.hibernate</groupId>
                      <artifactId>hibernate-validator</artifactId>
                      <version>4.0.2.GA</version>
                      <exclusions>
                          <exclusion>
                              <groupId>javax.xml.bind</groupId>
                              <artifactId>jaxb-api</artifactId>
                          </exclusion>
                          <exclusion>
                              <groupId>com.sun.xml.bind</groupId>
                              <artifactId>jaxb-impl</artifactId>
                          </exclusion>
                      </exclusions>
                  </dependency>
                  <dependency>
                      <groupId>commons-beanutils</groupId>
                      <artifactId>commons-beanutils</artifactId>
                      <version>1.8.3</version>
                  </dependency>
          
                  <!-- AspectJ dependencies -->
                  <dependency>
                      <groupId>org.springframework.data</groupId>
                      <artifactId>spring-data-neo4j-aspects</artifactId>
                      <version>2.1.0.RELEASE</version>
                  </dependency>
          
                  <dependency>
                      <groupId>org.aspectj</groupId>
                      <artifactId>aspectjrt</artifactId>
                      <version>1.6.12</version>
                  </dependency>
          
              </dependencies>
          
          
              <build>
                  <!-- Generate compiled stuff in the folder used for developing mode -->
                  <outputDirectory>${webappDirectory}/WEB-INF/classes</outputDirectory>
          
                  <plugins>
                      <plugin>
                          <groupId>org.apache.maven.plugins</groupId>
                          <artifactId>maven-compiler-plugin</artifactId>
                          <version>2.3.2</version>
                          <configuration>
                              <source>1.6</source>
                              <target>1.6</target>
                          </configuration>
                      </plugin>
          
                      <!-- GWT Maven Plugin -->
                      <plugin>
                          <groupId>org.codehaus.mojo</groupId>
                          <artifactId>gwt-maven-plugin</artifactId>
                          <version>2.5.1</version>
                          <executions>
                              <execution>
                                  <id>compilation_profile</id>
                                  <goals>
                                      <goal>compile</goal>
                                  </goals>
                                  <configuration>
                                      <!-- copyWebapp: Copies the contents of warSourceDirectory to hostedWebapp. -->
                                      <!-- warSourceDirectory : Location of the web application static resources
                                          (same as maven-war-plugin parameter) Default value is: ${basedir}/src/main/webapp. -->
                                      <!-- hostedWebapp: Location of the hosted-mode web application structure.
                                          Default: ${project.build.directory}/${project.build.finalName} -->
                                      <!-- no optimization takes place. Good for development -->
                                      <optimizationLevel>0</optimizationLevel>
                                  </configuration>
                              </execution>
          
                          </executions>
                          <configuration>
                              <runTarget>Xdstools3.html</runTarget>
                              <modules>
                                  <module>${project.groupId}.xdstools3.Xdstools3</module>
                              </modules>
                          </configuration>
                      </plugin>
          
                      <!-- Maven Release plugin -->
                      <plugin>
                          <groupId>org.apache.maven.plugins</groupId>
                          <artifactId>maven-release-plugin</artifactId>
                          <version>2.4.1</version>
                      </plugin>
          
                      <!-- Maven WAR plugin -->
                      <plugin>
                          <artifactId>maven-war-plugin</artifactId>
                          <version>2.4</version>
                          <configuration>
                              <!-- configured to be the same as for the gwt plugin -->
                              <webappDirectory>${webappDirectory}</webappDirectory>
                          </configuration>
                          <executions>
                              <execution>
                                  <phase>compile</phase>
                                  <goals>
                                      <!-- create an exploded version of the war in webappDirectory. Ideal
                                          for development -->
                                      <goal>exploded</goal>
                                  </goals>
                              </execution>
                          </executions>
                      </plugin>
          
          
          
          
                      <!-- Apache Tomcat plugin -->
                      <!-- Copied config from xdstools2 -->
                      <plugin>
                          <groupId>org.apache.tomcat.maven</groupId>
                          <artifactId>tomcat7-maven-plugin</artifactId>
                          <version>2.2</version>
                          <configuration>
                              <!-- <path>/xdstools2</path> <warFile>${project.build.directory}/xdstools3-v2-maven-alpha.war</warFile>
                                  <tomcatLoggingFile>${project.build.directory}/log.txt</tomcatLoggingFile> -->
                          </configuration>
                      </plugin>
          
                      <!-- AspectJ configuration -->
                  <plugin>
                      <groupId>org.codehaus.mojo</groupId>
                      <artifactId>aspectj-maven-plugin</artifactId>
                      <version>1.2</version>
                      <dependencies>
                          <!-- NB: You must use Maven 2.0.9 or above or these are ignored (see MNG-2972) -->
                          <dependency>
                              <groupId>org.aspectj</groupId>
                              <artifactId>aspectjrt</artifactId>
                              <version>1.6.12</version>
                          </dependency>
                          <dependency>
                              <groupId>org.aspectj</groupId>
                              <artifactId>aspectjtools</artifactId>
                              <version>1.6.12</version>
                          </dependency>
                      </dependencies>
                      <executions>
                          <execution>
                              <goals>
                                  <goal>compile</goal>
                                  <goal>test-compile</goal>
                              </goals>
                          </execution>
                      </executions>
                      <configuration>
                          <outxml>true</outxml>
                          <aspectLibraries>
                              <aspectLibrary>
                                  <groupId>org.springframework</groupId>
                                  <artifactId>spring-aspects</artifactId>
                              </aspectLibrary>
                              <aspectLibrary>
                                  <groupId>org.springframework.data</groupId>
                                  <artifactId>spring-data-neo4j-aspects</artifactId>
                              </aspectLibrary>
                          </aspectLibraries>
                          <source>1.6</source>
                          <target>1.6</target>
                      </configuration>
                  </plugin>
          
                      <plugin>
                          <groupId>org.apache.maven.plugins</groupId>
                          <artifactId>maven-resources-plugin</artifactId>
                          <version>2.4.2</version>
                          <configuration>
                              <encoding>UTF-8</encoding>
                          </configuration>
                      </plugin>
                      <plugin>
                          <groupId>org.apache.maven.plugins</groupId>
                          <artifactId>maven-surefire-plugin</artifactId>
                          <version>2.5</version>
                          <configuration>
                              <excludes>
                                  <exclude>**/*_Roo_*</exclude>
                              </excludes>
                          </configuration>
                      </plugin>
                      <plugin>
                          <groupId>org.apache.maven.plugins</groupId>
                          <artifactId>maven-assembly-plugin</artifactId>
                          <version>2.2-beta-5</version>
                          <configuration>
                              <descriptorRefs>
                                  <descriptorRef>jar-with-dependencies</descriptorRef>
                              </descriptorRefs>
                          </configuration>
                      </plugin>
                      <plugin>
                          <groupId>org.apache.maven.plugins</groupId>
                          <artifactId>maven-deploy-plugin</artifactId>
                          <version>2.5</version>
                      </plugin>
                      <plugin>
                          <groupId>org.apache.maven.plugins</groupId>
                          <artifactId>maven-idea-plugin</artifactId>
                          <version>2.2</version>
                          <configuration>
                              <downloadSources>true</downloadSources>
                              <dependenciesAsLibraries>true</dependenciesAsLibraries>
                          </configuration>
                      </plugin>
                      <plugin>
                          <groupId>org.mortbay.jetty</groupId>
                          <artifactId>jetty-maven-plugin</artifactId>
                          <version>7.1.2.v20100523</version>
                          <configuration>
                              <webAppConfig>
                                  <contextPath>/${project.name}</contextPath>
                              </webAppConfig>
                          </configuration>
                      </plugin>
                  </plugins>
          
              </build>
          </project>
          Last edited by darkane; 5 Jun 2014, 09:32.

          Comment

          Working...
          X