Question

I use Enunciate (http://enunciate.codehaus.org/) for our web-service layer and I just want to do something very simple but do not find any documentation.

I want to deploy some images and other static resources and to be accessible from e.g http://localhost:8080/myapp/images/img01.png

I tried to create a folder images under src/main/resources but it is not deployed like I want (all files/folder inside there goes to myapp/WEB-INF/classes, which as expected).

Someone can point me where are the static resources with the enunciate project?

I do not have the web.xml as it is automatically generated by the enunciate framework.

Was it helpful?

Solution 2

In fact I found how to do it and I publish my solution as an answer

In our pom.xml, we refers the enunciate.xml path like this:

 <plugin>
    <groupId>org.codehaus.enunciate</groupId>
    <artifactId>maven-enunciate-spring-plugin</artifactId>
    <version>${enunciate.version}</version>
    <configuration>
        <configFile>src/conf/enunciate.xml</configFile>
    </configuration>
    <executions>
        <execution>
            <goals>
                <goal>assemble</goal>
            </goals>
        </execution>
    </executions>
</plugin>

and in the enunciate.xml file:

<webapp postBase="web"></webapp>

which means the static resources can be put in src/conf/web/ and then my folder called images will simply located in: src/conf/web/images.

Like this all these static resources will be accessible by http://localhost:8080/myappcontext/images/

The enunciate documentation shows the option available for the webapp element:

  • preBase is a folder or zipped archive which will be copied before the enunciate generation
  • postBase is a folder of zipped archive which will be copied after the enunciate generation

For the images and other static resources there should not be any difference using one of these attributes.

OTHER TIPS

Static resources are structured using the standard project structure of the maven-war-plugin. So basically, you just put your image under src/main/webapp/images/img01.png.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top