com.wewebu.ow.server.util
Class OwHTMLHelper

java.lang.Object
  extended by com.wewebu.ow.server.util.OwHTMLHelper

public class OwHTMLHelper
extends Object

Utility class for HTML creation.

Alfresco Workdesk
Copyright (c) Alfresco Software, Inc.
All rights reserved.

For licensing information read the license.txt file or
go to: http://wiki.alfresco.com


Constructor Summary
OwHTMLHelper()
           
 
Method Summary
static String encodeJavascriptString(String in_p)
          Replaces all JavaScript Special characters with their backslash based escape sequence.
static String encodeJavascriptString(String in_p, boolean useUnicodeEscapes_p)
          Replaces all JavaScript Special characters with their escape sequence.
Depending on the value of the useUnicodeEscapes_p parameter unicode escape sequences or backslash escape sequences can be used.
static String encodeJavascriptVariableName(String input_p)
          Replace illegal '-' char with '_' to obtain a legal JavaScript variable name.
static String encodeToSecureHTML(String sText_p)
          convert the given text to a string with HTML tags and special chars for HTML display
static void writeSecureHTML(Writer w_p, String sText_p)
          write the given text and convert HTML tags and special chars
static void writeSecureHTML(Writer w_p, String sText_p, boolean encodeEnter_p)
          write the given text and convert HTML tags and special chars
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

OwHTMLHelper

public OwHTMLHelper()
Method Detail

encodeToSecureHTML

public static String encodeToSecureHTML(String sText_p)
                                 throws IOException
convert the given text to a string with HTML tags and special chars for HTML display

Parameters:
sText_p - the text that have to be converted
Returns:
String encoded string
Throws:
IOException

writeSecureHTML

public static void writeSecureHTML(Writer w_p,
                                   String sText_p)
                            throws IOException
write the given text and convert HTML tags and special chars

Parameters:
w_p - writer
sText_p - text to be converted
Throws:
IOException

writeSecureHTML

public static void writeSecureHTML(Writer w_p,
                                   String sText_p,
                                   boolean encodeEnter_p)
                            throws IOException
write the given text and convert HTML tags and special chars

Parameters:
w_p - writer
sText_p - text to be converted
encodeEnter_p - flag for also encoding the ENTER char to
Throws:
IOException

encodeJavascriptString

public static String encodeJavascriptString(String in_p)
Replaces all JavaScript Special characters with their backslash based escape sequence.
Some HTML JavaScripting related character sequences are also escaped to avoid security issues : 1. Any occurrence of the </script> in the given string will be replaced by </script> to avoid HTML parse errors.
2. Any occurrence of the % character is escaped using its unicode escape sequence to avoid HTML anchor-href escape interpretation script issues

Parameters:
in_p - String input to be encoded
Returns:
String encoded string

encodeJavascriptVariableName

public static String encodeJavascriptVariableName(String input_p)
Replace illegal '-' char with '_' to obtain a legal JavaScript variable name.

Parameters:
input_p - - the input string
Returns:
- the modified string.
Since:
3.1.0.0

encodeJavascriptString

public static String encodeJavascriptString(String in_p,
                                            boolean useUnicodeEscapes_p)
Replaces all JavaScript Special characters with their escape sequence.
Depending on the value of the useUnicodeEscapes_p parameter unicode escape sequences or backslash escape sequences can be used.
Some HTML JavaScripting related character sequences are also escaped to avoid security issues : 1. Any occurrence of the </script> in the given string will be replaced by </script> to avoid HTML parse errors.
2. Any occurrence of the % character is escaped using its unicode escape sequence to avoid HTML anchor-href escape interpretation script issues

Parameters:
in_p - String input to be encoded
useUnicodeEscapes_p - if true special characters are using only unicode escape sequences
Returns:
String encoded string
Since:
3.1.0.0


Copyright © 2013 Alfresco Business Solutions. All Rights Reserved.