当前位置: 首页>>代码示例>>Java>>正文


Java IOUtils.toString方法代码示例

本文整理汇总了Java中org.apache.cxf.helpers.IOUtils.toString方法的典型用法代码示例。如果您正苦于以下问题:Java IOUtils.toString方法的具体用法?Java IOUtils.toString怎么用?Java IOUtils.toString使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.apache.cxf.helpers.IOUtils的用法示例。


在下文中一共展示了IOUtils.toString方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: doPost

import org.apache.cxf.helpers.IOUtils; //导入方法依赖的package包/类
String doPost(String api, Prameters prams) {
    WebClient wc = WebClient.create(api);
    Form form = new Form();
    form.param(ACCESS_TOKEN, access_token());
    String[] keys = prams.keys;
    for(int i = 0 ; i < keys.length ; i ++){
        form.param(keys[i], prams.value(i).toString());
    }
    Response resp = wc.form(form);
    String result = "";
    try {
        result = IOUtils.toString((InputStream) resp.getEntity());
    } catch (IOException e) {
        throw new ParseResultException(e);
    }
    handleResponse(resp, wc);
    return result;
}
 
开发者ID:kylinsoong,项目名称:weibo4j,代码行数:19,代码来源:Weibo.java

示例2: doPostOauth2

import org.apache.cxf.helpers.IOUtils; //导入方法依赖的package包/类
String doPostOauth2(String api, Prameters prams) {
    WebClient wc = WebClient.create(api);
    Form form = new Form();
    String[] keys = prams.keys;
    for(int i = 0 ; i < keys.length ; i ++){
        form.param(keys[i], prams.value(i).toString());
    }
    Response resp = wc.form(form);
    String result = "";
    try {
        result = IOUtils.toString((InputStream) resp.getEntity());
    } catch (IOException e) {
        throw new ParseResultException(e);
    }
    handleResponse(resp, wc);
    return result;
}
 
开发者ID:kylinsoong,项目名称:weibo4j,代码行数:18,代码来源:Weibo.java

示例3: doGet

import org.apache.cxf.helpers.IOUtils; //导入方法依赖的package包/类
String doGet(String api, Prameters prams){
    WebClient wc = WebClient.create(api);
    wc.query(ACCESS_TOKEN, access_token());
    String[] keys = prams.keys;
    for(int i = 0 ; i < keys.length ; i ++){
        wc.query(keys[i], prams.value(i));
    }
    Response resp = wc.get();
    String result = "";
    try {
        result = IOUtils.toString((InputStream) resp.getEntity());
    } catch (IOException e) {
        throw new ParseResultException(e);
    }
    handleResponse(resp, wc);
    return result;
}
 
开发者ID:kylinsoong,项目名称:weibo4j,代码行数:18,代码来源:Weibo.java

示例4: deleteDocstoreRecord

import org.apache.cxf.helpers.IOUtils; //导入方法依赖的package包/类
public String deleteDocstoreRecord(String docType, String uuid) throws IOException {
    String docstoreRestfulURL = SpringContext.getBean(ConfigurationService.class).getPropertyValueAsString(
            OLEConstants.OLE_DOCSTORE_RESTFUL_URL);
    docstoreRestfulURL = docstoreRestfulURL.concat("/") + uuid;
    HttpClient httpClient = new HttpClient();
    DeleteMethod deleteMethod = new DeleteMethod(docstoreRestfulURL);
    NameValuePair nvp1 = new NameValuePair(OLEConstants.IDENTIFIER_TYPE, OLEConstants.UUID);
    NameValuePair nvp2 = new NameValuePair(OLEConstants.OPERATION, OLEConstants.DELETE);
    NameValuePair category = new NameValuePair(OLEConstants.DOC_CATEGORY, OLEConstants.BIB_CATEGORY_WORK);
    NameValuePair type = new NameValuePair(OLEConstants.DOC_TYPE, docType);
    NameValuePair format = new NameValuePair(OLEConstants.DOC_FORMAT, OLEConstants.BIB_FORMAT_OLEML);
    deleteMethod.setQueryString(new NameValuePair[]{nvp1, nvp2, category, type, format});
    int statusCode = httpClient.executeMethod(deleteMethod);
    InputStream inputStream = deleteMethod.getResponseBodyAsStream();
    return IOUtils.toString(inputStream);
}
 
开发者ID:VU-libtech,项目名称:OLE-INST,代码行数:17,代码来源:OleDocstoreHelperServiceImpl.java

示例5: extract

import org.apache.cxf.helpers.IOUtils; //导入方法依赖的package包/类
protected SAML2ReceivedResponseTO extract(
        final String spEntityID,
        final String urlContext,
        final String clientAddress,
        final InputStream response) throws IOException {

    String strForm = IOUtils.toString(response);
    MultivaluedMap<String, String> params = JAXRSUtils.getStructuredParams(strForm, "&", false, false);

    String samlResponse = params.getFirst(SSOConstants.SAML_RESPONSE);
    if (StringUtils.isNotBlank(samlResponse)) {
        samlResponse = URLDecoder.decode(samlResponse, StandardCharsets.UTF_8.name());
        LOG.debug("Received SAML Response: {}", samlResponse);
    }

    String relayState = params.getFirst(SSOConstants.RELAY_STATE);
    LOG.debug("Received Relay State: {}", relayState);

    SAML2ReceivedResponseTO receivedResponseTO = new SAML2ReceivedResponseTO();
    receivedResponseTO.setSpEntityID(spEntityID);
    receivedResponseTO.setUrlContext(urlContext);
    receivedResponseTO.setSamlResponse(samlResponse);
    receivedResponseTO.setRelayState(relayState);
    return receivedResponseTO;
}
 
开发者ID:apache,项目名称:syncope,代码行数:26,代码来源:AbstractSAML2SPServlet.java

示例6: testgetTechnicalComponents

import org.apache.cxf.helpers.IOUtils; //导入方法依赖的package包/类
@Test
public void testgetTechnicalComponents() throws Exception {
	logger.info("======= Running test testgetTechnicalComponents ===========");
	WebClient client = WebClient.create(endpointUrl
			+ "?serviceClassName=com.liferay.infinity.service.InfrastructureServiceUtil&serviceMethodName=getTechnicalComponents");
	Response r = client.accept("text/plain").get();
	assertEquals(Response.Status.OK.getStatusCode(), r.getStatus());
	String value = IOUtils.toString((InputStream) r.getEntity());
	assertEquals(
			"[{\"id\":\"212\",\"other\":null,\"name\":null,\"value\":\"Application Service Delivery\",\"javaClass\":\"org.infinity.model.ValueID\"}," +
			"{\"id\":\"242\",\"other\":null,\"name\":null,\"value\":\"Backbone Network\",\"javaClass\":\"org.infinity.model.ValueID\"}," +
			"{\"id\":\"277\",\"other\":null,\"name\":null,\"value\":\"Cloud Network\",\"javaClass\":\"org.infinity.model.ValueID\"}," +
			"{\"id\":\"194\",\"other\":null,\"name\":null,\"value\":\"Customers Device\",\"javaClass\":\"org.infinity.model.ValueID\"}," +
			"{\"id\":\"204\",\"other\":null,\"name\":null,\"value\":\"Data Context Management\",\"javaClass\":\"org.infinity.model.ValueID\"}," +
			"{\"id\":\"218\",\"other\":null,\"name\":null,\"value\":\"Mobile Network\",\"javaClass\":\"org.infinity.model.ValueID\"}," +
			"{\"id\":\"2377\",\"other\":null,\"name\":null,\"value\":\"Satellite Network\",\"javaClass\":\"org.infinity.model.ValueID\"}," +
			"{\"id\":\"176\",\"other\":null,\"name\":null,\"value\":\"Sensor Network\",\"javaClass\":\"org.infinity.model.ValueID\"}," +
			"{\"id\":\"230\",\"other\":null,\"name\":null,\"value\":\"WIFI Network\",\"javaClass\":\"org.infinity.model.ValueID\"}," +
			"{\"id\":\"264\",\"other\":null,\"name\":null,\"value\":\"Wired Access Network\",\"javaClass\":\"org.infinity.model.ValueID\"}]",
			value);
}
 
开发者ID:SmartInfrastructures,项目名称:xipi,代码行数:22,代码来源:TransformationTest.java

示例7: inputStream2String

import org.apache.cxf.helpers.IOUtils; //导入方法依赖的package包/类
/**
 * 
 * 输入流转化为string
 *
 * @param is
 * @return
 * @throws IOException    
 * @since eSDK Solution Platform SSO V1R3C10
 */
private String inputStream2String(InputStream is)
    throws IOException
{
    if (null == is)
    {
        return "";
    }
    
    return IOUtils.toString(is, "UTF-8");
}
 
开发者ID:Huawei,项目名称:eSDK_EC_SDK_Java,代码行数:20,代码来源:ESDKCallbackRestServlet.java

示例8: testShouldNotFailWhenThereAreNonASCIICharactersOnHeaders

import org.apache.cxf.helpers.IOUtils; //导入方法依赖的package包/类
@Test
public void testShouldNotFailWhenThereAreNonASCIICharactersOnHeaders() throws Exception {
    // given
    String folder = tempFolder.newFolder().toString();

    String url1 = "http://a.com";

    Map<String, List<String>> headers = new HashMap<>();
    Character invalidChar = new Character((char) 0x80);
    String headerValue = "inline; filename=\"Invalid_" + invalidChar + "\"";
    headers.put("Content-Disposition", asList(headerValue));

    Page target1 = new Page(new URL(url1), html, headers);

    WarcTargetRepository repository = new WarcTargetRepository(folder);

    // when
    repository.insert(target1);
    repository.close();

    RepositoryIterator respositoryIterator = repository.iterator();

    // then
    assertTrue(respositoryIterator.hasNext());
    WARCRecord record = respositoryIterator.next();
    assertThat(record.getHeader().getUrl(), is(url1));
    String recordData = IOUtils.toString(record);
    assertThat(recordData, containsString(html));
    assertThat(recordData, containsString(headerValue));

    assertFalse(respositoryIterator.hasNext());
}
 
开发者ID:ViDA-NYU,项目名称:ache,代码行数:33,代码来源:WarcTargetRepositoryTest.java

示例9: getMetadata

import org.apache.cxf.helpers.IOUtils; //导入方法依赖的package包/类
@GET
@Path("/$metadata")
@Produces("application/xml")
public String getMetadata() {
    try {
        final String src = File.separatorChar + "v4" + File.separatorChar + "metadata.xml";
        return IOUtils.toString(getClass().getResourceAsStream(src), "UTF-8");
    } catch (Exception e) {
        LOG.error("Failure retrieving metadata information", e);
        return "";
    }
}
 
开发者ID:ashank,项目名称:Office-365-SDK-for-Android,代码行数:13,代码来源:V4Services.java

示例10: getMetadata

import org.apache.cxf.helpers.IOUtils; //导入方法依赖的package包/类
@GET
@Path("/$metadata")
@Produces("application/xml")
public String getMetadata() {
    try {
        final String src = File.separatorChar + "v3" + File.separatorChar + "metadata.xml";
        return IOUtils.toString(getClass().getResourceAsStream(src), "UTF-8");
    } catch (Exception e) {
        LOG.error("Failure retrieving metadata information", e);
        return "";
    }
}
 
开发者ID:ashank,项目名称:Office-365-SDK-for-Android,代码行数:13,代码来源:V3Services.java

示例11: testPing

import org.apache.cxf.helpers.IOUtils; //导入方法依赖的package包/类
@Test
public void testPing() throws Exception {
	WebClient client = WebClient.create(endpointUrl + "/hello/echo/SierraTangoNevada");
	Response r = client.accept("text/plain").get();
	assertEquals(Response.Status.OK.getStatusCode(), r.getStatus());
	String value = IOUtils.toString((InputStream)r.getEntity());
	assertEquals("SierraTangoNevada", value);
}
 
开发者ID:vitrofp7,项目名称:vitro,代码行数:9,代码来源:HelloWorldIT.java

示例12: testGetClassificationsShortUrl

import org.apache.cxf.helpers.IOUtils; //导入方法依赖的package包/类
@Test
public void testGetClassificationsShortUrl() throws Exception {
    WebClient client = WebClient.create(endpointUrl + "/classifications/yugioh/Astral");
    Response r = client.accept("application/json").get();
    assertEquals(Response.Status.OK.getStatusCode(), r.getStatus());
    String value = IOUtils.toString((InputStream) r.getEntity());
    assertNotNull(value);
    // TODO: deserialize and read
}
 
开发者ID:ArturD,项目名称:holmes,代码行数:10,代码来源:ClassificationResourceIT.java

示例13: testGetClassificationsFullUrl

import org.apache.cxf.helpers.IOUtils; //导入方法依赖的package包/类
@Test
public void testGetClassificationsFullUrl() throws Exception {
    WebClient client = WebClient.create(endpointUrl + "/classifications/http://yugioh.wikia.com/api.php/Astral");
    Response r = client.accept("application/json").get();
    assertEquals(Response.Status.OK.getStatusCode(), r.getStatus());
    String value = IOUtils.toString((InputStream) r.getEntity());
    assertNotNull(value);
    // TODO: deserialize and read
}
 
开发者ID:ArturD,项目名称:holmes,代码行数:10,代码来源:ClassificationResourceIT.java

示例14: readFrom

import org.apache.cxf.helpers.IOUtils; //导入方法依赖的package包/类
public Object readFrom(Class<Object> type, Type genericType, Annotation[] annotations, MediaType mediaType, MultivaluedMap<String, String> httpHeaders, InputStream entityStream) throws IOException, WebApplicationException {
	String s=IOUtils.toString(entityStream);
	return JSON.parseObject(s, genericType);
}
 
开发者ID:GeeQuery,项目名称:cxf-plus,代码行数:5,代码来源:FastJSONProvider.java

示例15: getResource

import org.apache.cxf.helpers.IOUtils; //导入方法依赖的package包/类
/**
 * @param stream an input stream we can read the file from (this will close it for you)
 */
protected String getResource(InputStream stream) throws Exception {
    return IOUtils.toString(stream, "UTF-8");
}
 
开发者ID:uoa-group-applications,项目名称:morc,代码行数:7,代码来源:JsonTestResource.java


注:本文中的org.apache.cxf.helpers.IOUtils.toString方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。