/** @see IServer#bind(ILocator, ILocator, IContext) */
 public IResponse bind(ILocator source, ILocator destination, IContext userContext)
     throws IOException {
   Assert.isNotNull(source);
   Assert.isNotNull(destination);
   Assert.isNotNull(userContext);
   IContext context = newContext(userContext, source);
   context.setDestination(URLEncoder.encode(destination.getResourceURL()));
   Request request = newRequest(source, context, "BIND"); // $NON-NLS-1$
   return httpClient.invoke(request);
 }
 private Request newRequest(
     ILocator locator, IContext context, Document document, String methodName) throws IOException {
   context.setContentType("text/xml; charset=\"UTF8\""); // $NON-NLS-1$
   if (document == null)
     return new Request(methodName, URLEncoder.encode(new URL(locator.getResourceURL())), context);
   RequestBodyWriter writer = new RequestBodyWriter(document, "UTF8"); // $NON-NLS-1$
   return new Request(
       methodName, URLEncoder.encode(new URL(locator.getResourceURL())), context, writer);
 }
Ejemplo n.º 3
0
 public String toString() {
   return context.toString();
 }
Ejemplo n.º 4
0
 /**
  * Returns the content length of this message's body, or -1 if the content length is unknown.
  *
  * @return the content length of this message's body
  */
 public long getContentLength() {
   long contentLength = context.getContentLength();
   if (contentLength != -1) return contentLength;
   if (is instanceof ByteArrayInputStream) return ((ByteArrayInputStream) is).available();
   return -1;
 }