Example usage for org.springframework.mock.web MockHttpServletRequest setContextPath

List of usage examples for org.springframework.mock.web MockHttpServletRequest setContextPath

Introduction

In this page you can find the example usage for org.springframework.mock.web MockHttpServletRequest setContextPath.

Prototype

public void setContextPath(String contextPath) 

Source Link

Usage

From source file:org.opennms.web.rest.AbstractSpringJerseyRestTestCase.java

protected MockHttpServletRequest createRequest(final String requestType, final String urlPath) {
    final MockHttpServletRequest request = new MockHttpServletRequest(getServletContext(), requestType,
            contextPath + urlPath) {/*w w w  . ja  v  a  2s.com*/

        @Override
        // FIXME: remove when we update to Spring 3.1
        public void setContentType(final String contentType) {
            super.setContentType(contentType);
        }

    };
    request.setContextPath(contextPath);
    request.setUserPrincipal(MockUserPrincipal.getInstance());
    return request;
}

From source file:org.opennms.web.springframework.security.LdapAuthTest.java

protected MockHttpServletRequest createRequest(String requestType, String urlPath) {
    MockHttpServletRequest request = new MockHttpServletRequest(m_servletContext, requestType,
            m_contextPath + urlPath);/*from  ww w .j  a v a 2s. c om*/
    request.setServletPath(m_contextPath + urlPath);
    request.setContextPath(m_contextPath);
    return request;
}

From source file:org.springframework.security.web.authentication.AbstractAuthenticationProcessingFilterTests.java

private MockHttpServletRequest createMockAuthenticationRequest() {
    MockHttpServletRequest request = new MockHttpServletRequest();

    request.setServletPath("/j_mock_post");
    request.setScheme("http");
    request.setServerName("www.example.com");
    request.setRequestURI("/mycontext/j_mock_post");
    request.setContextPath("/mycontext");

    return request;
}