I set up a working project which deploys a web service using JAX-WS to a Jetty 
web server via Maven Jetty Plugin.
I attached part of pom.xml, web service interface and web service 
implementation below.
 
So, what's the problem?
 
The web service generates a file which must be made available via http. The web 
service responds with the URI of that file.
I thought the best option to accomplish this is to define a ContextHandler 
serving as a file server (see pom.xml below).
I want to be able to configure the resourceBase and contextPath.
 
However, I did not find a way to access this (any) configuration from the web 
service implementation in order to provide the necessary 
information to the web service where to store the generated file on disk. 
Besides persisting the file, I need to determine the URI to be returned
back to the client. While I am only declaring the contextPath in pom.xml, which 
I need to have access to, how can I actually determine host and port
within the web service implemention? There is nothing such as a request object 
known from servlets.  
 
pom.xml
 
<build>
 <plugins>
   <plugin>
    <groupId>org.mortbay.jetty</groupId>
    <artifactId>maven-jetty-plugin</artifactId>
    <version>6.1.26</version>
    <configuration>
      <scanIntervalSeconds>10</scanIntervalSeconds>
          <stopKey>foo</stopKey>
          <stopPort>9999</stopPort>
          
<webAppSourceDirectory>${basedir}/src/main/webapp</webAppSourceDirectory>
          <webXml>${basedir}/src/main/webapp/WEB-INF/web.xml</webXml>
          <contextPath>/Service</contextPath>
           <connectors>
            <connector 
implementation="org.mortbay.jetty.nio.SelectChannelConnector">
            <port>4433</port>
           </connector>
         </connectors>
        <contextHandlers>
        <contextHandler 
implementation="org.mortbay.jetty.handler.ContextHandler">
        <contextPath>/Service</contextPath>
        <resourceBase>${java.io.tmpdir}</resourceBase>
         <handler implementation="org.mortbay.jetty.handler.ResourceHandler"/>
      </contextHandler>
     </contextHandlers>
    </configuration>
   </plugin>
  </plugins>
 </build>
 
Web Service Interface
 
@WebService(targetNamespace = 
"http://project.company.de/project-webutils/wsdl";, name = "Service")
@XmlSeeAlso({de.company.project.project_webutils.xsd.ObjectFactory.class, 
de.company.project.resources.ObjectFactory.class})
public interface Service {
 
    @WebResult(name = "return", targetNamespace = 
"http://project.company.de/project-webutils/xsd";)
    @RequestWrapper(localName = "Align", targetNamespace = 
"http://project.company.de/project-webutils/xsd";, className = 
"de.company.project.project_webutils.xsd.AlignType")
    @WebMethod(operationName = "Align", action = "Align")
    @ResponseWrapper(localName = "AlignResponse", targetNamespace = 
"http://project.company.de/project-webutils/xsd";, className = 
"de.company.project.project_webutils.xsd.AlignResponseType")
    public java.lang.String align(
        @WebParam(name = "param1", targetNamespace = 
"http://project.company.de/project-webutils/xsd";)
        java.lang.String param1,
        @WebParam(name = "param2", targetNamespace = 
"http://project.company.de/project-webutils/xsd";)
        java.lang.String param2,
        @WebParam(name = "input3", targetNamespace = 
"http://project.company.de/project-webutils/xsd";)
        java.lang.String input3,
        @WebParam(name = "parameters", targetNamespace = 
"http://project.company.de/project-webutils/xsd";)
        java.util.List<de.company.project.resources.ArgumentType> parameters
    ) throws SERVICEFault;
}
 
Web Service implementation
 
@WebService(portName="Service",
            serviceName="Service",
            targetNamespace = "http://project.company.de/project-webutils/wsdl";,
            
endpointInterface="de.company.project.project_webutils.wsdl.Service")
 
public class ServiceImpl implements Service {
...
}
 
 

___________________________________________________________
Schon gehört? WEB.DE hat einen genialen Phishing-Filter in die
Toolbar eingebaut! http://produkte.web.de/go/toolbar
_______________________________________________
jetty-users mailing list
[email protected]
https://dev.eclipse.org/mailman/listinfo/jetty-users

Reply via email to