/** * Returns the host port. * * @return The host port. */ @Override public int getHostPort() { if (!this.hostParsed) { parseHost(); } return super.getHostPort(); }
/** * Returns the host domain name. * * @return The host domain name. */ @Override public String getHostDomain() { if (!this.hostParsed) { parseHost(); } return super.getHostDomain(); }
@Override public boolean abort() { return getHttpCall().abort(); }
/** * Adds the entity headers for the handled uniform call. * * @param response * The response returned. */ protected void addEntityHeaders(HttpResponse response) { Series<Header> responseHeaders = response.getHttpCall() .getResponseHeaders(); Representation entity = response.getEntity(); HeaderUtils.addEntityHeaders(entity, responseHeaders); }
@Override public void handle(Request request, Response response) { try { ClientCall clientCall = getAdapter().toSpecific(this, request); getAdapter().commit(clientCall, request, response); } catch (Exception e) { getLogger().log(Level.INFO, "Error while handling an HTTP client call", e); response.setStatus(Status.CONNECTOR_ERROR_INTERNAL, e); } }
/** * Returns the HTTP client helper. * * @return The HTTP client helper. */ @Override public HttpClientHelper getHelper() { return (HttpClientHelper) super.getHelper(); }
/** * Returns the representation provided by the client. * * @return The representation provided by the client. */ @Override public Representation getEntity() { if (!this.entityAdded) { setEntity(((ServerCall) getHttpCall()).getRequestEntity()); this.entityAdded = true; } return super.getEntity(); }
protected Series<org.restlet.engine.header.Header> getRawHeaders() { return getTarget().getHttpCall().getResponseHeaders(); }
protected Series<org.restlet.engine.header.Header> getRawHeaders() { return getTarget().getHttpCall().getRequestHeaders(); }
@Override public void flushBuffers() throws IOException { getHttpCall().flushBuffers(); }
/** * Indicates if both the client and the server want a persistent connection. * * @return True if the connection should be kept alive after the call * processing. */ protected boolean isKeepAlive() { return isClientKeepAlive() && isServerKeepAlive(); }
/** * Constructor. * * @param serverAddress * The server IP address. * @param serverPort * The server port. */ public ServerCall(String serverAddress, int serverPort) { setServerAddress(serverAddress); setServerPort(serverPort); this.hostParsed = false; }
/** * Constructor. * * @param httpCall * The low-level HTTP server call. * @param request * The associated high-level request. */ public HttpResponse(ServerCall httpCall, Request request) { super(request); this.serverAdded = false; this.httpCall = httpCall; // Set the properties setStatus(Status.SUCCESS_OK); }
/** * Returns the content length of the request entity if know, * {@link Representation#UNKNOWN_SIZE} otherwise. * * @return The request content length. */ protected long getContentLength() { return HeaderUtils.getContentLength(getRequestHeaders()); }
/** * Returns the exact protocol (HTTP or HTTPS). * * @return The exact protocol (HTTP or HTTPS). */ public Protocol getProtocol() { if (this.protocol == null) { this.protocol = isConfidential() ? Protocol.HTTPS : Protocol.HTTP; } return this.protocol; }
/** * Returns true if the given exception is caused by a broken connection. * * @param exception * The exception to inspect. * @return True if the given exception is caused by a broken connection. */ public boolean isConnectionBroken(Throwable exception) { return isBroken(exception); }
/** * Indicates if the request entity is chunked. * * @return True if the request entity is chunked. */ protected boolean isRequestChunked() { return HeaderUtils.isChunkedEncoding(getRequestHeaders()); }
/** * Indicates if the response entity is chunked. * * @return True if the response entity is chunked. */ protected boolean isResponseChunked() { return HeaderUtils.isChunkedEncoding(getResponseHeaders()); }
/** * Returns the HTTP client helper. * * @return The HTTP client helper. */ @Override public HttpClientHelper getHelper() { return (HttpClientHelper) super.getHelper(); }
/** * Returns the HTTP client helper. * * @return The HTTP client helper. */ @Override public HttpClientHelper getHelper() { return (HttpClientHelper) super.getHelper(); }