/** * Implemented based on the {@link Protocol#isConfidential()} method for the * request's protocol returned by {@link #getProtocol()}; */ @Override public boolean isConfidential() { return (getProtocol() == null) ? false : getProtocol().isConfidential(); }
/** * Returns the protocol by first returning the baseRef.schemeProtocol * property if it is set, or the resourceRef.schemeProtocol property * otherwise. * * @return The protocol or null if not available. */ @Override public Protocol getProtocol() { return getWrappedRequest().getProtocol(); }
/** * Returns the protocol by first returning the resourceRef.schemeProtocol * property if it is set, or the baseRef.schemeProtocol property otherwise. * * @return The protocol or null if not available. * @see Request#getProtocol() */ public Protocol getProtocol() { return getRequest() == null ? null : getRequest().getProtocol(); }
@Override public void handle(Request request, Response response) { super.handle(request, response); if (getHelper() != null) { getHelper().handle(request, response); } else { StringBuilder sb = new StringBuilder(); sb.append("No available client connector supports the required protocol: "); sb.append("'").append(request.getProtocol().getName()).append("'."); sb.append(" Please add the JAR of a matching connector to your classpath."); response.setStatus(Status.CONNECTOR_ERROR_INTERNAL, sb.toString()); } }
/** * Displays a synthesis of the request like an HTTP request line. * * @return A synthesis of the request like an HTTP request line. */ public String toString() { return ((getMethod() == null) ? "" : getMethod().toString()) + " " + ((getResourceRef() == null) ? "" : getResourceRef() .toString()) + " " + ((getProtocol() == null) ? "" : (getProtocol().getName() + ((getProtocol() .getVersion() == null) ? "" : "/" + getProtocol().getVersion()))); }
/** * Displays a synthesis of the response like an HTTP status line. * * @return A synthesis of the response like an HTTP status line. */ public String toString() { return ((getRequest() == null) ? "?" : getRequest().getProtocol()) + " - " + getStatus(); } }
/** * Returns the score for a given call (between 0 and 1.0). * * @param request * The request to score. * @param response * The response to score. * @return The score for a given call (between 0 and 1.0). */ @Override public float score(Request request, Response response) { float result = 0F; // Add the protocol score final Protocol protocol = request.getProtocol(); if (protocol == null) { getLogger().warning( "Unable to determine the protocol to use for this call."); } else if (getClient().getProtocols().contains(protocol)) { result = 1.0F; } if (getLogger().isLoggable(Level.FINER)) { getLogger().finer( "Call score for the \"" + getClient().getProtocols().toString() + "\" client: " + result); } return result; }
@Override public void handle(Request request, Response response) { Protocol rProtocol = request.getProtocol(); Reference rReference = request.getResourceRef(); Protocol protocol = (rProtocol != null) ? rProtocol : (rReference != null) ? rReference .getSchemeProtocol() : null; if (protocol != null) { Client c = clients.get(protocol); if (c == null) { c = new Client(protocol); clients.put(protocol, c); getLogger().fine( "Added runtime client for protocol: " + protocol.getName()); } c.handle(request, response); } else { response.setStatus(Status.SERVER_ERROR_INTERNAL, "The server isn't properly configured to handle client calls."); getLogger().warning( "There is no protocol detected for this request: " + request.getResourceRef()); } }
/** * Handles the call after resolving any URI template on the request's target * resource reference. * * @param request * The request to handle. * @param response * The response to update. */ public int beforeHandle(Request request, Response response) { // Associate the response to the current thread Protocol protocol = request.getProtocol(); if (protocol == null) { throw new UnsupportedOperationException( "Unable to determine the protocol to use for this call."); } String targetUri = request.getResourceRef().toString(true, false); if (targetUri.contains("{")) { // Template URI detected, create the template Template template = new Template(targetUri); // Set the formatted target URI request.setResourceRef(template.format(request, response)); } request.setOriginalRef(ReferenceUtils.getOriginalRef(request.getResourceRef(), request.getHeaders())); return CONTINUE; }
@Override protected int doHandle(Request request, Response response) { int result = CONTINUE; Protocol protocol = request.getProtocol();
@Override public void handle(Request request, Response response) { try { if (Protocol.FTP.equals(request.getProtocol())) { if (Method.GET.equals(request.getMethod())) { Reference ftpRef = request.getResourceRef();
@Override public void handle(Request request, Response response) { try { if (Protocol.FTP.equals(request.getProtocol())) { if (Method.GET.equals(request.getMethod())) { Reference ftpRef = request.getResourceRef();
@Override public void handle(Request request, Response response) { try { if (Protocol.FTP.equals(request.getProtocol())) { if (Method.GET.equals(request.getMethod())) { Reference ftpRef = request.getResourceRef();
&& (request.getProtocol() == Protocol.SDC)) {
return (this.request.getMethod() != null) ? this.request.getMethod().getName() : null; case "p": return (this.request.getProtocol() != null) ? this.request.getProtocol().getName() : null; default: if (variableName.startsWith("o")) {
&& (request.getProtocol() == Protocol.SDC)) {
&& (request.getProtocol() == Protocol.SDC)) {
this.onResponse = request.getOnResponse(); this.proxyChallengeResponse = request.getProxyChallengeResponse(); this.protocol = request.getProtocol();
int result = CONTINUE; Protocol protocol = request.getProtocol();
serverPortValue = request.getProtocol().getDefaultPort();