Java Code Examples for org.springframework.mock.web.MockHttpServletRequest#isSecure()

The following examples show how to use org.springframework.mock.web.MockHttpServletRequest#isSecure() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: BaseMockServletTestCase.java    From cosmo with Apache License 2.0 5 votes vote down vote up
/**
 * Returns absolute url.
 * @param request The request.
 * @param path The path.
 * @return Absolute url.
 */
protected String toAbsoluteUrl(MockHttpServletRequest request,
                               String path) {
    StringBuilder url = new StringBuilder(request.getScheme());
    url.append("://").append(request.getServerName());
    if ((request.isSecure() && request.getServerPort() != 443) ||
        (request.getServerPort() != 80)) {
        url.append(":").append(request.getServerPort());
    }
    if (! request.getContextPath().equals("/")) {
        url.append(request.getContextPath());
    }
    url.append(path);
    return url.toString();
}
 
Example 2
Source File: HtmlUnitRequestBuilder.java    From spring-analysis-note with MIT License 4 votes vote down vote up
private com.gargoylesoftware.htmlunit.util.Cookie createCookie(MockHttpServletRequest request, String sessionid) {
	return new com.gargoylesoftware.htmlunit.util.Cookie(request.getServerName(), "JSESSIONID", sessionid,
			request.getContextPath() + "/", null, request.isSecure(), true);
}
 
Example 3
Source File: HtmlUnitRequestBuilder.java    From java-technology-stack with MIT License 4 votes vote down vote up
private com.gargoylesoftware.htmlunit.util.Cookie createCookie(MockHttpServletRequest request, String sessionid) {
	return new com.gargoylesoftware.htmlunit.util.Cookie(request.getServerName(), "JSESSIONID", sessionid,
			request.getContextPath() + "/", null, request.isSecure(), true);
}
 
Example 4
Source File: HtmlUnitRequestBuilder.java    From spring4-understanding with Apache License 2.0 4 votes vote down vote up
private com.gargoylesoftware.htmlunit.util.Cookie createCookie(MockHttpServletRequest request, String sessionid) {
	return new com.gargoylesoftware.htmlunit.util.Cookie(request.getServerName(), "JSESSIONID", sessionid,
			request.getContextPath() + "/", null, request.isSecure(), true);
}