本文整理了Java中org.restlet.Response.getEntity
方法的一些代码示例,展示了Response.getEntity
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Response.getEntity
方法的具体详情如下:
包路径:org.restlet.Response
类名称:Response
方法名:getEntity
暂无
代码示例来源:origin: org.restlet.osgi/org.restlet
/**
* Indicates if the response should be chunked because its length is
* unknown.
*
* @param response
* The response to analyze.
* @return True if the response should be chunked.
*/
public boolean shouldResponseBeChunked(Response response) {
return (response.getEntity() != null)
&& !response.getEntity().hasKnownSize();
}
代码示例来源:origin: org.restlet.osgi/org.restlet
/**
* Returns the entity representation.
*
* @return The entity representation.
*/
@Override
public Representation getEntity() {
return getWrappedResponse().getEntity();
}
代码示例来源:origin: gofore/aws-training
@Override
public void handle(Request request, Response response) {
super.handle(request, response);
Optional.ofNullable(response.getEntity())
.ifPresent(r -> r.setCharacterSet(CharacterSet.UTF_8));
}
}
代码示例来源:origin: org.restlet.osgi/org.restlet
/**
* If the response entity comes back with no identifier, automatically set
* the request's resource reference's identifier. This is very useful to
* resolve relative references in XSLT for example.
*/
@Override
protected void afterHandle(Request request, Response response) {
if ((response.getEntity() != null)
&& (response.getEntity().getLocationRef() == null)) {
response.getEntity().setLocationRef(
request.getResourceRef().getTargetRef().toString());
}
}
代码示例来源:origin: org.restlet.osgi/org.restlet
/**
* Returns the response entity representation.
*
* @return The response entity representation.
*/
public Representation getResponseEntity() {
return getResponse() == null ? null : getResponse().getEntity();
}
代码示例来源:origin: DeviceConnect/DeviceConnect-Android
/**
* Returns the response entity representation.
*
* @return The response entity representation.
*/
public static Representation getResourceResponseEntity() {
return getResourceResponse() == null ? null : getResourceResponse().getEntity();
}
代码示例来源:origin: org.restlet.jee/org.restlet.ext.xml
@Override
protected void afterHandle(Request request, Response response) {
if ((getMode() == MODE_RESPONSE) && canTransform(response.getEntity())) {
response.setEntity(transform(response.getEntity()));
}
}
代码示例来源:origin: org.restlet.android/org.restlet.ext.atom
/**
* Constructor.
*
* @param clientDispatcher
* The client HTTP dispatcher.
* @param entryUri
* The entry URI.
* @throws IOException
*/
public Entry(Client clientDispatcher, String entryUri) throws IOException {
this(clientDispatcher.handle(new Request(Method.GET, entryUri))
.getEntity());
}
代码示例来源: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.android/org.restlet.ext.atom
/**
* Constructor.
*
* @param clientDispatcher
* The client HTTP dispatcher.
* @param feedUri
* The feed URI.
* @throws IOException
*/
public Feed(Client clientDispatcher, String feedUri) throws IOException {
this(clientDispatcher.handle(new Request(Method.GET, feedUri))
.getEntity());
}
代码示例来源:origin: org.restlet.jee/org.restlet.ext.atom
/**
* Constructor.
*
* @param clientDispatcher
* The client HTTP dispatcher.
* @param entryUri
* The entry URI.
* @throws IOException
*/
public Entry(Client clientDispatcher, String entryUri) throws IOException {
this(clientDispatcher.handle(new Request(Method.GET, entryUri))
.getEntity());
}
代码示例来源:origin: org.restlet.jee/org.restlet.ext.atom
/**
* Constructor.
*
* @param clientDispatcher
* The client HTTP dispatcher.
* @param feedUri
* The feed URI.
* @throws IOException
*/
public Feed(Client clientDispatcher, String feedUri) throws IOException {
this(clientDispatcher.handle(new Request(Method.GET, feedUri))
.getEntity());
}
代码示例来源:origin: org.restlet.android/org.restlet.ext.atom
/**
* Constructor.
*
* @param clientDispatcher
* The client HTTP dispatcher.
* @param categoriesUri
* The feed URI.
* @throws IOException
*/
public Categories(Client clientDispatcher, String categoriesUri)
throws IOException {
this(clientDispatcher.handle(new Request(Method.GET, categoriesUri))
.getEntity());
}
代码示例来源:origin: org.restlet.android/org.restlet.ext.atom
/**
* Retrieves a resource representation.
*
* @param uri
* The resource URI.
* @return The resource representation.
*/
public Representation getResource(String uri) {
return getClientDispatcher().handle(new Request(Method.GET, uri))
.getEntity();
}
代码示例来源:origin: org.restlet.jee/org.restlet.ext.atom
/**
* Retrieves a resource representation.
*
* @param uri
* The resource URI.
* @return The resource representation.
*/
public Representation getResource(String uri) {
return getClientDispatcher().handle(new Request(Method.GET, uri))
.getEntity();
}
代码示例来源:origin: org.apache.polygene.libraries/org.apache.polygene.library.rest-server
void updateResponse( Response response )
{
if( entity != null )
{
EntityState state = spi.entityStateOf( entity );
Tag tag = new Tag( state.entityReference().identity() + "/" + state.version() );
response.getEntity().setModificationDate( java.util.Date.from( state.lastModified() ) );
response.getEntity().setTag( tag );
}
}
代码示例来源:origin: apache/attic-polygene-java
void updateResponse( Response response )
{
if( entity != null )
{
EntityState state = spi.entityStateOf( entity );
Tag tag = new Tag( state.entityReference().identity() + "/" + state.version() );
response.getEntity().setModificationDate( java.util.Date.from( state.lastModified() ) );
response.getEntity().setTag( tag );
}
}
代码示例来源:origin: org.qi4j.library/org.qi4j.library.rest-server
public void updateResponse( Response response )
{
if( entity != null )
{
EntityState state = spi.entityStateOf( entity );
Date lastModified = new Date( state.lastModified() );
Tag tag = new Tag( state.identity().identity() + "/" + state.version() );
response.getEntity().setModificationDate( lastModified );
response.getEntity().setTag( tag );
}
}
代码示例来源:origin: org.restlet.osgi/org.restlet.ext.oauth
@Override
public void doError(Status errorStatus) {
Representation representation = getResponse().getEntity();
if (representation.getMediaType().equals(MediaType.APPLICATION_JSON)) {
// Do not throw an exception here.
getLogger().fine("OAuth response is found.");
// XXX: after #doError, the representation will disposed in
// #handleInbound.
return;
}
// ResourceException will be thrown.
super.doError(errorStatus);
}
代码示例来源:origin: org.restlet.jee/org.restlet.ext.jaxrs
/**
* @see MessageBodyWriter#writeTo(Object, Type, Annotation[], MediaType,
* MultivaluedMap, OutputStream)
*/
@Override
public void writeTo(Reader reader, Class<?> type, Type genericType,
Annotation[] annotations, MediaType mediaType,
MultivaluedMap<String, Object> httpHeaders,
OutputStream entityStream) throws IOException {
CharacterSet cs = Response.getCurrent().getEntity().getCharacterSet();
IoUtils.copy(reader, IoUtils.getWriter(entityStream, cs));
}
}
内容来源于网络,如有侵权,请联系作者删除!