diff options
Diffstat (limited to 'base/server/cmscore/src/com/netscape/cmscore/connector/HttpConnection.java')
-rw-r--r-- | base/server/cmscore/src/com/netscape/cmscore/connector/HttpConnection.java | 40 |
1 files changed, 20 insertions, 20 deletions
diff --git a/base/server/cmscore/src/com/netscape/cmscore/connector/HttpConnection.java b/base/server/cmscore/src/com/netscape/cmscore/connector/HttpConnection.java index 30d70be1b..c179f4b3e 100644 --- a/base/server/cmscore/src/com/netscape/cmscore/connector/HttpConnection.java +++ b/base/server/cmscore/src/com/netscape/cmscore/connector/HttpConnection.java @@ -60,14 +60,16 @@ public class HttpConnection implements IHttpConnection { return false; } - public HttpConnection(IRemoteAuthority dest, ISocketFactory factory) { - this(dest, factory, null); + public void setRequestURI(String uri) + throws EBaseException { + mHttpreq.setURI(uri); } - /* - * @param op operation to determine the receiving servlet (multi-uri support) - */ - public HttpConnection(IRemoteAuthority dest, ISocketFactory factory, String op) { + public String getRequestURI() { + return mHttpreq.getURI(); + } + + public HttpConnection(IRemoteAuthority dest, ISocketFactory factory) { mDest = dest; mReqEncoder = new HttpRequestEncoder(); mHttpClient = new HttpClient(factory); @@ -75,11 +77,10 @@ public class HttpConnection implements IHttpConnection { Debug.trace("Created HttpClient"); try { mHttpreq.setMethod("POST"); - if (op == null) + // in case of multi-uri, uri will be set right before send + // by calling setRequestURI(uri) + if (mDest.getURI() != null) mHttpreq.setURI(mDest.getURI()); - else { - mHttpreq.setURI(mDest.getURI(op)); - } String contentType = dest.getContentType(); if (contentType != null) { @@ -110,26 +111,20 @@ public class HttpConnection implements IHttpConnection { } } - // Inserted by beomsuk - public HttpConnection(IRemoteAuthority dest, ISocketFactory factory, int timeout) { - this(dest, factory, timeout, null); - } - /* * @param op operation to determine the receiving servlet (multi-uri support) */ - public HttpConnection(IRemoteAuthority dest, ISocketFactory factory, int timeout, String op) { + public HttpConnection(IRemoteAuthority dest, ISocketFactory factory, int timeout) { mDest = dest; mReqEncoder = new HttpRequestEncoder(); mHttpClient = new HttpClient(factory); CMS.debug("HttpConn:Created HttpConnection: factory " + factory + "client " + mHttpClient); try { mHttpreq.setMethod("POST"); - if (op == null) + // in case of multi-uri, uri will be set right before send + // by calling setRequestURI(op) + if (mDest.getURI() != null) mHttpreq.setURI(mDest.getURI()); - else { - mHttpreq.setURI(mDest.getURI(op)); - } String contentType = dest.getContentType(); if (contentType != null) { @@ -163,6 +158,7 @@ public class HttpConnection implements IHttpConnection { CMS.debug("in HttpConnection.send " + this); if (Debug.ON) Debug.trace("encoding request "); + String content = null; try { @@ -222,6 +218,10 @@ public class HttpConnection implements IHttpConnection { HttpResponse resp = null; boolean reconnect = false; + if (getRequestURI() == null) { + throw new EBaseException(CMS.getUserMessage("CMS_BASE_INVALID_ATTRIBUTE", "URI not set in HttpRequest")); + } + mHttpreq.setHeader("Content-Length", Integer.toString(content.length())); CMS.debug("HttpConnection.doSend: with String content length: " + Integer.toString(content.length())); |