Many resources are needed to download a project. Please understand that we have to compensate our server costs. Thank you in advance. Project price only 1 $
You can buy this project and download/modify it how often you want.
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package org.apache.struts2.util;
import com.opensymphony.xwork2.TextProvider;
import com.opensymphony.xwork2.util.ValueStack;
import org.apache.commons.lang3.StringEscapeUtils;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import java.util.Collections;
import java.util.List;
/**
* Helper methods to access text from TextProviders
*/
public class TextProviderHelper {
private static final Logger LOG = LogManager.getLogger(TextProviderHelper.class);
/**
*
Get a message from the first TextProvider encountered in the stack.
* If the first TextProvider doesn't provide the message the default message is returned.
* The stack is searched if if no TextProvider is found, or the message is not found.
* @param key the message key in the resource bundle
* @param defaultMessage the message to return if not found (evaluated for OGNL)
* @param args an array args to be used in a {@link java.text.MessageFormat} message
* @param stack the value stack to use for finding the text
*
* @return the message if found, otherwise the defaultMessage
*/
public static String getText(String key, String defaultMessage, List