congrats Icon
New! Announcing Tabnine Chat Beta
Learn More
Tabnine Logo
StringSource.<init>
Code IndexAdd Tabnine 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)

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

    • Making http requests using okhttp
    • getContentResolver (Context)
    • runOnUiThread (Activity)
    • getSharedPreferences (Context)
    • Graphics2D (java.awt)
      This Graphics2D class extends the Graphics class to provide more sophisticated control overgraphics
    • GridBagLayout (java.awt)
      The GridBagLayout class is a flexible layout manager that aligns components vertically and horizonta
    • GregorianCalendar (java.util)
      GregorianCalendar is a concrete subclass of Calendarand provides the standard calendar used by most
    • Manifest (java.util.jar)
      The Manifest class is used to obtain attribute information for a JarFile and its entries.
    • Pattern (java.util.regex)
      Patterns are compiled regular expressions. In many cases, convenience methods such as String#matches
    • Cipher (javax.crypto)
      This class provides access to implementations of cryptographic ciphers for encryption and decryption
    • Top Sublime Text plugins
    Tabnine Logo
    • Products

      Search for Java codeSearch for JavaScript code
    • IDE Plugins

      IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
    • Company

      About UsContact UsCareers
    • Resources

      FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
    Get Tabnine for your IDE now