0

I'm building a web front end to monitor the state of a SOAP service.

Is there any way to serve static files with jax.ws? For example Endpoint.publish("/static", new SomeStaticFileHandler()) where any requests to /static just serve the corresponding static file in my folder? Inside the static file I would like to query the state and update the page with AJAX calls.

Thanks!

zavié
  • 4,301
  • 2
  • 34
  • 46

1 Answers1

0

The correct way to serve static files is to add a custom servlet to the web.xml.

As for the hack you want to try: serve any file type, with any content-type? It will not work, I believe. Perhaps you can serve XML files if they follow a predefined schema -- JAX-WS implementation classes return objects, not strings or streams. These objects are serialized to SOAP/XML using the schema and binding. You'd need to parse the files into objects and then return to JAX-WS runtime... and you'll get a SOAP envelope over the file content anyway.

Inside the static file I would like to query the state and update the page with AJAX calls

This doesn't sound like a static file to me. This is a dynamic method serving XML or JSON. The simplest answer is still a servlet.

JAX-RS (RESTful Java API) is a viable alternative too.

Community
  • 1
  • 1
Vladimir Dyuzhev
  • 18,130
  • 10
  • 48
  • 62
  • Thanks, I don't like the crazy XMLs that are needed for servlet... But guess now I have to learn servlets to mix these two :). – zavié Jun 26 '11 at 15:12