1 package net.trajano.twiff.adapter; 2 3 import static net.trajano.twiff.internal.TwiffInternal.REQUEST_CONTAINER_KEY; 4 import javax.servlet.ServletRequest; 5 import org.picocontainer.MutablePicoContainer; 6 import org.picocontainer.PicoContainer; 7 8 /*** 9 * This provides access to the {@link javax.servlet.ServletRequest} data. 10 * Adapters like this are meant to remove the implicit casting performed by 11 * those that use it. 12 * 13 * @author Archimedes Trajano 14 */ 15 public class RequestAdapter { 16 /*** 17 * The reauest level container. 18 */ 19 private final MutablePicoContainer container; 20 21 /*** 22 * Creates the adapter. 23 * 24 * @param request 25 * the request to adapt 26 */ 27 public RequestAdapter(final ServletRequest request) { 28 this.container = (MutablePicoContainer) request.getAttribute(REQUEST_CONTAINER_KEY); 29 } 30 31 /*** 32 * Returns the {@link PicoContainer} stored in the request. The container is 33 * stored in the attribute 34 * {@link net.trajano.twiff.internal.TwiffInternal#REQUEST_CONTAINER_KEY}. 35 * 36 * @return the application level container. 37 */ 38 public final MutablePicoContainer getContainer() { 39 return container; 40 } 41 }