Package com.opensymphony.xwork2

Examples of com.opensymphony.xwork2.LocaleProvider


    private TextProvider getTextProvider(Object action) {
        TextProviderFactory tpf = new TextProviderFactory();
        if (container != null) {
            container.inject(tpf);
        }
        LocaleProvider localeProvider = getLocaleProvider(action);
        return tpf.createInstance(action.getClass(), localeProvider);
    }
View Full Code Here


        LocaleProvider localeProvider = getLocaleProvider(action);
        return tpf.createInstance(action.getClass(), localeProvider);
    }

    private LocaleProvider getLocaleProvider(Object action) {
        LocaleProvider localeProvider;
        if (action instanceof LocaleProvider) {
            localeProvider = (LocaleProvider) action;
        } else {
            localeProvider = container.getInstance(LocaleProvider.class);
        }
View Full Code Here

        }

        String content_type = request.getContentType();
        if (content_type != null && content_type.contains("multipart/form-data")) {
            MultiPartRequest mpr = getMultiPartRequest();
            LocaleProvider provider = getContainer().getInstance(LocaleProvider.class);
            request = new MultiPartRequestWrapper(mpr, request, getSaveDir(servletContext), provider);
        } else {
            request = new StrutsRequestWrapper(request, disableRequestAttributeValueStackLookup);
        }
View Full Code Here

  public void test21() {
    ActionBuilder actionNameBuilder = new DefaultActionBuilder();
    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;
View Full Code Here

    //  ------- Singleton getInstance -------
   
    public static TextProvider getInstance(Class clazz, LocaleProvider provider)
    {
        TextProvider instance=new TextProviderActionSupport(provider);
        if (instance instanceof ResourceBundleTextProvider)
        {
            ((ResourceBundleTextProvider) instance).setClazz(clazz);
        }
        return instance;
View Full Code Here

    //  ------- Singleton getInstance -------
   
    public static TextProvider getInstance(Class<?> clazz, LocaleProvider provider)
    {
        TextProvider instance=new TextProviderActionSupport(provider);
        if (instance instanceof ResourceBundleTextProvider)
        {
            ((ResourceBundleTextProvider) instance).setClazz(clazz);
        }
        return instance;
View Full Code Here

    }

    protected String getTranslationFromKey(String key)
    {
        Object action = getAction();
        TextProvider tp = getTextProvider(action);
        if (tp!=null)
        {   // Text Provider found
            String locale = getLocale(action).toString()
            String result = tp.getText(key);
            if (result==null)
            {
                if (log.isErrorEnabled())
                    log.error("No translation found for key=[" + key + "] on page " + getPageName() + " --> locale=" + locale);
            }
View Full Code Here

    else {
      OgnlValueStack stack = (OgnlValueStack) TagUtils.getStack(pageContext);
     
      for (Object o : stack.getRoot()) {
        if (o instanceof TextProvider) {
          TextProvider tp = (TextProvider) o;
          message = tp.getText(messageKey, UNDEFINED_KEY + messageKey + UNDEFINED_KEY);
          break;
        }
      }
    }
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

TOP

Related Classes of com.opensymphony.xwork2.LocaleProvider

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.