Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Migration of unmigrated content due to installation of a new plugin

Writing the bean class

...

We now have to excerptINLINE

write the bean class

...

Creating the bean class

Preparing an Eclipse project

In order to ease the development we will now make use of Mavens ability to create Eclipse projects. From the http-handler-su main folder run the following comand:

...

...

This will cleanup any existing Eclipse config (eclipse:clean) and create a new eclipse project (eclipse:eclipse).
When done it should post something like:

...

...

Importing the project into Eclipse

...

Now select File > New > Class. In the dialog enter the following:

*

...

...

*

Then hit Finish to create the class. Eclipse will also implement the interface's only method for you:
*

...

...

*
This method is responsible for handling incoming messages.

...

We extract the first attachment of the message by name. The name is equal to the filename. After this we have the original filename in the
fileName variable and the file content in the content variable (as DataHandler object).
For the sake of simplicity we just write the contents into a temporary file and use this file for sending it back to the http-consumer-su.

...

...

This is of course a stupid example, so just imagine you convert this file into another format and send the result back.
You can do such a logic if you want. For this you can refer for example to OpenOffice running in headless mode in combination with the JODConverter of "Arts of Solving". This will enable you to convert for example a .odt document into a .pdf document. But this is really out of scope now.

The finished class

...

...

Feel free to play around with this class after you ran it once sucessfully. There is enough room for improvements.

Now the handler SU is ready for work. Let's move on to creating the service assembly.

Proceed to the next step

...



...