Snipt.net is closing on December 31st, 2016

For more information, please visit this blog post.

snipt

Ctrl+h for KB shortcuts

Text only

Activate Tomcat Manager

1
2
3
4
nano /etc/tomcat7/tomcat-users.xml

<role rolename="manager-gui"/>
<user username="webadmin" password="webadmin" roles="manager-gui"/>
https://snipt.net/embed/baab80616b8387ad900b6fce4a5b3b78/
https://snipt.net/raw/baab80616b8387ad900b6fce4a5b3b78/
baab80616b8387ad900b6fce4a5b3b78
text
Text only
4
2016-12-04T01:08:12
True
False
False
Sep 18, 2014 at 09:06 AM
/api/public/snipt/111475/
activate-tomcat-manager
<table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><a href="#L-1">1</a> <a href="#L-2">2</a> <a href="#L-3">3</a> <a href="#L-4">4</a></pre></div></td><td class="code"><div class="highlight"><pre><span></span><span id="L-1"><a name="L-1"></a>nano /etc/tomcat7/tomcat-users.xml </span><span id="L-2"><a name="L-2"></a> </span><span id="L-3"><a name="L-3"></a>&lt;role rolename=&quot;manager-gui&quot;/&gt; </span><span id="L-4"><a name="L-4"></a>&lt;user username=&quot;webadmin&quot; password=&quot;webadmin&quot; roles=&quot;manager-gui&quot;/&gt; </span></pre></div> </td></tr></table>
configuration, tomcat

Java

Stream to String

1
2
3
StringWriter writer = new StringWriter();
IOUtils.copy(inputStream, writer, encoding);
String theString = writer.toString();
https://snipt.net/embed/14f145a3a5201607e38146e124cf6585/
https://snipt.net/raw/14f145a3a5201607e38146e124cf6585/
14f145a3a5201607e38146e124cf6585
java
Java
3
2016-12-08T09:49:25
True
False
False
/api/public/snipt/40663/
stream-to-string
<table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><a href="#L-1">1</a> <a href="#L-2">2</a> <a href="#L-3">3</a></pre></div></td><td class="code"><div class="highlight"><pre><span></span><span id="L-1"><a name="L-1"></a><span class="n">StringWriter</span> <span class="n">writer</span> <span class="o">=</span> <span class="k">new</span> <span class="n">StringWriter</span><span class="o">();</span> </span><span id="L-2"><a name="L-2"></a><span class="n">IOUtils</span><span class="o">.</span><span class="na">copy</span><span class="o">(</span><span class="n">inputStream</span><span class="o">,</span> <span class="n">writer</span><span class="o">,</span> <span class="n">encoding</span><span class="o">);</span> </span><span id="L-3"><a name="L-3"></a><span class="n">String</span> <span class="n">theString</span> <span class="o">=</span> <span class="n">writer</span><span class="o">.</span><span class="na">toString</span><span class="o">();</span> </span></pre></div> </td></tr></table>
java, servlet, stream, string, tomcat
Copyrighted, illegal, or inappropriate content? Email [email protected].