Java Code Examples for javax.servlet.http.HttpServletRequest.getLocalName()

The following are Jave code examples for showing how to use getLocalName() of the javax.servlet.http.HttpServletRequest class. You can vote up the examples you like. Your votes will be used in our system to get more good examples.
Example 1
Project: DKJavaWebApiDemo   File: APIRequest.java   Vote up 8 votes
public APIRequest(HttpServletRequest request) {

        this.request = request;

        header = new HashMap<String, Object>();
        Enumeration e = request.getHeaderNames();
        while (e.hasMoreElements()) {
            String name = (String) e.nextElement();
            Object value = request.getHeader(name);
            header.put(name, value);
        }

        params = getParamesMap(request.getParameterMap());
        url = request.getRequestURL().toString();
        uri = request.getRequestURI();
        remoteAddr = request.getRemoteAddr();
        remoteHost = request.getRemoteHost();
        remotePort = request.getRemotePort();
        contextPath = request.getContextPath();
        localAddr = request.getLocalAddr();
        characterEncoding = request.getCharacterEncoding();
        localName = request.getLocalName();
        localPort = request.getLocalPort();
        method = request.getMethod();
        queryString = request.getQueryString();
    }
 
Example 2
Project: gitplex-mit   File: ServletRequestCopy.java   Vote up 5 votes
public ServletRequestCopy(HttpServletRequest request) {
	this.servletPath = request.getServletPath();
	this.contextPath = request.getContextPath();
	this.pathInfo = request.getPathInfo();
	this.requestUri = request.getRequestURI();
	this.requestURL = request.getRequestURL();
	this.method = request.getMethod();
	this.serverName = request.getServerName();
	this.serverPort = request.getServerPort();
	this.protocol = request.getProtocol();
	this.scheme = request.getScheme();
	
	
	/*
	 * have to comment out below two lines as otherwise web socket will
	 * report UnSupportedOperationException upon connection
	 */
	//this.characterEncoding = request.getCharacterEncoding();
	//this.contentType = request.getContentType();
	//this.requestedSessionId = request.getRequestedSessionId();
	this.characterEncoding = null;
	this.contentType = null;
	this.requestedSessionId = null;
	
	this.locale = request.getLocale();
	this.locales = request.getLocales();
	this.isSecure = request.isSecure();
	this.remoteUser = request.getRemoteUser();
	this.remoteAddr = request.getRemoteAddr();
	this.remoteHost = request.getRemoteHost();
	this.remotePort = request.getRemotePort();
	this.localAddr = request.getLocalAddr();
	this.localName = request.getLocalName();
	this.localPort = request.getLocalPort();
	this.pathTranslated = request.getPathTranslated();
	this.principal = request.getUserPrincipal();

	HttpSession session = request.getSession(true);
	httpSession = new HttpSessionCopy(session);

	String s;
	Enumeration<String> e = request.getHeaderNames();
	while (e != null && e.hasMoreElements()) {
		s = e.nextElement();
		Enumeration<String> headerValues = request.getHeaders(s);
		this.headers.put(s, headerValues);
	}

	e = request.getAttributeNames();
	while (e != null && e.hasMoreElements()) {
		s = e.nextElement();
		attributes.put(s, request.getAttribute(s));
	}

	e = request.getParameterNames();
	while (e != null && e.hasMoreElements()) {
		s = e.nextElement();
		parameters.put(s, request.getParameterValues(s));
	}
}
 
Example 3
Project: ctsms   File: Settings.java   Vote up 5 votes
public static ArrayList<String> getTrustetRefererHosts(HttpServletRequest request) {
	ArrayList<String> referers = CommonUtil.getValueStringList(SettingCodes.TRUSTED_REFERER_HOSTS, getBundle(Bundle.SETTINGS), DefaultSettings.TRUSTED_REFERER_HOSTS);
	ArrayList<String> result = new ArrayList<String>(referers.size());
	Iterator<String> it = referers.iterator();
	while (it.hasNext()) {
		String referer = it.next();
		String substitution;
		if (referer.equalsIgnoreCase(DefaultSettings.LOCAL_ADDR_REFERER)) {
			if (request != null) {
				substitution = request.getLocalAddr();
				if (!CommonUtil.isEmptyString(substitution)) {
					result.add(substitution);
				}
			}
		} else if (referer.equalsIgnoreCase(DefaultSettings.LOCAL_NAME_REFERER)) {
			if (request != null) {
				substitution = request.getLocalName();
				if (!CommonUtil.isEmptyString(substitution)) {
					result.add(substitution);
				}
			}
		} else if (referer.equalsIgnoreCase(DefaultSettings.HTTP_DOMAIN_REFERER)) {
			substitution = WebUtil.getHttpDomainName();
			if (!CommonUtil.isEmptyString(substitution)) {
				result.add(substitution);
			}
		} else {
			result.add(referer);
		}
	}
	return result;
}
 
Example 4
Project: iunet-blog   File: WebUtil.java   Vote up 4 votes
public static String getLocalName(HttpServletRequest request) {
	return request.getLocalName();
}