Package org.apache.wink.test.mock

Examples of org.apache.wink.test.mock.MockHttpServletRequestWrapper


    protected static MockHttpServletRequest constructPropfindRequest(Propfind propfind,
                                                                     String requestURI,
                                                                     int depth) throws IOException {

        MockHttpServletRequest mockRequest = new MockHttpServletRequestWrapper() {

            public String getPathTranslated() {
                return null; // prevent Spring to resolve the file on the file
                             // system which fails
            }
        };
        // headers
        mockRequest.setMethod(WebDAVMethod.PROPFIND.name());
        mockRequest.setRequestURI(requestURI);
        mockRequest.setContentType(MediaType.APPLICATION_XML);
        if (depth >= 0) {
            mockRequest.addHeader(WebDAVHeaders.DEPTH, String.valueOf(depth));
        }
        // body
        StringWriter writer = new StringWriter();
        Propfind.marshal(propfind, writer);
        mockRequest.setContent(writer.toString().getBytes());

        return mockRequest;
    }
View Full Code Here


    protected static MockHttpServletRequest constructPropfindRequest(Propfind propfind,
                                                                     String requestURI,
                                                                     int depth) throws IOException {

        MockHttpServletRequest mockRequest = new MockHttpServletRequestWrapper() {

            public String getPathTranslated() {
                return null; // prevent Spring to resolve the file on the file
                             // system which fails
            }
        };
        // headers
        mockRequest.setMethod(WebDAVMethod.PROPFIND.name());
        mockRequest.setRequestURI(requestURI);
        mockRequest.setContentType(MediaType.APPLICATION_XML);
        if (depth >= 0) {
            mockRequest.addHeader(WebDAVHeaders.DEPTH, String.valueOf(depth));
        }
        // body
        StringWriter writer = new StringWriter();
        Propfind.marshal(propfind, writer);
        mockRequest.setContent(writer.toString().getBytes());

        return mockRequest;
    }
View Full Code Here

TOP

Related Classes of org.apache.wink.test.mock.MockHttpServletRequestWrapper

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.