Codota Logo
StringSource.<init>
Code IndexAdd Codota to your IDE (free)

How to use
org.apache.stanbol.enhancer.servicesapi.impl.StringSource
constructor

Best Java code snippets using org.apache.stanbol.enhancer.servicesapi.impl.StringSource.<init> (Showing top 9 results out of 315)

  • Add the Codota plugin to your IDE and get smart completions
private void myMethod () {
Connection c =
  • Codota IconDataSource dataSource;dataSource.getConnection()
  • Codota IconString url;DriverManager.getConnection(url)
  • Codota IconIdentityDatabaseUtil.getDBConnection()
  • Smart code suggestions by Codota
}
origin: stackoverflow.com

WebServiceTemplate template = new WebServiceTemplate(messageFactory);
Result result = new DOMResult();
template.sendSourceAndReceiveToResult(
  new StringSource("<content xmlns=\"http://tempuri.org\"/>"),
  new SoapActionCallback("http://tempuri.org/SOAPAction"),
  result);
origin: stackoverflow.com

 getWebServiceTemplate().marshalSendAndReceive("https://soap.endpoint",
  requestObj, new WebServiceMessageCallback() {

          public void doWithMessage(WebServiceMessage message) {
            try {
              SoapMessage soapMessage = (SoapMessage)message;
              SoapHeader header = soapMessage.getSoapHeader();
              StringSource headerSource = new StringSource("<Security><UsernameToken><SiteId>testlab1</SiteId>"+
"<Password>abcd1234</Password></UsernameToken></Security> ");
              Transformer transformer = TransformerFactory.newInstance().newTransformer();
              transformer.transform(headerSource, header.getResult());
            } catch (Exception e) {
              // exception handling
            }
          }
        });
origin: apache/stanbol

  /** @inheritDoc */
  public ImmutableGraph getGraph(EnhancementJobManager jobManager, 
             ContentItemFactory ciFactory) throws EnhancementException {
    if(graph == null) {
      ContentItem ci;
      try {
        ci = ciFactory.createContentItem(new StringSource(inputText));
      } catch (IOException e) {
        throw new IllegalStateException("Unable to create a ContentItem" +
            "using '"+ciFactory.getClass().getSimpleName()+"'!",e);
      }
      if(chain == null){
        jobManager.enhanceContent(ci);
      } else { //parsing null as chain does not work!
        jobManager.enhanceContent(ci,chain);
      }
      graph = ci.getMetadata().getImmutableGraph();
    }
    return graph;
  }
}
origin: apache/stanbol

    .build());
ContentItem ci = ciFactory.createContentItem(new StringSource(content));
if(!buildAjaxview){ //rewrite to a normal EnhancementRequest
  return enhanceFromData(ci, false, null, false, null, false, null, headers);
origin: org.apache.stanbol/org.apache.stanbol.enhancer.jersey

    .build());
ContentItem ci = ciFactory.createContentItem(new StringSource(content));
if(!buildAjaxview){ //rewrite to a normal EnhancementRequest
  return enhanceFromData(ci, false, null, false, null, false, null, headers);
origin: org.apache.stanbol/org.apache.stanbol.enhancer.test

/**
 * Tests correct handling of  UTF-8 as default charset
 * @throws IOException
 */
@Test
public void testString() throws IOException{
  String test = "Exámplê";
  //first via a StringSource
  ContentSource cs = new StringSource(test);
  Blob blob = createBlob(cs);
  Assert.assertEquals("text/plain", blob.getMimeType());
  Assert.assertTrue(blob.getParameter().containsKey("charset"));
  Assert.assertEquals(UTF8.name(), blob.getParameter().get("charset"));
  String value = new String(IOUtils.toByteArray(blob.getStream()),UTF8);
  Assert.assertEquals(test, value);
}
/**
origin: apache/stanbol

/**
 * Tests correct handling of  UTF-8 as default charset
 * @throws IOException
 */
@Test
public void testString() throws IOException{
  String test = "Exámplê";
  //first via a StringSource
  ContentSource cs = new StringSource(test);
  Blob blob = createBlob(cs);
  Assert.assertEquals("text/plain", blob.getMimeType());
  Assert.assertTrue(blob.getParameter().containsKey("charset"));
  Assert.assertEquals(UTF8.name(), blob.getParameter().get("charset"));
  String value = new String(IOUtils.toByteArray(blob.getStream()),UTF8);
  Assert.assertEquals(test, value);
}
/**
origin: apache/stanbol

/**
 * This tests that texts with custom charsets are converted to UTF-8. 
 * @throws IOException
 */
@Test
public void testStringWithCustomCharset() throws IOException{
  String test = "Exámplê";
  Charset ISO8859_4 = Charset.forName("ISO-8859-4");
  //first via a StringSource
  ContentSource cs = new StringSource(test,ISO8859_4,"text/plain");
  Blob blob = createBlob(cs);
  Assert.assertEquals("text/plain", blob.getMimeType());
  Assert.assertTrue(blob.getParameter().containsKey("charset"));
  Assert.assertEquals(ISO8859_4.name(), blob.getParameter().get("charset"));
  //2nd via a ByteArray
  byte[] data = test.getBytes(ISO8859_4);
  cs = new ByteArraySource(data,"text/plain; charset="+ISO8859_4.name());
  blob = createBlob(cs);
  Assert.assertEquals("text/plain", blob.getMimeType());
  Assert.assertTrue(blob.getParameter().containsKey("charset"));
  Assert.assertEquals(ISO8859_4.name(), blob.getParameter().get("charset"));
  //3rd as Stream
  cs = new StreamSource(new ByteArrayInputStream(data), "text/plain; charset="+ISO8859_4.name());
  blob = createBlob(cs);
  Assert.assertEquals("text/plain", blob.getMimeType());
  Assert.assertTrue(blob.getParameter().containsKey("charset"));
  Assert.assertEquals(ISO8859_4.name(), blob.getParameter().get("charset"));
  cs = new StreamSource(new ByteArrayInputStream(data), "text/plain; "+ISO8859_4.name());
}
/**
origin: org.apache.stanbol/org.apache.stanbol.enhancer.test

/**
 * This tests that texts with custom charsets are converted to UTF-8. 
 * @throws IOException
 */
@Test
public void testStringWithCustomCharset() throws IOException{
  String test = "Exámplê";
  Charset ISO8859_4 = Charset.forName("ISO-8859-4");
  //first via a StringSource
  ContentSource cs = new StringSource(test,ISO8859_4,"text/plain");
  Blob blob = createBlob(cs);
  Assert.assertEquals("text/plain", blob.getMimeType());
  Assert.assertTrue(blob.getParameter().containsKey("charset"));
  Assert.assertEquals(ISO8859_4.name(), blob.getParameter().get("charset"));
  //2nd via a ByteArray
  byte[] data = test.getBytes(ISO8859_4);
  cs = new ByteArraySource(data,"text/plain; charset="+ISO8859_4.name());
  blob = createBlob(cs);
  Assert.assertEquals("text/plain", blob.getMimeType());
  Assert.assertTrue(blob.getParameter().containsKey("charset"));
  Assert.assertEquals(ISO8859_4.name(), blob.getParameter().get("charset"));
  //3rd as Stream
  cs = new StreamSource(new ByteArrayInputStream(data), "text/plain; charset="+ISO8859_4.name());
  blob = createBlob(cs);
  Assert.assertEquals("text/plain", blob.getMimeType());
  Assert.assertTrue(blob.getParameter().containsKey("charset"));
  Assert.assertEquals(ISO8859_4.name(), blob.getParameter().get("charset"));
  cs = new StreamSource(new ByteArrayInputStream(data), "text/plain; "+ISO8859_4.name());
}
/**
org.apache.stanbol.enhancer.servicesapi.implStringSource<init>

Javadoc

Creates a String source with the content type "text/plain".

Popular methods of StringSource

    Popular in Java

    • Running tasks concurrently on multiple threads
    • onRequestPermissionsResult (Fragment)
    • runOnUiThread (Activity)
    • findViewById (Activity)
    • Arrays (java.util)
      This class contains various methods for manipulating arrays (such as sorting and searching). This cl
    • Collection (java.util)
      Collection is the root of the collection hierarchy. It defines operations on data collections and t
    • Collections (java.util)
      This class consists exclusively of static methods that operate on or return collections. It contains
    • NoSuchElementException (java.util)
      Thrown when trying to retrieve an element past the end of an Enumeration or Iterator.
    • Scanner (java.util)
      A parser that parses a text string of primitive types and strings with the help of regular expressio
    • Option (scala)
    Codota Logo
    • Products

      Search for Java codeSearch for JavaScript codeEnterprise
    • IDE Plugins

      IntelliJ IDEAWebStormAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter
    • Company

      About UsContact UsCareers
    • Resources

      FAQBlogCodota Academy Plugin user guide Terms of usePrivacy policyJava Code IndexJavascript Code Index
    Get Codota for your IDE now