@Override void onKnown(URI uri, long[] ticks) { boolean all = false; long[] list = null; int count = 0; synchronized (this) { if (_ticks == null || _ticks.length == 0) all = true; else { for (int i = 0; i < ticks.length; i++) { if (!Tick.isNull(ticks[i])) { if (!Tick.contains(_ticks, ticks[i])) { if (list == null) list = new long[ticks.length]; list[count++] = ticks[i]; } } } } } if (all) { for (int i = 0; i < ticks.length; i++) if (!Tick.isNull(ticks[i])) uri.getBlock(this, ticks[i]); } else if (list != null) { for (int i = 0; i < count; i++) uri.getBlock(this, list[i]); } }
/** * Returns the base url of the provided CachedUrl, checking to see if it's the result of a * redirect. */ public static String getBaseUrl(CachedUrl cu) { // See the comments in LockssResourceHandler.handleLockssRedirect(); // this is the same logic. CIProperties props = cu.getProperties(); if (props != null) { String redir = props.getProperty(CachedUrl.PROPERTY_CONTENT_URL); if (redir != null) { return redir; } else { String url = cu.getUrl(); String nodeUrl = props.getProperty(CachedUrl.PROPERTY_NODE_URL); if (nodeUrl != null && !nodeUrl.equals(url)) { log.debug("getBaseUrl(" + url + "), nodeUrl: " + nodeUrl); if (dirNodeCheckSlash) { URI uri = new URI(url); if (!uri.getPath().endsWith("/")) { URI nodeUri = new URI(nodeUrl); if (nodeUri.getPath().endsWith("/")) { return nodeUrl; } } } else { return nodeUrl; } } } } return cu.getUrl(); }
/** * Resolves an external entity. If the entity cannot be resolved, this method should return <code> * null</code>. This method returns an input source if an entry was found in the catalog for the * given external identifier. It should be overrided if other behaviour is required. * * @param name the identifier of the external entity * @param publicId the public identifier, or <code>null</code> if none was supplied * @param baseURI the URI with respect to which relative systemIDs are interpreted. * @param systemId the system identifier * @throws SAXException any SAX exception, possibly wrapping another exception * @throws IOException thrown if some i/o error occurs */ public InputSource resolveEntity(String name, String publicId, String baseURI, String systemId) throws SAXException, IOException { String resolvedId = null; if (!getUseLiteralSystemId() && baseURI != null) { // Attempt to resolve the system identifier against the base URI. try { URI uri = new URI(new URI(baseURI), systemId); systemId = uri.toString(); } // Ignore the exception. Fallback to the literal system identifier. catch (URI.MalformedURIException ex) { } } if (publicId != null && systemId != null) { resolvedId = resolvePublic(publicId, systemId); } else if (systemId != null) { resolvedId = resolveSystem(systemId); } if (resolvedId != null) { InputSource source = new InputSource(resolvedId); source.setPublicId(publicId); return source; } return null; }
/** @see genSchemaURI */ private URI genSchemaURI(String bezeichnung, int anhang) { URI waere = URI.genSchemaURI(this.lnkThesaurus.getBaseDomain(), bezeichnung + anhang); for (Konzept k : this.lnkThesaurus.getKonzepte()) { if (k.getURI().equals(waere)) { return this.genSchemaURI(bezeichnung, anhang + 1); } } return URI.genSchemaURI(this.lnkThesaurus.getBaseDomain(), bezeichnung + anhang); }
/** * Take a SystemID string and try to turn it into a good absolute URI. * * @param urlString SystemID string * @param base The URI string used as the base for resolving the systemID * @return The resolved absolute URI * @throws TransformerException thrown if the string can't be turned into a URI. */ public static String getAbsoluteURI(String urlString, String base) throws TransformerException { if (base == null) return getAbsoluteURI(urlString); String absoluteBase = getAbsoluteURI(base); URI uri = null; try { URI baseURI = new URI(absoluteBase); uri = new URI(baseURI, urlString); } catch (MalformedURIException mue) { throw new TransformerException(mue); } return replaceChars(uri.toString()); }
/** * Checks for certain params existence in the value, and replace them with real values obtained * from <tt>request</tt>. * * @param value the value of the header param * @param request the request we are processing * @return the value with replaced params */ private static String processParams(String value, Request request) { if (value.indexOf("${from.address}") != -1) { FromHeader fromHeader = (FromHeader) request.getHeader(FromHeader.NAME); if (fromHeader != null) { value = value.replace("${from.address}", fromHeader.getAddress().getURI().toString()); } } if (value.indexOf("${from.userID}") != -1) { FromHeader fromHeader = (FromHeader) request.getHeader(FromHeader.NAME); if (fromHeader != null) { URI fromURI = fromHeader.getAddress().getURI(); String fromAddr = fromURI.toString(); // strips sip: or sips: if (fromURI.isSipURI()) { fromAddr = fromAddr.replaceFirst(fromURI.getScheme() + ":", ""); } // take the userID part int index = fromAddr.indexOf('@'); if (index > -1) fromAddr = fromAddr.substring(0, index); value = value.replace("${from.userID}", fromAddr); } } if (value.indexOf("${to.address}") != -1) { ToHeader toHeader = (ToHeader) request.getHeader(ToHeader.NAME); if (toHeader != null) { value = value.replace("${to.address}", toHeader.getAddress().getURI().toString()); } } if (value.indexOf("${to.userID}") != -1) { ToHeader toHeader = (ToHeader) request.getHeader(ToHeader.NAME); if (toHeader != null) { URI toURI = toHeader.getAddress().getURI(); String toAddr = toURI.toString(); // strips sip: or sips: if (toURI.isSipURI()) { toAddr = toAddr.replaceFirst(toURI.getScheme() + ":", ""); } // take the userID part int index = toAddr.indexOf('@'); if (index > -1) toAddr = toAddr.substring(0, index); value = value.replace("${to.userID}", toAddr); } } return value; }
public boolean process(final SimpleRequest request, final SimpleResponse response) throws IOException { HttpVersion httpversion = request.getRequestLine().getHttpVersion(); response.setStatusLine(httpversion, HttpStatus.SC_OK); response.addHeader(new Header("Content-Type", "text/plain")); URI uri = new URI(request.getRequestLine().getUri(), true); StringBuffer buffer = new StringBuffer(); buffer.append("QueryString=\""); buffer.append(uri.getQuery()); buffer.append("\"\r\n"); response.setBodyString(buffer.toString()); return true; }
private URI buildViewPath() { assertHasText(dbPath, "dbPath"); assertHasText(viewName, "viewName"); URI uri = URI.of(dbPath); if (isNotEmpty(listName)) { uri.append(designDocId).append("_list").append(listName).append(viewName); } else if (ALL_DOCS_VIEW_NAME.equals(viewName)) { uri.append(viewName); } else { assertHasText(designDocId, "designDocId"); uri.append(designDocId).append("_view").append(viewName); } return uri; }
private static Value parseTypedReference(URIString pUriStr) throws IllegalArgumentException { Value strVal; int pos = pUriStr.getPos(); try { strVal = StringValue.parse(pUriStr); } catch (IllegalArgumentException e) { String msg = "Failed to retrieve typed reference string!\n" + pUriStr.markPosition() + "Nested message is:\n" + e.getMessage(); throw new IllegalArgumentException(msg); } URIString refUriStr = new URIString(strVal.toString()); try { URI ref = URI.parseRef(refUriStr, true); return new ReferenceValue(ref); } catch (IllegalArgumentException e) { String msg = "Failed to parse typed reference value!\n" + pUriStr.markPosition(pos) + "Nested message is:\n" + e.getMessage(); throw new IllegalArgumentException(msg); } }
/** * Factory method which tries to parse an untyped value. * * @param pTyped * @param pUriStr * @return <code>Value</code> instance * @throws IllegalArgumentException if parsing failed. */ public static Value parse(boolean pTyped, URIString pUriStr) throws IllegalArgumentException { // TODO: tracing TRC.debug(uriStr.toString()); if (pTyped) return parseTypedValue(pUriStr); URIString uriStr = pUriStr.deepCopy(); Value value; try { StringValue strVal = (StringValue) StringValue.parse(uriStr); // string like value // is this string an instance reference? try { URI ref = URI.parseRef(new URIString(strVal.toString()), false); value = new ReferenceValue(ref); } catch (IllegalArgumentException e) { if ((value = DateTimeValue.parse(strVal.toString())) == null) { // if not dateTimeValue, it is stringvalue value = strVal; } } pUriStr.set(uriStr); return value; } catch (IllegalArgumentException e) { // non string like value if ((value = IntegerValue.parse(uriStr)) != null || (value = RealValue.parse(uriStr)) != null || (value = BooleanValue.parse(uriStr)) != null || (value = CharValue.parse(uriStr)) != null) { pUriStr.set(uriStr); return value; } String msg = "Failed to parse untyped value!\n" + uriStr.markPosition(); throw new IllegalArgumentException(msg); } }
/** * Resolves a resource using the catalog. This method interprets that the namespace URI * corresponds to uri entries in the catalog. Where both a namespace and an external identifier * exist, the namespace takes precedence. * * @param type the type of the resource being resolved * @param namespaceURI the namespace of the resource being resolved, or <code>null</code> if none * was supplied * @param publicId the public identifier of the resource being resolved, or <code>null</code> if * none was supplied * @param systemId the system identifier of the resource being resolved, or <code>null</code> if * none was supplied * @param baseURI the absolute base URI of the resource being parsed, or <code>null</code> if * there is no base URI */ public LSInput resolveResource( String type, String namespaceURI, String publicId, String systemId, String baseURI) { String resolvedId = null; try { // The namespace is useful for resolving namespace aware // grammars such as XML schema. Let it take precedence over // the external identifier if one exists. if (namespaceURI != null) { resolvedId = resolveURI(namespaceURI); } if (!getUseLiteralSystemId() && baseURI != null) { // Attempt to resolve the system identifier against the base URI. try { URI uri = new URI(new URI(baseURI), systemId); systemId = uri.toString(); } // Ignore the exception. Fallback to the literal system identifier. catch (URI.MalformedURIException ex) { } } // Resolve against an external identifier if one exists. This // is useful for resolving DTD external subsets and other // external entities. For XML schemas if there was no namespace // mapping we might be able to resolve a system identifier // specified as a location hint. if (resolvedId == null) { if (publicId != null && systemId != null) { resolvedId = resolvePublic(publicId, systemId); } else if (systemId != null) { resolvedId = resolveSystem(systemId); } } } // Ignore IOException. It cannot be thrown from this method. catch (IOException ex) { } if (resolvedId != null) { return new DOMInputImpl(publicId, resolvedId, baseURI); } return null; }
protected boolean dispatch() throws IOException { UrlParser up = new UrlParser(uri.getPath()); String apps = up.next(); String application; if (apps.equalsIgnoreCase("apps")) application = up.next(); else application = apps; String model = up.next(); if (model.length() == 0) return false; if (checkRhoExtensions(application, model)) return true; Properties reqHash = new Properties(); String actionid = up.next(); String actionnext = up.next(); if (actionid.length() > 0) { if (actionid.length() > 2 && actionid.charAt(0) == '{' && actionid.charAt(actionid.length() - 1) == '}') { reqHash.setProperty("id", actionid); reqHash.setProperty("action", actionnext); } else { reqHash.setProperty("id", actionnext); reqHash.setProperty("action", actionid); } } reqHash.setProperty("application", application); reqHash.setProperty("model", model); reqHash.setProperty("request-method", this.method); reqHash.setProperty("request-uri", uri.getPath()); reqHash.setProperty("request-query", uri.getQueryString()); if (postData != null && postData.size() > 0) { log(postData.toString()); reqHash.setProperty("request-body", postData.toString()); } RubyValue res = RhoRuby.processRequest(reqHash, reqHeaders, resHeaders); processResponse(res); return true; }
/** * Update the permanent redirection list. * * @param the original request * @param the new location */ private static void update_perm_redir_list(RoRequest req, URI new_loc) { HTTPConnection con = req.getConnection(); URI cur_loc = null; try { cur_loc = new URI( new URI(con.getProtocol(), con.getHost(), con.getPort(), null), req.getRequestURI()); } catch (ParseException pe) { if (LOG.isTraceEnabled()) { LOG.trace("An exception occurred: " + pe.getMessage()); } } if (cur_loc != null && !cur_loc.equals(new_loc)) { Hashtable perm_redir_list = Util.getList(perm_redir_cntxt_list, con.getContext()); perm_redir_list.put(cur_loc, new_loc); } }
private Item intern(Item item) { if (item.sameSymbol(ANY.getSymbol())) return ANY; if (item.sameSymbol(VAR.getSymbol())) return VAR; if (item.sameSymbol(TERM.getSymbol())) return TERM; if (item.sameSymbol(URI.getSymbol())) return URI; if (item.sameSymbol(LITERAL.getSymbol())) return LITERAL; if (item.sameSymbol(BNODE.getSymbol())) return BNODE; return item; }
/** * The Location header field must be an absolute URI, but too many broken servers use relative * URIs. So, we always resolve relative to the full request URI. * * @param loc the Location header field * @param req the Request to resolve relative URI's relative to * @return an absolute URI corresponding to the Location header field * @exception ProtocolException if the Location header field is completely unparseable */ private URI resLocHdr(String loc, RoRequest req) throws ProtocolException { try { URI base = new URI( req.getConnection().getProtocol(), req.getConnection().getHost(), req.getConnection().getPort(), null); base = new URI(base, req.getRequestURI()); URI res = new URI(base, loc); if (res.getHost() == null) throw new ProtocolException( "Malformed URL in Location header: `" + loc + "' - missing host field"); return res; } catch (ParseException pe) { throw new ProtocolException( "Malformed URL in Location header: `" + loc + "' - exception was: " + pe.getMessage()); } }
@Override void getKnown(URI uri) { long[] ticks; synchronized (this) { ticks = _ticks != null ? Platform.get().clone(_ticks) : null; } if (ticks == null && !location().isCache()) ticks = Tick.EMPTY; if (ticks != null) uri.onKnown(this, ticks); }
protected boolean httpGetFile() throws IOException { String strContType = getContentType(); if (strContType.length() == 0) { String strTemp = uri.getPath(); if (strTemp.length() == 0 || strTemp.charAt(strTemp.length() - 1) != '/') strTemp += '/'; if (RhoSupport.findClass(strTemp + "controller") != null) return false; int nPos = findIndex(uri.getPath()); if (nPos >= 0) { String url = uri.getPath(); // + (nPos == 0 ? ".iseq" : ""); RubyValue res = RhoRuby.processIndexRequest(url); // erb-compiled should load from class processResponse(res); return true; } if (httpGetIndexFile()) return true; } return httpServeFile(strContType); }
protected boolean httpGetIndexFile() { String strIndex = null; String slash = ""; if (uri.getPath() != null && uri.getPath().length() > 0) slash = uri.getPath().charAt(uri.getPath().length() - 1) == '/' ? "" : "/"; for (int i = 0; i < m_arIndexes.length; i++) { String name = uri.getPath() + slash + m_arIndexes[i]; String nameClass = name; if (nameClass.endsWith(".iseq")) nameClass = nameClass.substring(0, nameClass.length() - 5); if (RhoSupport.findClass(nameClass) != null || RhoRuby.loadFile(name) != null) { strIndex = name; break; } } if (strIndex == null) return false; respondMoved(strIndex); return true; }
void respondMoved(String location) { responseCode = HTTP_MOVED_PERM; responseMsg = "Moved Permanently"; String strLoc = location; if (strLoc.startsWith("/apps")) strLoc = strLoc.substring(5); String strQuery = uri.getQueryString(); if (strQuery != null && strQuery.length() > 0) strLoc += "?" + strQuery; resHeaders.addProperty("Location", strLoc); contentLength = 0; }
public String getFile() { log("getFile"); if (uri != null) { String path = uri.getPath(); if (path != null) { int s0 = path.lastIndexOf('/'); int s1 = path.lastIndexOf('\\'); if (s1 > s0) s0 = s1; if (s0 < 0) s0 = 0; return path.substring(s0); } } return null; }
/* ------------------------------------------------------------ */ public void sendRedirect(String url) throws IOException { if (url == null) throw new IllegalArgumentException(); if (!URI.hasScheme(url)) { StringBuffer buf = _servletHttpRequest.getHttpRequest().getRootURL(); if (url.startsWith("/")) buf.append(URI.canonicalPath(url)); else { String path = _servletHttpRequest.getRequestURI(); String parent = (path.endsWith("/")) ? path : URI.parentPath(path); url = URI.canonicalPath(URI.addPaths(parent, url)); if (!url.startsWith("/")) buf.append('/'); buf.append(url); } url = buf.toString(); } resetBuffer(); _httpResponse.setField(HttpFields.__Location, url); _httpResponse.setStatus(HttpResponse.__302_Moved_Temporarily); complete(); }
public static PropertyDataTypes getTypeByTypeNum(int typeNum) { if (STRING.getTypeNum() == typeNum) return STRING; else if (BINARY.getTypeNum() == typeNum) return BINARY; else if (LONG.getTypeNum() == typeNum) return LONG; else if (DOUBLE.getTypeNum() == typeNum) return DOUBLE; else if (DATE.getTypeNum() == typeNum) return DATE; else if (BOOLEAN.getTypeNum() == typeNum) return BOOLEAN; else if (NAME.getTypeNum() == typeNum) return NAME; else if (PATH.getTypeNum() == typeNum) return PATH; else if (REFERENCE.getTypeNum() == typeNum) return REFERENCE; else if (WEAKREFERENCE.getTypeNum() == typeNum) return WEAKREFERENCE; else if (URI.getTypeNum() == typeNum) return URI; else if (DECIMAL.getTypeNum() == typeNum) return DECIMAL; else return UNDEFINED; }
void callLoginCallback(SyncNotification oNotify, int nErrCode, String strMessage) { try { if (getSync().isStoppedByUser()) return; String strBody = "error_code=" + nErrCode; strBody += "&error_message=" + URI.urlEncode(strMessage != null ? strMessage : ""); strBody += "&rho_callback=1"; LOG.INFO("Login callback: " + oNotify.toString() + ". Body: " + strBody); callNotify(oNotify, strBody); } catch (Exception exc) { LOG.ERROR("Call Login callback failed.", exc); } }
protected boolean httpServeFile(String strContType) throws IOException { String strPath = uri.getPath(); // if ( !strPath.startsWith("/apps") ) // strPath = "/apps" + strPath; if (strContType.equals("application/javascript")) { responseData = RhoRuby.loadFile(strPath); if (responseData == null) { String str = ""; responseData = new ByteArrayInputStream(str.getBytes()); } } else responseData = RhoRuby.loadFile(strPath); if (responseData == null) { Jsr75File file = new Jsr75File(); String strFileName = strPath; if (strFileName.startsWith("/apps")) strFileName = strPath.substring(5); try { file.open(strFileName, true, true); responseData = file.getInputStream(); if (responseData != null) { contentLength = (int) file.length(); } m_file = file; } catch (StorageError exc) { file.close(); } catch (IOException exc) { file.close(); } } else { if (responseData != null) { contentLength = responseData.available(); } } if (responseData == null) return false; if (strContType.length() > 0) resHeaders.addProperty("Content-Type", strContType); resHeaders.addProperty("Content-Length", Integer.toString(contentLength)); return true; }
private static String makeClientCookie(Hashtable headers) throws IOException { if (headers == null) return ""; // ParsedCookie cookie = new ParsedCookie(); String strRes = ""; Enumeration valsHeaders = headers.elements(); Enumeration keysHeaders = headers.keys(); while (valsHeaders.hasMoreElements()) { String strName = (String) keysHeaders.nextElement(); String strValue = (String) valsHeaders.nextElement(); if (strName.equalsIgnoreCase("Set-Cookie")) { LOG.INFO("Set-Cookie: " + strValue); strRes += URI.parseCookie(strValue); } } return strRes; }
/** * Returns an HTTPConnection. A cache of connections is kept and first * consulted; only when the cache lookup fails is a new one created * and added to the cache. * * @param url the url * @return an HTTPConnection * @exception ProtocolNotSuppException if the protocol is not supported */ protected HTTPConnection getConnection(URL url) throws ProtocolNotSuppException { // try the cache, using the host name String php = url.getProtocol() + ":" + url.getHost() + ":" + ((url.getPort() != -1) ? url.getPort() : URI.defaultPort(url.getProtocol())); php = php.toLowerCase(); HTTPConnection con = (HTTPConnection) connections.get(php); if (con != null) return con; // Not in cache, so create new one and cache it con = new HTTPConnection(url); connections.put(php, con); return con; }
String getContentType() { String contType = reqHeaders.getProperty("Content-Type"); if (contType == null || contType.length() == 0) contType = reqHeaders.getProperty("content-type"); if (contType != null && contType.length() > 0) return contType; String path = uri.getPath(); int nPoint = path.lastIndexOf('.'); String strExt = ""; if (nPoint > 0) strExt = path.substring(nPoint + 1); if (strExt.equals("png")) return "image/png"; else if (strExt.equals("jpeg")) return "image/jpeg"; else if (strExt.equals("jpg")) return "image/jpg"; else if (strExt.equals("js")) return "application/javascript"; else if (strExt.equals("css")) return "text/css"; else if (strExt.equals("gif")) return "image/gif"; else if (strExt.equals("html") || strExt.equals("htm")) return "text/html"; return ""; }
@Override void getBlock(URI uri, long tick) { Buff duplicate = null; synchronized (this) { if (Debug.THREADS) ThreadAssert.resume(this, false); int index = Tick.indexOf(_ticks, tick); if (index >= 0) { Buff buff = _buffs[index]; if (buff != null) { duplicate = buff.duplicate(); if (Debug.THREADS) ThreadAssert.exchangeGive(duplicate, duplicate); } } if (Debug.THREADS) ThreadAssert.suspend(this); } if (duplicate != null) { Buff[] duplicates = new Buff[] {duplicate}; if (Debug.THREADS) { ThreadAssert.exchangeTake(duplicate); ThreadAssert.exchangeGive(duplicates, duplicate); } uri.onBlock(this, tick, duplicates, null, true, null, false, null); if (Debug.THREADS) ThreadAssert.exchangeTake(duplicates); duplicate.recycle(); } }
public static SyntacticModelElement buildSyntacticContents( final EObject root, final Set<Diagnostic> errors) { if (!(root instanceof Model)) { return null; } ModelImpl m = (ModelImpl) root; Object[] imps; if (m.eIsSet(GamlPackage.MODEL__IMPORTS)) { List<Import> imports = m.getImports(); imps = new Object[imports.size()]; for (int i = 0; i < imps.length; i++) { URI uri = URI.createURI(imports.get(i).getImportURI(), false); imps[i] = uri; } } else { imps = null; } SyntacticModelElement model = (SyntacticModelElement) SyntacticFactory.create(MODEL, m, EGaml.hasChildren(m), imps); model.setFacet(NAME, convertToLabel(null, m.getName())); convStatements(model, EGaml.getStatementsOf(m), errors); return model; }
/** Invoked by the HTTPClient. */ public int requestHandler(Request req, Response[] resp) { HTTPConnection con = req.getConnection(); URI new_loc, cur_loc; // check for retries HttpOutputStream out = req.getStream(); if (out != null && deferred_redir_list.get(out) != null) { copyFrom((RedirectionModule) deferred_redir_list.remove(out)); req.copyFrom(saved_req); if (new_con) return REQ_NEWCON_RST; else return REQ_RESTART; } // handle permanent redirections try { cur_loc = new URI( new URI(con.getProtocol(), con.getHost(), con.getPort(), null), req.getRequestURI()); } catch (ParseException pe) { throw new Error("HTTPClient Internal Error: unexpected exception '" + pe + "'", pe); } // handle permanent redirections Hashtable perm_redir_list = Util.getList(perm_redir_cntxt_list, req.getConnection().getContext()); if ((new_loc = (URI) perm_redir_list.get(cur_loc)) != null) { /* * copy query if present in old url but not in new url. This isn't * strictly conforming, but some scripts fail to properly propagate the * query string to the Location header. Unfortunately it looks like we're * f****d either way: some scripts fail if you don't propagate the query * string, some fail if you do... God, don't you just love it when people * can't read a spec? Anway, since we can't get it right for all scripts * we opt to follow the spec. String nres = new_loc.getPathAndQuery(), * oquery = Util.getQuery(req.getRequestURI()), nquery = * Util.getQuery(nres); if (nquery == null && oquery != null) nres += "?" * + oquery; */ String nres = new_loc.getPathAndQuery(); req.setRequestURI(nres); try { lastURI = new URI(new_loc, nres); } catch (ParseException pe) { if (LOG.isTraceEnabled()) { LOG.trace("An exception occurred: " + pe.getMessage()); } } if (LOG.isDebugEnabled()) LOG.debug( "Matched request in permanent redirection list - redoing request to " + lastURI.toExternalForm()); if (!con.isCompatibleWith(new_loc)) { try { con = new HTTPConnection(new_loc); } catch (ProtocolNotSuppException e) { throw new Error("HTTPClient Internal Error: unexpected " + "exception '" + e + "'", e); } con.setContext(req.getConnection().getContext()); req.setConnection(con); return REQ_NEWCON_RST; } else { return REQ_RESTART; } } return REQ_CONTINUE; }