Package com.mockrunner.mock.web

Examples of com.mockrunner.mock.web.MockHttpServletRequest


    }

    private void navigationTest(NavigationalStateComponent component, boolean useQueryStringPortalURL)
    throws Exception
    {
        MockHttpServletRequest request = new MockHttpServletRequest();
        MockHttpSession session = new MockHttpSession();
        HttpServletResponse response = new MockHttpServletResponse();
        ServletConfig config = new MockServletConfig();
        request.setSession(session);
        request.setServerName("www.sporteportal.com");
        request.setScheme("http");
        request.setContextPath("/jetspeed");
        request.setServletPath("/portal");
        request.setPathInfo("stuff");
        request.setRequestURI("/jetspeed/portal/stuff");

        JetspeedRequestContext context = new JetspeedRequestContext(request, response, config, null );
       
        // create base PortletURL
        PortalURL url = component.createURL(context.getRequest(), context.getCharacterEncoding());
        context.setPortalURL(url);

        PortletWindow window = new PortletWindowImpl("111");
        PortletWindow window2 = new PortletWindowImpl("222");
        PortletWindow window3 = new PortletWindowImpl("333");
        HashMap parameters = new HashMap();
        parameters.put("test",new String[]{"one","two","three"});

        String portletURL = url.createPortletURL(window,parameters,PortletMode.EDIT,WindowState.MAXIMIZED,true,false);
       
        String navStateParameterName = Jetspeed.getContext().getConfigurationProperty("portalurl.navigationalstate.parameter.name", AbstractPortalURL.DEFAULT_NAV_STATE_PARAMETER);

        if ( useQueryStringPortalURL )
        {
            request.setupAddParameter(navStateParameterName,portletURL.substring(portletURL.indexOf('=')+1));           
        }
        else
        {
            request.setPathInfo(portletURL.substring(portletURL.indexOf("/portal")+7));
        }
       
        context = new JetspeedRequestContext(request, response, config, null );
               
        url = component.createURL(context.getRequest(), context.getCharacterEncoding());
View Full Code Here


    public void setRealPath(String source, String target) {
        getContext().setRealPath(source, target);
    }

    public void addHeader(String headerName, String headerValue) {
        MockHttpServletRequest request = (MockHttpServletRequest)getFactory().getWrappedRequest();
        request.addHeader(headerName, headerValue);
        getFactory().addRequestWrapper(request);
    }
View Full Code Here

        request.addHeader(headerName, headerValue);
        getFactory().addRequestWrapper(request);
    }

    public void setMethod(String method) {
        MockHttpServletRequest request = (MockHttpServletRequest)getFactory().getWrappedRequest();
        request.setMethod(method);
        getFactory().addRequestWrapper(request);
    }
View Full Code Here

        request.setMethod(method);
        getFactory().addRequestWrapper(request);
    }

    public void setBodyContent(String content) {
        MockHttpServletRequest request = (MockHttpServletRequest)getFactory().getWrappedRequest();
        request.setBodyContent(content);
        getFactory().addRequestWrapper(request);
    }
View Full Code Here

        request.setBodyContent(content);
        getFactory().addRequestWrapper(request);
    }

    public void setServletContextPath(String path) {
        MockHttpServletRequest request = (MockHttpServletRequest)getFactory().getWrappedRequest();
        request.setContextPath(path);
        getFactory().addRequestWrapper(request);
    }
View Full Code Here

        request.setContextPath(path);
        getFactory().addRequestWrapper(request);
    }

    public void setServletPath(String path) {
        MockHttpServletRequest request = (MockHttpServletRequest)getFactory().getWrappedRequest();
        request.setServletPath(path);
        getFactory().addRequestWrapper(request);
    }
View Full Code Here

        request.setServletPath(path);
        getFactory().addRequestWrapper(request);
    }

    public void setRequestURI(String uri) {
        MockHttpServletRequest request = (MockHttpServletRequest)getFactory().getWrappedRequest();
        request.setRequestURI(uri);
        getFactory().addRequestWrapper(request);
    }
View Full Code Here

        request.setRequestURI(uri);
        getFactory().addRequestWrapper(request);
    }

    public void setScheme(String scheme) {
        MockHttpServletRequest request = (MockHttpServletRequest)getFactory().getWrappedRequest();
        request.setScheme(scheme);
        getFactory().addRequestWrapper(request);
    }
View Full Code Here

        request.setScheme(scheme);
        getFactory().addRequestWrapper(request);
    }

    public void setPathInfo(String pathInfo) {
        MockHttpServletRequest request = (MockHttpServletRequest)getFactory().getWrappedRequest();
        request.setPathInfo(pathInfo);
        getFactory().addRequestWrapper(request);
    }
View Full Code Here

        request.setPathInfo(pathInfo);
        getFactory().addRequestWrapper(request);
    }

    public void setQueryString(String qString) {
        MockHttpServletRequest request = (MockHttpServletRequest)getFactory().getWrappedRequest();
        request.setQueryString(qString);
        getFactory().addRequestWrapper(request);
    }
View Full Code Here

TOP

Related Classes of com.mockrunner.mock.web.MockHttpServletRequest

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.