org.apache.soap.server.http
Class ServerHTTPUtils

java.lang.Object
  |
  +--org.apache.soap.server.http.ServerHTTPUtils

public class ServerHTTPUtils
extends java.lang.Object

Any utility stuff for HTTP SOAP stuff.

Author:
Sanjiva Weerawarana

Constructor Summary
ServerHTTPUtils()
           
 
Method Summary
static java.io.File getFileFromNameAndContext(java.lang.String fileName, javax.servlet.ServletContext context)
          If the fileName is absolute, a file representing it is returned.
static ServiceManager getServiceManagerFromContext(javax.servlet.ServletContext context)
          Equivalent to: getServiceManagerFromContext(context, null)
static ServiceManager getServiceManagerFromContext(javax.servlet.ServletContext context, java.lang.String configFilename)
          Look up the service manager or create it from the context.
static java.lang.ClassLoader getServletClassLoaderFromContext(javax.servlet.ServletContext context)
          Retrieves the ClassLoader from the ServletContext, if one is registered.
static SOAPMappingRegistry getSMRFromContext(javax.servlet.ServletContext context)
          Return the soap mapping registry instance from the servlet context.
static java.lang.Object getTargetObject(ServiceManager serviceManager, DeploymentDescriptor dd, java.lang.String targetID, javax.servlet.http.HttpServlet thisServlet, javax.servlet.http.HttpSession session, SOAPContext ctxt, javax.servlet.ServletContext context)
          Return the target object that services the service with the given ID.
static Envelope readEnvelopeFromRequest(javax.xml.parsers.DocumentBuilder xdb, java.lang.String contentType, int contentLength, java.io.InputStream requestStream, EnvelopeEditor editor, javax.servlet.http.HttpServletResponse res, SOAPContext ctx)
          Read in stuff from the HTTP request stream and return the envelope.
static void setServletClassLoaderIntoContext(javax.servlet.ServletContext context, java.lang.ClassLoader cl)
          Registers the ClassLoader into the ServletContext.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ServerHTTPUtils

public ServerHTTPUtils()
Method Detail

getServiceManagerFromContext

public static ServiceManager getServiceManagerFromContext(javax.servlet.ServletContext context,
                                                          java.lang.String configFilename)
Look up the service manager or create it from the context. NOTE: this approach may not work if this servlet is put in a webapp that is marked distributed .. the servlet context is unique only per JVM. In that case we'll have to use an external database to store this webapp-global attribute.

getServiceManagerFromContext

public static ServiceManager getServiceManagerFromContext(javax.servlet.ServletContext context)
Equivalent to: getServiceManagerFromContext(context, null)

getServletClassLoaderFromContext

public static java.lang.ClassLoader getServletClassLoaderFromContext(javax.servlet.ServletContext context)
Retrieves the ClassLoader from the ServletContext, if one is registered.

setServletClassLoaderIntoContext

public static void setServletClassLoaderIntoContext(javax.servlet.ServletContext context,
                                                    java.lang.ClassLoader cl)
Registers the ClassLoader into the ServletContext.

getFileFromNameAndContext

public static java.io.File getFileFromNameAndContext(java.lang.String fileName,
                                                     javax.servlet.ServletContext context)
If the fileName is absolute, a file representing it is returned. Otherwise, a File is returned which represents the file relative to the servlet's docBase. If ServletContext.getRealPath(fileName) returns null, a File is returned which represents the file relative to the current working directory. Note: Uses ServletContext.getRealPath(fileName).

readEnvelopeFromRequest

public static Envelope readEnvelopeFromRequest(javax.xml.parsers.DocumentBuilder xdb,
                                               java.lang.String contentType,
                                               int contentLength,
                                               java.io.InputStream requestStream,
                                               EnvelopeEditor editor,
                                               javax.servlet.http.HttpServletResponse res,
                                               SOAPContext ctx)
                                        throws SOAPException,
                                               java.io.IOException
Read in stuff from the HTTP request stream and return the envelope. Returns null (and sets the error on the response stream) if a transport level thing is wrong and throws a SOAPException if a SOAP level thing is wrong.
Returns:
Envelope containing the SOAP envelope found in the request
Throws:
SOAPException - if a SOAP level thing goes wrong
java.io.IOException - if something fails while sending an error response

getTargetObject

public static java.lang.Object getTargetObject(ServiceManager serviceManager,
                                               DeploymentDescriptor dd,
                                               java.lang.String targetID,
                                               javax.servlet.http.HttpServlet thisServlet,
                                               javax.servlet.http.HttpSession session,
                                               SOAPContext ctxt,
                                               javax.servlet.ServletContext context)
                                        throws SOAPException
Return the target object that services the service with the given ID. Depending on the deployment information of the service, the object's lifecycle is also managed here.

getSMRFromContext

public static SOAPMappingRegistry getSMRFromContext(javax.servlet.ServletContext context)
Return the soap mapping registry instance from the servlet context. If one isn't there, then create one and store it in there and then return it.


Copyright © 2001 Apache XML Project. All Rights Reserved.