KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > tapestry > pets > PetshopBasePage


1 package org.apache.tapestry.pets;
2
3 import java.io.OutputStream JavaDoc;
4
5 import org.apache.tapestry.IMarkupWriter;
6 import org.apache.tapestry.html.BasePage;
7 import org.apache.tapestry.html.HTMLWriter;
8 import org.apache.tapestry.pets.domain.model.IShoppingCart;
9 import org.apache.tapestry.pets.domain.model.pojo.ShoppingCart;
10
11 public class PetshopBasePage extends BasePage {
12
13     public IMarkupWriter getResponseWriter(OutputStream JavaDoc out) {
14         HTMLWriter writer = new HTMLWriter("text/html; charset=iso-8859-15",
15                 out);
16
17         return writer;
18     }
19
20     public String JavaDoc getUserLanguage() {
21         Visit visit = (Visit) this.getEngine().getVisit();
22
23         if (visit == null) { return PetConstants.DEFAULT_LANGUAGE; }
24
25         return visit.getLanguage();
26     }
27
28     public IShoppingCart getSessionCart() {
29         Visit visit = (Visit) getVisit();
30
31         if ((visit == null) || (visit.getUserCart() == null))
32                 visit.setUserCart(new ShoppingCart());
33
34         return visit.getUserCart();
35     }
36 }
Popular Tags