• Welcome to KonaKart Community Forum. Please login or sign up.
 
April 15, 2024, 01:45:29 am

Show posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.

Messages - rula

46
Programming of KonaKart / Re: exception handling
July 31, 2008, 05:24:04 pm
Hi pete,
Quote
With those three changes to the action classes isn't the problem fixed ? All messages are now taken from the message catalog. They were taken from the message catalog even before the fix but were cached and so not changed if you decided to change the language of your UI.


1.extended PropertyMessageResources.java
2.extended PropertyMessageResourcesFactory.java
3.call reload methode in SetLocaleAction.java
4.replaced <message-resources/> tag

1.

public class ReloadablePropertyMessageResources
extends PropertyMessageResources{

public ReloadablePropertyMessageResources(ReloadablePropertyMessageResourcesFactory factory, String config){
super(factory, config);
}

public ReloadablePropertyMessageResources(ReloadablePropertyMessageResourcesFactory factory, String config, boolean returnNull){
super(factory, config, returnNull);
}

public synchronized void reload(){
locales.clear();
messages.clear();
formats.clear();
}
}


2.

public class ReloadablePropertyMessageResourcesFactory
extends PropertyMessageResourcesFactory{

public MessageResources createResources(String config){
return new ReloadablePropertyMessageResources(this, config, this.getReturnNull());
}
}


3.

((ReloadablePropertyMessageResources)getResources(request)).reload();


4.

  <!--
  <message-resources parameter="Messages" null="false"/>
  -->
  <message-resources parameter="Messages" com.konakart.ReloadablePropertyMessageResourcesFactory"/>


It seems to work, but I am not sure.
The clearing of the resources hashmaps in the reload methode seems to solve the caching problem.
Is this okay!?

regards, rula
47
Programming of KonaKart / Re: exception handling
July 30, 2008, 07:27:08 pm
Hi pete,

okay, this with the exception was only a idea a my code is indeed not so secure. :o
regards, rula
48
Programming of KonaKart / Re: exception handling
July 30, 2008, 06:58:47 pm
Hi pete,
I saw something like this and tested it.

in struts-config:
<action path="/login"
        name="userForm"
        scope="request"
        input="login"
        type="de.rula.dga.action.UserAction"
        parameter="dispatch">
  <exception  type="de.rula.dga.UnknownUserException"
              key="errors.unknownUser"
              path="login"/>           
  <exception  type="de.rula.dga.InvalidPasswordException"
              key="errors.invalid.Password"
              path="login"/>                             
  <forward name="success" path="home"/>
</action>

in UserService:
public User authenticate(String userName, String password)
throws Exception{
 
  User user = userDao.getUser(userName);
  if(user == null){
    throw new UnknownUserException();
  }
 
  boolean validPassword = user.passwordMatch(password);
  if(!validPassword){
    throw new InvalidPasswordException();
  }
 
  List roles = userDao.getRoles(userName);
  user.setRoles(roles);

  return user;
}

in UserAction:
public ActionForward login( ActionMapping mapping,
                            ActionForm form,
                            HttpServletRequest request,
                            HttpServletResponse response)
  throws Exception{
  if(log.isDebugEnabled())
    log.debug("login");
 
  HttpSession session = request.getSession();
 
  DynaValidatorActionForm userForm = (DynaValidatorActionForm)form;
  User user = (User)FormUtils.getFormValues(userForm, this, mapping, request); 
  user = userService.authenticate(user.getUsername(), user.getPassword());
 
  session.setAttribute("user", user);
 
  return mapping.findForward(Const.FORWARD_SUCCESS);
}

I mean, I have not to handle the exceptions in the actions, but configure it in struts(-config).

I am only a small struts user and no developer and don't understand the details of caching message resources. regards, rula
49
Programming of KonaKart / Re: exception handling
July 30, 2008, 06:08:57 pm
Hi pete,

I do something like this:

/*             
return getForward(mapping, request, e, "com.konakart.app.KKUserExistsException",
                  Constants.userExists, "ApplicationError");
*/
String message = getResources(request).getMessage(getLocale(request), "register.customer.body.user.exists");
return getForward(mapping, request, e, "com.konakart.app.KKUserExistsException",
                  message, "ApplicationError");

in:
CustomerRegistrationSubmitAction.java,
NewAddrSubmitAction.java and
EditAddrSubmitAction.java.

I have looked for all ApplicationErrorrs that I have found in Custom Actions.

Struts declarativ exception handling over struts-config could be nice for me.
Is it possible and good to catch the ApplicationErrors over global or local exception tags and remove try catch blocks?

i18n is not so easy in konakart, many property files are not enough.

regards, rula

50
Programming of KonaKart / Re: exception handling
July 30, 2008, 03:09:50 pm
Hi pete,

I would call the getForward methode with my translated message text instead of 'Constants.invalidZone'  for this exception.
Is this the way to reach a locale sensitive message when this exception occurs? 

return getForward(mapping, request, e, "com.konakart.app.KKInvalidZoneException",
Constants.invalidZone, "ApplicationError");

regards, rula
51
Programming of KonaKart / exception handling
July 30, 2008, 01:39:09 pm
Hi Konakarts,
I don't understand the complete exception handling of konakart, but I estimate that it is very good.
NowI have a i18n problem with exceptions and messages (errors).
I need a message-key but a message text (in the false language) is delivered.
e.g.

in NewAddrSubmitAction.java:

try
{
  kkAppEng.getCustomerMgr().fetchZonesForRegistration(addr.getCountryId());
}catch (KKException e1)
{
  return mapping.findForward(super.handleException(request, e1));
}
  return getForward(mapping, request, e, "com.konakart.app.KKInvalidZoneException",
  Constants.invalidZone, "ApplicationError");
}


delivered in NewAddrBody.jsp:

Please select a state from the States pull down menu.

and in requestScope:

org.apache.struts.action.ERROR  {org.apache.struts.action.GLOBAL_MESSAGE=[exception.null.message[Please select a state from the States pull down menu.]]} 

How can I get a usable errorKey form this exception for translation in the jsp. (<html:messages...) ?

regards, rula
52
Programming of KonaKart / Re: Shipping
July 30, 2008, 09:45:24 am
Hi pete,

thank you very much for your super answers and your good tips.
In the future I have to look better in the faq's and first of all in the java api doc.
Here and in the code of the modules I will find most of the answers of my questions, but not all.

regards, rula
53
Programming of KonaKart / Re: Shipping
July 30, 2008, 06:13:42 am
Hi pete,
oh sorry pete, I don't have accociated the order products with the product type 'pysical free shipping'.
Thanks for your help. The product type of the order products is the key for the available shipping (or perhaps payment too) modules.
By the way, can I configure own product types in konakart?

regards, rula
54
Programming of KonaKart / Re: Shipping
July 29, 2008, 09:01:28 pm
Hi pete,
sure, I have installed the free shopping module, but it appears not in the list of the jsp. The array is empty, if I only install this module. The other delivery modules are avialable after installation.

regards, rula
55
Programming of KonaKart / Re: Shipping
July 29, 2008, 04:59:29 pm
Hi Konakarts,

I miss the free shipping entry in CatalogCheckoutDeliveryBody.jsp.
orderMgr.getShippingQuotes().length = 0 if I have selected the free shipping module in the admin app.

In the past, I say a entry for free shipping to select in the pages for the checkout process.

Exists such an entry and where is it now.

regards, rula
56
Configuration of KonaKart / Re: URL Problem
July 18, 2008, 06:43:32 pm
Hi nickgk,

categories-tile-1 not rendered correctly

1.
Search Exceptions

2.
View catMgr and catList beans in CategoriesTile1.jsp
<bean:define id="catMgr" name="kkEng" property="categoryMgr" type="com.konakart.al.CategoryMgr"/>
<bean:define id="catList" name="catMgr" property="catMenuList" type="java.util.List"/>

3.
Debug SelectCategoryAction1.java

regards, rula (newbie)
57
Hi ming,

I want to achieve a complete but small and simple gwt frontend.
My entrypoint could be the mail sample in googles gwt 1.5 doc.

First I try to create the ui with panels, widgets and listeners and use hardcoded data like in the mail sample too. Then I try to get the data from the clientEngine over RPC (is it correct!?). It would be not so easy for me, but little by little I recognize the possibilities of gwt.

When starts your new google group probably with development of konakart frontends.
I am interessted but only a gwt newbie.

regards, rula
58
Hi KonaKarts,

I worked through the basics and more features of googles StockWatcher tutorial and now I will start to use gwt for konakart frontends. Onepagecheckout is embedded gwt in struts. Is this a good entrypoint;-) for me as gwt newbie to start with a complete frontend. How is the way from struts to gwt? How can I simple replace the struts actions by gwt procedure calls, if possible? Many newbie questions, I try to start with the ui. Help would be nice. regards, rula
59
Programming of KonaKart / Re: markup validation
July 10, 2008, 12:38:34 pm
Hi KonaKarts,

makes it sense to markup konakart in xhtml1.0 strict or transitional ?

regards, rula
60
Programming of KonaKart / markup validation
July 10, 2008, 12:11:36 pm
Hi konakarts,

is valid markup no topic?

I use w3c markup validator with many failures and no doctype was found !?

regards, rula