本文整理了Java中org.restlet.Response.isEntityAvailable
方法的一些代码示例,展示了Response.isEntityAvailable
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Response.isEntityAvailable
方法的具体详情如下:
包路径:org.restlet.Response
类名称:Response
方法名:isEntityAvailable
暂无
代码示例来源:origin: org.restlet.osgi/org.restlet
/**
* Indicates if a content is available and can be sent. Several conditions
* must be met: the content must exists and have some available data.
*
* @return True if a content is available and can be sent.
*/
@Override
public boolean isEntityAvailable() {
return getWrappedResponse().isEntityAvailable();
}
代码示例来源:origin: org.restlet.jee/org.restlet.ext.wadl
/**
* Indicates if the application and all its resources can be described using
* WADL.
*
* @param remainingPart
* The URI remaining part.
* @param request
* The request to handle.
* @param response
* The response to update.
*/
protected boolean canDescribe(String remainingPart, Request request,
Response response) {
return isAutoDescribing()
&& Method.OPTIONS.equals(request.getMethod())
&& (response.getStatus().isClientError() || !response
.isEntityAvailable())
&& ("/".equals(remainingPart) || "".equals(remainingPart));
}
代码示例来源:origin: org.restlet.gae/org.restlet.ext.freemarker
@Override
protected void afterHandle(Request request, Response response) {
if (response.isEntityAvailable()
&& response.getEntity().getEncodings()
.contains(Encoding.FREEMARKER)) {
TemplateRepresentation representation = new TemplateRepresentation(
response.getEntity(), this.configuration, response
.getEntity().getMediaType());
representation.setDataModel(createDataModel(request, response));
response.setEntity(representation);
}
}
代码示例来源:origin: org.restlet.jse/org.restlet.example
/**
* Prints the resource's representation.
*
* @param clientResource
* The Restlet client resource.
* @throws IOException
* @throws ResourceException
*/
public static void get(ClientResource clientResource) throws IOException,
ResourceException {
clientResource.get();
if (clientResource.getStatus().isSuccess()
&& clientResource.getResponse().isEntityAvailable()) {
clientResource.getResponseEntity().write(System.out);
}
}
代码示例来源:origin: org.restlet.osgi/org.restlet
if (!response.isEntityAvailable()
|| Status.REDIRECTION_NOT_MODIFIED.equals(response.getStatus())
|| Status.SUCCESS_NO_CONTENT.equals(response.getStatus())
代码示例来源:origin: org.restlet.osgi/org.restlet
.handle(new Request(Method.GET, targetDescriptor));
if (response.getStatus().isSuccess()
&& response.isEntityAvailable()) {
final Representation representation = response.getEntity();
代码示例来源:origin: com.att.ajsc/ajsc-core
/**
* Indicates if the Component hosted by this Servlet is the default one or
* one provided by the user.
*
* @return True if the Component is the default one, false otherwise.
*/
private boolean isDefaultComponent() {
// The Component is provided via an XML configuration file.
Client client = createWarClient(new Context(), getServletConfig());
Response response = client.handle(new Request(Method.GET,
"war:///WEB-INF/restlet.xml"));
if (response.getStatus().isSuccess() && response.isEntityAvailable()) {
return false;
}
// The Component is provided via a context parameter in the "web.xml"
// file.
String componentAttributeName = getInitParameter(COMPONENT_KEY, null);
if (componentAttributeName != null) {
return false;
}
return true;
}
代码示例来源:origin: org.restlet.android/org.restlet.ext.xml
&& response.isEntityAvailable()) {
try {
result = new StreamSource(response.getEntity().getStream());
代码示例来源:origin: org.restlet.jee/org.restlet.ext.xml
&& response.isEntityAvailable()) {
try {
result = new StreamSource(response.getEntity().getStream());
代码示例来源:origin: org.restlet.jse/org.restlet.ext.thymeleaf
@Override
protected void afterHandle(Request request, Response response) {
if (response.isEntityAvailable()
&& response.getEntity().getEncodings().contains(THYMELEAF)) {
try {
final TemplateRepresentation representation = new TemplateRepresentation(
(TemplateRepresentation) response.getEntity(),
getLocale(), response.getEntity().getMediaType());
if ((this.mapDataModel == null)
&& (this.resolverDataModel == null)) {
representation.setDataModel(request, response);
} else {
if (this.mapDataModel == null) {
representation.setDataModel(this.resolverDataModel);
} else {
representation.setDataModel(this.mapDataModel);
}
}
response.setEntity(representation);
} catch (IOException e) {
response.setStatus(Status.SERVER_ERROR_INTERNAL, e);
}
}
}
代码示例来源:origin: org.restlet.jse/org.restlet.ext.velocity
@Override
protected void afterHandle(Request request, Response response) {
if (response.isEntityAvailable()
&& response.getEntity().getEncodings().contains(
Encoding.VELOCITY)) {
代码示例来源:origin: org.restlet.jee/org.restlet.ext.wadl
if (response.isEntityAvailable()) {
response.setStatus(Status.SUCCESS_OK);
代码示例来源:origin: org.restlet.osgi/org.restlet
&& response.isEntityAvailable()) {
t = (Throwable) getClientResource().toObject(
response.getEntity(), throwableClazz);
if (response.isEntityAvailable()) {
StatusInfo si = getClientResource()
.toObject(response.getEntity(),
代码示例来源:origin: org.restlet.jee/org.restlet.ext.jaxrs
&& response.isEntityAvailable()) {
t = (Throwable) getClientResource().toObject(
response.getEntity(), throwableClazz);
if (response.isEntityAvailable()) {
StatusInfo si = getClientResource().toObject(
response.getEntity(), StatusInfo.class);
代码示例来源:origin: org.restlet.jee/org.restlet.ext.wadl
/**
* Attaches an application created from a WADL description document
* available at a given URI reference.
*
* @param wadlRef
* The URI reference to the WADL description document.
* @return The created WADL application.
*/
public WadlApplication attach(Reference wadlRef) {
WadlApplication result = null;
// Adds some common client connectors to load the WADL documents
if (!getClients().contains(wadlRef.getSchemeProtocol())) {
getClients().add(wadlRef.getSchemeProtocol());
}
// Get the WADL document
final Response response = getContext().getClientDispatcher().handle(
new Request(Method.GET, wadlRef));
if (response.getStatus().isSuccess() && response.isEntityAvailable()) {
result = attach(response.getEntity());
}
return result;
}
代码示例来源:origin: org.restlet.osgi/org.restlet
response.getServerInfo().setAcceptingRanges(true);
if (request.getMethod().isSafe() && response.isEntityAvailable()) {
Range responseRange = response.getEntity().getRange();
boolean rangedEntity = responseRange != null && isBytesRange(responseRange);
内容来源于网络,如有侵权,请联系作者删除!