Package org.apache.tapestry.request

Examples of org.apache.tapestry.request.RequestContext


            // If disabled, do nothing.

            if (isDisabled())
                return;

            RequestContext context = cycle.getRequestContext();

            // Image clicks get submitted as two request parameters:
            // foo.x and foo.y

            String parameterName = name + ".x";

            String value = context.getParameter(parameterName);

            if (value == null)
                return;

            // The point parameter is not really used, unless the
            // ImageButton is used for its original purpose (as a kind
            // of image map). In modern usage, we only care about
            // whether the user clicked on the image (and thus submitted
            // the form), not where in the image the user actually clicked.

            IBinding pointBinding = getBinding("point");

            if (pointBinding != null)
            {
                int x = Integer.parseInt(value);

                parameterName = name + ".y";
                value = context.getParameter(parameterName);

                int y = Integer.parseInt(value);

                pointBinding.setObject(new Point(x, y));
            }
View Full Code Here


     *
     **/

    private Set buildSelections(IRequestCycle cycle, String parameterName)
    {
        RequestContext context = cycle.getRequestContext();

        String[] parameters = context.getParameters(parameterName);

        if (parameters == null)
            return null;

        int length = parameters.length;
View Full Code Here

    {
        IEngine engine = _engineManager.getEngineInstance();

        request.setAttribute(Constants.INFRASTRUCTURE_KEY, _infrastructure);

        RequestContext context = new RequestContext(_servlet, request, response, _specification);

        try
        {
            engine.service(context);
        }
        finally
        {
            _engineManager.storeEngineInstance(engine);

            context.cleanup();
        }

    }
View Full Code Here

        _internal = !(location.startsWith("/") || location.indexOf("://") > 0);
    }

    public void process(IRequestCycle cycle)
    {
        RequestContext context = cycle.getRequestContext();

        if (_internal)
            forward(context);
        else
            redirect(context);
View Full Code Here

     * @since 3.0
     */

    public static Resource getApplicationRootLocation(IRequestCycle cycle)
    {
        RequestContext context = cycle.getRequestContext();
        ServletContext servletContext = context.getServlet().getServletContext();
        String servletPath = context.getRequest().getServletPath();

        // Could strip off the servlet name (i.e., "app" in "/app") but
        // there's no need.

        return new ContextResource(servletContext, servletPath);
View Full Code Here

    public String getAbsoluteURL(String scheme, String server, int port, String anchor,
            boolean includeParameters)
    {
        StringBuffer buffer = new StringBuffer();
        RequestContext context = _cycle.getRequestContext();

        if (scheme == null)
            scheme = context.getScheme();

        buffer.append(scheme);
        buffer.append("://");

        if (server == null)
            server = context.getServerName();

        buffer.append(server);

        if (port == 0)
            port = context.getServerPort();

        if (!(scheme.equals("http") && port == DEFAULT_HTTP_PORT))
        {
            buffer.append(':');
            buffer.append(port);
View Full Code Here

    {
        MockControl control = newControl(IRequestCycle.class);
        IRequestCycle rc = (IRequestCycle) control.getMock();

        MockControl contextc = newControl(RequestContext.class);
        RequestContext context = (RequestContext) contextc.getMock();

        rc.getRequestContext();
        control.setReturnValue(context);

        EngineServiceLink l = new EngineServiceLink(rc, "/ctx/app", ENCODING, _urlCodec,
                buildParameters("myservice", null), false);

        context.getScheme();
        contextc.setReturnValue("HTTP");

        context.getServerName();
        contextc.setReturnValue("TESTSERVER.COM");

        context.getServerPort();
        contextc.setReturnValue(9187);

        replayControls();

        assertEquals("HTTP://TESTSERVER.COM:9187/ctx/app?service=myservice", l.getAbsoluteURL());
View Full Code Here

    {
        MockControl control = newControl(IRequestCycle.class);
        IRequestCycle rc = (IRequestCycle) control.getMock();

        MockControl contextc = newControl(RequestContext.class);
        RequestContext context = (RequestContext) contextc.getMock();

        rc.getRequestContext();
        control.setReturnValue(context);

        EngineServiceLink l = new EngineServiceLink(rc, "/ctx/app", ENCODING, _urlCodec,
View Full Code Here

    public void initialize(IRequestCycle cycle)
    {
        if (!init)
        {
            RequestContext requestContext = cycle.getRequestContext();
            ApplicationServlet servlet = requestContext.getServlet();
            ServletContext context = servlet.getServletContext();
            IPropertySource propertySource = cycle.getEngine().getPropertySource();
            IResourceLocation webInfLocation = new ContextResourceLocation(context, "/WEB-INF/");
            IResourceLocation webInfAppLocation = webInfLocation.getRelativeLocation(servlet.getServletName() + "/");
            readQuestions(easyQuestions, webInfAppLocation, propertySource.getPropertyValue("easyquestionsfile"));
View Full Code Here

    public void initialize(String pageName, IRequestCycle cycle)
    {
        if (LOG.isDebugEnabled())
            LOG.debug("Initializing for " + pageName);

        RequestContext context = cycle.getRequestContext();

        _pageName = pageName;
        _session = context.getSession();

        _attributePrefix = context.getServlet().getServletName() + "/" + _pageName + "/";

        restorePageChanges();
    }
View Full Code Here

TOP

Related Classes of org.apache.tapestry.request.RequestContext

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.