| 1 |
|
|
| 2 |
|
|
| 3 |
|
|
| 4 |
|
|
| 5 |
|
package org.trails.servlet; |
| 6 |
|
|
| 7 |
|
import java.util.Locale; |
| 8 |
|
import javax.servlet.ServletConfig; |
| 9 |
|
|
| 10 |
|
import org.apache.hivemind.Registry; |
| 11 |
|
import org.apache.hivemind.service.ThreadLocale; |
| 12 |
|
import org.apache.tapestry.ApplicationServlet; |
| 13 |
|
import org.apache.tapestry.services.RequestLocaleManager; |
| 14 |
|
|
| 15 |
|
|
| 16 |
|
|
| 17 |
|
|
| 18 |
|
|
| 19 |
|
|
| 20 |
0 |
public class TrailsApplicationServlet extends ApplicationServlet |
| 21 |
|
{ |
| 22 |
|
|
| 23 |
|
|
| 24 |
|
|
| 25 |
|
|
| 26 |
0 |
private static Registry tapestryRegistry = null; |
| 27 |
|
|
| 28 |
|
@Override |
| 29 |
|
protected Registry constructRegistry(ServletConfig config) |
| 30 |
|
{ |
| 31 |
0 |
synchronized (TrailsApplicationServlet.class) |
| 32 |
|
{ |
| 33 |
0 |
TrailsApplicationServlet.tapestryRegistry = super.constructRegistry(config); |
| 34 |
0 |
return TrailsApplicationServlet.tapestryRegistry; |
| 35 |
|
} |
| 36 |
|
} |
| 37 |
|
|
| 38 |
|
@Override |
| 39 |
|
public void destroy() |
| 40 |
|
{ |
| 41 |
0 |
synchronized (TrailsApplicationServlet.class) |
| 42 |
|
{ |
| 43 |
0 |
super.destroy(); |
| 44 |
0 |
TrailsApplicationServlet.tapestryRegistry = null; |
| 45 |
|
} |
| 46 |
0 |
} |
| 47 |
|
|
| 48 |
|
|
| 49 |
|
|
| 50 |
|
|
| 51 |
|
public static Registry getRegistry() |
| 52 |
|
{ |
| 53 |
0 |
return tapestryRegistry; |
| 54 |
|
} |
| 55 |
|
|
| 56 |
|
public static Locale getCurrentLocale() |
| 57 |
|
{ |
| 58 |
0 |
return ((ThreadLocale) tapestryRegistry.getService("hivemind.ThreadLocale", ThreadLocale.class)).getLocale(); |
| 59 |
|
} |
| 60 |
|
} |