com.opensymphony.xwork2.util.TextParseUtil Java Examples

The following examples show how to use com.opensymphony.xwork2.util.TextParseUtil. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: TextParserSample.java    From Android_Code_Arbiter with GNU Lesser General Public License v3.0 5 votes vote down vote up
public void unsafeTextParseUtil(String input) {
    TextParseUtil.translateVariables(input, null);
    TextParseUtil.translateVariables(input, null, null);
    TextParseUtil.translateVariables('a', input, null);
    TextParseUtil.translateVariables('a', input, null, null);
    TextParseUtil.translateVariables(new char[]{'a'}, input, null, null, null);
    TextParseUtil.translateVariables(new char[]{'a'}, input, null, null, null, 0);
    TextParseUtil.translateVariables('a', input, null, null, null, 0);
}
 
Example #2
Source File: TextParserSample.java    From Android_Code_Arbiter with GNU Lesser General Public License v3.0 5 votes vote down vote up
public void safeTextParseUtil(ValueStack stack, TextParseUtil.ParsedValueEvaluator parsedValueEvaluator, Class type) {
    String input = "1+1";
    TextParseUtil.translateVariables(input, stack);
    TextParseUtil.translateVariables(input, stack, parsedValueEvaluator);
    TextParseUtil.translateVariables('a', input, stack);
    TextParseUtil.translateVariables('a', input, stack, type);
    TextParseUtil.translateVariables(new char[]{'a'}, input, stack, type, parsedValueEvaluator);
    TextParseUtil.translateVariables(new char[]{'a'}, input, stack, type, parsedValueEvaluator, 0);
    TextParseUtil.translateVariables('a', input, stack, type, parsedValueEvaluator, 0);
}
 
Example #3
Source File: PlainTextErrorResult.java    From dhis2-core with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
@Override
public void execute( ActionInvocation invocation )
    throws Exception
{
    HttpServletResponse response = (HttpServletResponse) invocation.getInvocationContext().get(
        StrutsStatics.HTTP_RESPONSE );

    response.setContentType( "text/plain; charset=UTF-8" );
    response.setHeader( "Content-Disposition", "inline" );
    response.setStatus( HttpServletResponse.SC_INTERNAL_SERVER_ERROR );

    ValueStack stack = ActionContext.getContext().getValueStack();
    String finalMessage = parse ? TextParseUtil.translateVariables( message, stack ) : message;

    finalMessage = formatFinalMessage( finalMessage );

    // ---------------------------------------------------------------------
    // Write final message
    // ---------------------------------------------------------------------

    PrintWriter writer = null;

    try
    {
        writer = response.getWriter();
        writer.print( finalMessage );
        writer.flush();
    }
    finally
    {
        if ( writer != null )
        {
            writer.close();
        }
    }
}
 
Example #4
Source File: ChainingInterceptor.java    From entando-core with GNU Lesser General Public License v3.0 5 votes vote down vote up
public void setExcludeParameters(String parametersToExclude) {
	Set<String> parameters = TextParseUtil.commaDelimitedStringToSet(parametersToExclude);
	if (parameters.contains("fieldErrors")) {
		super.setCopyFieldErrors(Boolean.FALSE.toString());
	}
	if (parameters.contains("actionErrors")) {
		super.setCopyErrors(Boolean.FALSE.toString());
	}
	if (parameters.contains("actionMessages")) {
		super.setCopyMessages(Boolean.FALSE.toString());
	}
	super.setExcludesCollection(parameters);
}
 
Example #5
Source File: ChainingInterceptor.java    From entando-core with GNU Lesser General Public License v3.0 5 votes vote down vote up
public void setIncludeParameters(String parametersToInclude) {
	Set<String> parameters = TextParseUtil.commaDelimitedStringToSet(parametersToInclude);
	if (parameters.contains("fieldErrors")) {
		super.setCopyFieldErrors(Boolean.TRUE.toString());
	}
	if (parameters.contains("actionErrors")) {
		super.setCopyErrors(Boolean.TRUE.toString());
	}
	if (parameters.contains("actionMessages")) {
		super.setCopyMessages(Boolean.TRUE.toString());
	}
	super.setIncludesCollection(parameters);
}
 
Example #6
Source File: TextParserSample.java    From Android_Code_Arbiter with GNU Lesser General Public License v3.0 4 votes vote down vote up
public void unsafeTextParser(String input, TextParser textParser, TextParseUtil.ParsedValueEvaluator parser) {
    textParser.evaluate(null, input, parser, 0);
}
 
Example #7
Source File: TextParserSample.java    From Android_Code_Arbiter with GNU Lesser General Public License v3.0 4 votes vote down vote up
public void safeTextParser(TextParser textParser, TextParseUtil.ParsedValueEvaluator parser) {
    String input = "1+1";
    textParser.evaluate(null, input, parser, 0);
}
 
Example #8
Source File: TextParserSample.java    From Android_Code_Arbiter with GNU Lesser General Public License v3.0 4 votes vote down vote up
public void unsafeOgnlTextParser(String input, OgnlTextParser textParser, TextParseUtil.ParsedValueEvaluator evaluator) {
    textParser.evaluate(new char[]{'a'}, input, evaluator, 0);
}
 
Example #9
Source File: TextParserSample.java    From Android_Code_Arbiter with GNU Lesser General Public License v3.0 4 votes vote down vote up
public void safeOgnlTextParser(OgnlTextParser textParser, TextParseUtil.ParsedValueEvaluator evaluator) {
    String input = "1+1";
    textParser.evaluate(new char[]{'a'}, input, evaluator, 0);
}