本文整理了Java中org.restlet.Request.getProtocol
方法的一些代码示例,展示了Request.getProtocol
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Request.getProtocol
方法的具体详情如下:
包路径:org.restlet.Request
类名称:Request
方法名:getProtocol
[英]Returns the protocol used or to be used, if known.
[中]返回已使用或将要使用的协议(如果已知)。
代码示例来源:origin: org.restlet.osgi/org.restlet
/**
* 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();
}
代码示例来源:origin: org.restlet.osgi/org.restlet
/**
* 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();
}
代码示例来源:origin: org.restlet.osgi/org.restlet
/**
* 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();
}
代码示例来源:origin: org.restlet.osgi/org.restlet
@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());
}
}
代码示例来源:origin: org.restlet.osgi/org.restlet
/**
* 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())));
}
代码示例来源:origin: org.restlet.osgi/org.restlet
/**
* 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();
}
}
代码示例来源:origin: org.restlet.osgi/org.restlet
/**
* 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;
}
代码示例来源:origin: org.restlet.osgi/org.restlet
@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());
}
}
代码示例来源:origin: org.restlet.osgi/org.restlet
/**
* 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;
}
代码示例来源:origin: org.restlet.osgi/org.restlet
@Override
protected int doHandle(Request request, Response response) {
int result = CONTINUE;
Protocol protocol = request.getProtocol();
代码示例来源:origin: org.restlet.osgi/org.restlet
@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();
代码示例来源:origin: org.restlet.jse/org.restlet.ext.net
@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();
代码示例来源:origin: org.restlet.jee/org.restlet.ext.net
@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();
代码示例来源:origin: org.restlet.jse/org.restlet.ext.net
&& (request.getProtocol() == Protocol.SDC)) {
代码示例来源:origin: org.restlet.osgi/org.restlet
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")) {
代码示例来源:origin: org.restlet.jee/org.restlet.ext.net
&& (request.getProtocol() == Protocol.SDC)) {
代码示例来源:origin: org.restlet.osgi/org.restlet
&& (request.getProtocol() == Protocol.SDC)) {
代码示例来源:origin: org.restlet.osgi/org.restlet
this.onResponse = request.getOnResponse();
this.proxyChallengeResponse = request.getProxyChallengeResponse();
this.protocol = request.getProtocol();
代码示例来源:origin: org.restlet.osgi/org.restlet
int result = CONTINUE;
Protocol protocol = request.getProtocol();
代码示例来源:origin: org.restlet.osgi/org.restlet
serverPortValue = request.getProtocol().getDefaultPort();
内容来源于网络,如有侵权,请联系作者删除!