Tabnine Logo
HtmlQuoting.quoteHtmlChars
Code IndexAdd Tabnine to your IDE (free)

How to use
quoteHtmlChars
method
in
org.apache.hadoop.hbase.http.HtmlQuoting

Best Java code snippets using org.apache.hadoop.hbase.http.HtmlQuoting.quoteHtmlChars (Showing top 20 results out of 315)

origin: apache/hbase

@Override
public void write(byte[] data, int off, int len) throws IOException {
 quoteHtmlChars(out, data, off, len);
}
origin: apache/hbase

@Override
public void write(int b) throws IOException {
 data[0] = (byte) b;
 quoteHtmlChars(out, data, 0, 1);
}
origin: apache/hbase

 @Override
 public String nextElement() {
  return HtmlQuoting.quoteHtmlChars(rawIterator.nextElement());
 }
};
origin: apache/hbase

 /**
  * Quote the server name so that users specifying the HOST HTTP header
  * can't inject attacks.
  */
 @Override
 public String getServerName() {
  return HtmlQuoting.quoteHtmlChars(rawRequest.getServerName());
 }
}
origin: apache/hbase

/**
 * Quote the url so that users specifying the HOST HTTP header
 * can't inject attacks.
 */
@Override
public StringBuffer getRequestURL(){
 String url = rawRequest.getRequestURL().toString();
 return new StringBuffer(HtmlQuoting.quoteHtmlChars(url));
}
origin: apache/hbase

@Override
public Map<String, String[]> getParameterMap() {
 Map<String, String[]> result = new HashMap<>();
 Map<String, String[]> raw = rawRequest.getParameterMap();
 for (Map.Entry<String,String[]> item: raw.entrySet()) {
  String[] rawValue = item.getValue();
  String[] cookedValue = new String[rawValue.length];
  for(int i=0; i< rawValue.length; ++i) {
   cookedValue[i] = HtmlQuoting.quoteHtmlChars(rawValue[i]);
  }
  result.put(HtmlQuoting.quoteHtmlChars(item.getKey()), cookedValue);
 }
 return result;
}
origin: apache/hbase

/**
 * Unquote the name and quote the value.
 */
@Override
public String getParameter(String name) {
 return HtmlQuoting.quoteHtmlChars(rawRequest.getParameter
                (HtmlQuoting.unquoteHtmlChars(name)));
}
origin: apache/hbase

public static void main(String[] args) throws Exception {
 if (args.length == 0) {
   throw new IllegalArgumentException("Please provide some arguments");
 }
 for(String arg:args) {
  System.out.println("Original: " + arg);
  String quoted = quoteHtmlChars(arg);
  System.out.println("Quoted: "+ quoted);
  String unquoted = unquoteHtmlChars(quoted);
  System.out.println("Unquoted: " + unquoted);
  System.out.println();
 }
}
origin: apache/hbase

@Override
public String[] getParameterValues(String name) {
 String unquoteName = HtmlQuoting.unquoteHtmlChars(name);
 String[] unquoteValue = rawRequest.getParameterValues(unquoteName);
 if (unquoteValue == null) {
  return null;
 }
 String[] result = new String[unquoteValue.length];
 for(int i=0; i < result.length; ++i) {
  result[i] = HtmlQuoting.quoteHtmlChars(unquoteValue[i]);
 }
 return result;
}
origin: apache/hbase

/**
 * Quote the given item to make it html-safe.
 * @param item the string to quote
 * @return the quoted string
 */
public static String quoteHtmlChars(String item) {
 if (item == null) {
  return null;
 }
 byte[] bytes = item.getBytes();
 if (needsQuoting(bytes, 0, bytes.length)) {
  ByteArrayOutputStream buffer = new ByteArrayOutputStream();
  try {
   quoteHtmlChars(buffer, bytes, 0, bytes.length);
  } catch (IOException ioe) {
   // Won't happen, since it is a bytearrayoutputstream
  }
  return buffer.toString();
 } else {
  return item;
 }
}
origin: apache/hbase

@Test public void testQuoting() throws Exception {
 assertEquals("ab&lt;cd", HtmlQuoting.quoteHtmlChars("ab<cd"));
 assertEquals("ab&gt;", HtmlQuoting.quoteHtmlChars("ab>"));
 assertEquals("&amp;&amp;&amp;", HtmlQuoting.quoteHtmlChars("&&&"));
 assertEquals(" &apos;\n", HtmlQuoting.quoteHtmlChars(" '\n"));
 assertEquals("&quot;", HtmlQuoting.quoteHtmlChars("\""));
 assertEquals(null, HtmlQuoting.quoteHtmlChars(null));
}
origin: apache/hbase

private void runRoundTrip(String str) throws Exception {
 assertEquals(str,
        HtmlQuoting.unquoteHtmlChars(HtmlQuoting.quoteHtmlChars(str)));
}
origin: com.aliyun.hbase/alihbase-http

@Override
public void write(int b) throws IOException {
 data[0] = (byte) b;
 quoteHtmlChars(out, data, 0, 1);
}
origin: org.apache.hbase/hbase-http

@Override
public void write(int b) throws IOException {
 data[0] = (byte) b;
 quoteHtmlChars(out, data, 0, 1);
}
origin: org.apache.hbase/hbase-http

 /**
  * Quote the server name so that users specifying the HOST HTTP header
  * can't inject attacks.
  */
 @Override
 public String getServerName() {
  return HtmlQuoting.quoteHtmlChars(rawRequest.getServerName());
 }
}
origin: org.apache.hbase/hbase-http

 @Override
 public String nextElement() {
  return HtmlQuoting.quoteHtmlChars(rawIterator.nextElement());
 }
};
origin: com.aliyun.hbase/alihbase-http

 /**
  * Quote the server name so that users specifying the HOST HTTP header
  * can't inject attacks.
  */
 @Override
 public String getServerName() {
  return HtmlQuoting.quoteHtmlChars(rawRequest.getServerName());
 }
}
origin: com.aliyun.hbase/alihbase-http

 @Override
 public String nextElement() {
  return HtmlQuoting.quoteHtmlChars(rawIterator.nextElement());
 }
};
origin: com.aliyun.hbase/alihbase-http

@Override
public String[] getParameterValues(String name) {
 String unquoteName = HtmlQuoting.unquoteHtmlChars(name);
 String[] unquoteValue = rawRequest.getParameterValues(unquoteName);
 if (unquoteValue == null) {
  return null;
 }
 String[] result = new String[unquoteValue.length];
 for(int i=0; i < result.length; ++i) {
  result[i] = HtmlQuoting.quoteHtmlChars(unquoteValue[i]);
 }
 return result;
}
origin: harbby/presto-connectors

/**
 * Unquote the name and quote the value.
 */
@Override
public String getParameter(String name) {
 return HtmlQuoting.quoteHtmlChars(rawRequest.getParameter
                (HtmlQuoting.unquoteHtmlChars(name)));
}
org.apache.hadoop.hbase.httpHtmlQuotingquoteHtmlChars

Javadoc

Quote all of the active HTML characters in the given string as they are added to the buffer.

Popular methods of HtmlQuoting

  • needsQuoting
    Does the given string need to be quoted?
  • unquoteHtmlChars
    Remove HTML quoting from a string.

Popular in Java

  • Running tasks concurrently on multiple threads
  • getExternalFilesDir (Context)
  • setRequestProperty (URLConnection)
  • getApplicationContext (Context)
  • Container (java.awt)
    A generic Abstract Window Toolkit(AWT) container object is a component that can contain other AWT co
  • FileNotFoundException (java.io)
    Thrown when a file specified by a program cannot be found.
  • KeyStore (java.security)
    KeyStore is responsible for maintaining cryptographic keys and their owners. The type of the syste
  • MessageFormat (java.text)
    Produces concatenated messages in language-neutral way. New code should probably use java.util.Forma
  • Pattern (java.util.regex)
    Patterns are compiled regular expressions. In many cases, convenience methods such as String#matches
  • JFrame (javax.swing)
  • Top PhpStorm 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