Package com.opensymphony.xwork2

Examples of com.opensymphony.xwork2.TextProvider


        // TODO: this should be done better
        ActionContext ac = ActionContext.getContext();
        Container cont = ac.getContainer();
        XWorkConverter xworkConverter = cont.getInstance(XWorkConverter.class);
        CompoundRootAccessor accessor = (CompoundRootAccessor) cont.getInstance(PropertyAccessor.class, CompoundRoot.class.getName());
        TextProvider prov = cont.getInstance(TextProvider.class, "system");
        boolean allow = "true".equals(cont.getInstance(String.class, "allowStaticMethodAccess"));
        OgnlValueStack aStack = new OgnlValueStack(xworkConverter, accessor, prov, allow);
        aStack.setOgnlUtil(cont.getInstance(OgnlUtil.class));
        aStack.setRoot(xworkConverter, accessor, this.root, allow);
View Full Code Here


        // TODO: this should be done better
        ActionContext ac = ActionContext.getContext();
        Container cont = ac.getContainer();
        XWorkConverter xworkConverter = cont.getInstance(XWorkConverter.class);
        CompoundRootAccessor accessor = (CompoundRootAccessor) cont.getInstance(PropertyAccessor.class, CompoundRoot.class.getName());
        TextProvider prov = cont.getInstance(TextProvider.class, "system");
        boolean allow = "true".equals(cont.getInstance(String.class, "allowStaticMethodAccess"));
        OgnlValueStack aStack = new OgnlValueStack(xworkConverter, accessor, prov, allow);
        aStack.setOgnlUtil(cont.getInstance(OgnlUtil.class));
        aStack.setRoot(xworkConverter, accessor, this.root, allow);
View Full Code Here

        // TODO: this should be done better
        ActionContext ac = ActionContext.getContext();
        Container cont = ac.getContainer();
        XWorkConverter xworkConverter = cont.getInstance(XWorkConverter.class);
        CompoundRootAccessor accessor = (CompoundRootAccessor) cont.getInstance(PropertyAccessor.class, CompoundRoot.class.getName());
        TextProvider prov = cont.getInstance(TextProvider.class, "system");
        boolean allow = "true".equals(cont.getInstance(String.class, XWorkConstants.ALLOW_STATIC_METHOD_ACCESS));
        OgnlValueStack aStack = new OgnlValueStack(xworkConverter, accessor, prov, allow);
        aStack.setOgnlUtil(cont.getInstance(OgnlUtil.class));
        aStack.setRoot(xworkConverter, accessor, this.root, allow);
View Full Code Here

    if (_key != null) {

      ValueStack stack = getStack();
      CompoundRoot root = stack.getRoot();
      TextProvider textProvider = null;
     
      for (Object obj : root) {
        if (obj instanceof TextProvider) {
          textProvider = (TextProvider) obj;
          break;
        }
      }

      if (textProvider != null) {
        String message = textProvider.getText(_key, _arguments);
        if (message != null) {
          try {
            writer.write(message);
          } catch (IOException e) {
            LOG.error("Could not write out tag", e);
View Full Code Here

import com.opensymphony.xwork2.TextProviderFactory;

public class ResourceBundleSupport {
  public static Map<String, String> getLocaleMap(LocaleProvider localeProvider, Class<?> resourceType) {
    TextProviderFactory factory = new TextProviderFactory();
    TextProvider provider = factory.createInstance(resourceType, localeProvider);
    ResourceBundle bundle = provider.getTexts();
    Map<String, String> m = new LinkedHashMap<String, String>();
    for (Enumeration<String> en = bundle.getKeys(); en.hasMoreElements();) {
      String key = en.nextElement();
      String value = bundle.getString(key);
      m.put(key, value);
View Full Code Here

    } catch (Throwable ex) {
      throw new IllegalStateException("error loading messages resource class "
          + messagesResourceClassName, ex);
    }

    TextProvider provider = _textProviderFactory.createInstance(
        messagesResourceClass, localeProvider);
    ResourceBundle bundle = provider.getTexts();

    Map<String, String> resourceMapping = new HashMap<String, String>();

    for (Enumeration<String> en = bundle.getKeys(); en.hasMoreElements();) {
      String key = en.nextElement();
View Full Code Here

   *
   * @return reference to field with TextProvider
   */
  private TextProvider getTextProvider() {
    if (textProvider == null) {
      TextProviderFactory tpf = new TextProviderFactory();
      if (container != null) {
        container.inject(tpf);
      }
      textProvider = tpf.createInstance(getClass(), this);
    }
    return textProvider;
  }
View Full Code Here

    ResultConfig resultConfig = new ResultConfig.Builder(resultCode, resultTypeConfig.getClassName())
        .addParams(params).build();
    try {
      return objectFactory.buildResult(resultConfig, context.getContextMap());
    } catch (Exception e) {
      throw new XWorkException("Unable to build convention result", e, resultConfig);
    }
  }
View Full Code Here

    ProfileService profileService = new ProfileServiceImpl();
    actionNameBuilder.setProfileService(profileService);

    ObjectFactory of = new ObjectFactory();
    final DummyContainer mockContainer = new DummyContainer();
    Configuration configuration = new DefaultConfiguration() {
      @Override
      public Container getContainer() {
        return mockContainer;
      }
    };
    PackageConfig strutsDefault = makePackageConfig("beangle", null, null, "dispatcher", null, null, null);
    configuration.addPackageConfig("beangle", strutsDefault);
    // ResultMapBuilder resultMapBuilder =
    // createStrictMock(ResultMapBuilder.class);
    // set beans on mock container
    mockContainer.setActionNameBuilder(actionNameBuilder);
    // mockContainer.setResultMapBuilder(resultMapBuilder);
    // mockContainer.setConventionsService(new ConventionsServiceImpl(""));

    SmartActionConfigBuilder builder = new SmartActionConfigBuilder(configuration, mockContainer, of);
    builder.setActionBuilder(actionNameBuilder);
    builder.buildActionConfigs();
    Set<String> names = configuration.getPackageConfigNames();
    for (String a : names) {
      System.out.println("pkgname:" + a);
      PackageConfig pkgConfig = configuration.getPackageConfig(a);
      System.out.println("namespace:" + pkgConfig.getNamespace());
      Map<String, ActionConfig> configs = pkgConfig.getAllActionConfigs();
      for (String actionName : configs.keySet()) {
        ActionConfig config = configs.get(actionName);
        System.out.println(config.getClassName());
View Full Code Here

    }
    if (null == parentPkg) {
      actionPkg = defaultParentPackage;
      parentPkg = configuration.getPackageConfig(actionPkg);
    }
    if (parentPkg == null) { throw new ConfigurationException("Unable to locate parent package ["
        + actionClass.getPackage().getName() + "]"); }
    String actionPackage = actionClass.getPackage().getName();
    PackageConfig.Builder pkgConfig = packageConfigs.get(actionPackage);
    if (pkgConfig == null) {
      PackageConfig myPkg = configuration.getPackageConfig(actionPackage);
View Full Code Here

TOP

Related Classes of com.opensymphony.xwork2.TextProvider

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.