本文整理了Java中org.restlet.data.Response.getEntity
方法的一些代码示例,展示了Response.getEntity
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Response.getEntity
方法的具体详情如下:
包路径:org.restlet.data.Response
类名称:Response
方法名:getEntity
暂无
代码示例来源:origin: org.restlet/org.restlet
/**
* Returns the entity representation.
*
* @return The entity representation.
*/
@Override
public Representation getEntity() {
return getWrappedResponse().getEntity();
}
代码示例来源:origin: org.sonatype.nexus/nexus-test-harness-base
public NexusArtifact searchForSHA1( String sha1 )
throws Exception
{
String serviceURI = "service/local/identify/sha1/" + sha1;
String responseText = RequestFacade.doGetRequest( serviceURI ).getEntity().getText();
log.debug( "responseText: \n" + responseText );
if ( StringUtils.isEmpty( responseText ) )
{
return null;
}
return (NexusArtifact) xstream.fromXML( responseText );
}
代码示例来源:origin: org.sonatype.nexus/nexus-test-harness-launcher
public RoleResource getResourceFromResponse(Response response)
throws IOException
{
String responseString = response.getEntity().getText();
LOG.debug(" getResourceFromResponse: " + responseString);
return getResourceFromResponse(responseString);
}
代码示例来源:origin: org.sonatype.nexus/nexus-test-harness-launcher
public RepositoryTargetResource getResourceFromResponse(Response response)
throws IOException
{
String responseString = response.getEntity().getText();
return this.getResourceFromResponse(responseString);
}
代码示例来源:origin: org.restlet/org.restlet.ext.atom
/**
* Retrieves a resource representation.
*
* @param uri
* The resource URI.
* @return The resource representation.
*/
public Representation getResource(String uri) {
return getClientDispatcher().get(uri).getEntity();
}
代码示例来源:origin: org.sonatype.nexus/nexus-test-harness-base
public RepositoryRouteResource getResourceFromResponse( Response response )
throws IOException
{
String responseString = response.getEntity().getText();
LOG.debug( "responseText: " + responseString );
Assert.assertFalse( "Response text was empty.", StringUtils.isEmpty( responseString ) );
XStreamRepresentation representation = new XStreamRepresentation( xstream, responseString, mediaType );
RepositoryRouteResourceResponse resourceResponse =
(RepositoryRouteResourceResponse) representation.getPayload( new RepositoryRouteResourceResponse() );
return resourceResponse.getData();
}
代码示例来源:origin: uk.org.mygrid.remotetaverna/taverna-rest-client
public String getString(Reference uriReference, MediaType mediaType) throws RESTException {
Response response = context.get(uriReference, mediaType);
try {
return response.getEntity().getText();
} catch (IOException e) {
throw new RESTException("Could not receive " + uriReference, e);
}
}
代码示例来源:origin: org.restlet/org.restlet
@Override
protected void afterHandle(Request request, Response response) {
if (getMode() == MODE_RESPONSE) {
response.setEntity(transform(response.getEntity()));
}
}
代码示例来源:origin: org.restlet/org.restlet.ext.xml
@Override
protected void afterHandle(Request request, Response response) {
if (getMode() == MODE_RESPONSE) {
response.setEntity(transform(response.getEntity()));
}
}
代码示例来源:origin: org.sonatype.nexus/nexus-test-harness-launcher
/**
* Use {@link #getResourceFromText(String)} instead.
*/
@Deprecated
public RepositoryRouteResource getResourceFromResponse(Response response)
throws IOException
{
String responseString = response.getEntity().getText();
LOG.debug("responseText: " + responseString);
Assert.assertTrue(response.getStatus() + "\n" + responseString, response.getStatus().isSuccess());
return getResourceFromText(responseString);
}
代码示例来源:origin: org.sonatype.nexus/nexus-test-harness-base
public UserResource getResourceFromResponse( Response response )
throws IOException
{
String responseString = response.getEntity().getText();
LOG.debug( " getResourceFromResponse: " + responseString );
XStreamRepresentation representation = new XStreamRepresentation( xstream, responseString, mediaType );
// this
UserResourceRequest resourceResponse =
(UserResourceRequest) representation.getPayload( new UserResourceRequest() );
return resourceResponse.getData();
}
代码示例来源:origin: org.sonatype.nexus/nexus-test-harness-base
public RepositoryResource getResourceFromResponse( Response response )
throws IOException
{
String responseString = response.getEntity().getText();
LOG.debug( " getResourceFromResponse: " + responseString );
XStreamRepresentation representation = new XStreamRepresentation( xstream, responseString, mediaType );
RepositoryResourceResponse resourceResponse = (RepositoryResourceResponse) representation
.getPayload( new RepositoryResourceResponse() );
return (RepositoryResource) resourceResponse.getData();
}
代码示例来源:origin: org.sonatype.nexus/nexus-test-harness-launcher
public RepositoryBaseResource getRepositoryBaseResourceFromResponse(Response response)
throws IOException
{
String responseString = response.getEntity().getText();
LOG.debug(" getRepositoryBaseResourceFromResponse: " + responseString);
XStreamRepresentation representation = new XStreamRepresentation(xstream, responseString, mediaType);
RepositoryResourceResponse resourceResponse =
(RepositoryResourceResponse) representation.getPayload(new RepositoryResourceResponse());
return resourceResponse.getData();
}
代码示例来源:origin: org.sonatype.nexus/nexus-test-utils
public RepositoryBaseResource getRepositoryBaseResourceFromResponse( Response response )
throws IOException
{
String responseString = response.getEntity().getText();
LOG.debug( " getRepositoryBaseResourceFromResponse: " + responseString );
XStreamRepresentation representation = new XStreamRepresentation( xstream, responseString, mediaType );
RepositoryResourceResponse resourceResponse =
(RepositoryResourceResponse) representation.getPayload( new RepositoryResourceResponse() );
return resourceResponse.getData();
}
代码示例来源:origin: uk.org.mygrid.remotetaverna/taverna-rest-client
public Response get(Reference uri, MediaType accepts)
throws NotSuccessException, MediaTypeException {
Response response = request(Method.GET, uri, null, null, accepts);
MediaType mediaType = response.getEntity().getMediaType();
if (!accepts.includes(mediaType)) {
throw new MediaTypeException(accepts, mediaType);
}
return response;
}
代码示例来源:origin: org.sonatype.nexus/nexus-test-harness-base
public List<PrivilegeStatusResource> getList( ) throws IOException
{
Response response = this.sendMessage( Method.GET, null );
if ( !response.getStatus().isSuccess() )
{
Assert.fail( "Could not get Privilege: " + response.getStatus() +"\n" + response.getEntity().getText());
}
return this.getResourceListFromResponse( response );
}
代码示例来源:origin: org.sonatype.nexus/nexus-test-harness-launcher
public List<PrivilegeStatusResource> getResourceListFromResponse(Response response)
throws IOException
{
String responseString = response.getEntity().getText();
XStreamRepresentation representation = new XStreamRepresentation(xstream, responseString, mediaType);
PrivilegeListResourceResponse resourceResponse =
(PrivilegeListResourceResponse) representation.getPayload(new PrivilegeListResourceResponse());
return resourceResponse.getData();
}
代码示例来源:origin: org.sonatype.nexus/nexus-test-harness-base
public PrivilegeStatusResource getResourceFromResponse( Response response )
throws IOException
{
String responseString = response.getEntity().getText();
XStreamRepresentation representation = new XStreamRepresentation( xstream, responseString, mediaType );
PrivilegeStatusResourceResponse resourceResponse =
(PrivilegeStatusResourceResponse) representation.getPayload( new PrivilegeStatusResourceResponse() );
return resourceResponse.getData();
}
代码示例来源:origin: org.sonatype.nexus/nexus-test-harness-launcher
public PrivilegeStatusResource getResourceFromResponse(Response response)
throws IOException
{
String responseString = response.getEntity().getText();
XStreamRepresentation representation = new XStreamRepresentation(xstream, responseString, mediaType);
PrivilegeStatusResourceResponse resourceResponse =
(PrivilegeStatusResourceResponse) representation.getPayload(new PrivilegeStatusResourceResponse());
return resourceResponse.getData();
}
代码示例来源:origin: org.sonatype.nexus/nexus-test-harness-base
@SuppressWarnings( "unchecked" )
public List<NexusArtifact> searchFor( Map<String, String> queryArgs )
throws Exception
{
String responseText = doSearchFor( queryArgs ).getEntity().getText();
XStreamRepresentation representation =
new XStreamRepresentation( xstream, responseText, MediaType.APPLICATION_XML );
SearchResponse searchResponde = (SearchResponse) representation.getPayload( new SearchResponse() );
return searchResponde.getData();
}
内容来源于网络,如有侵权,请联系作者删除!