EL経由でHttpServletRequestのgetterにアクセス

<%@ page contentType="text/html;charset=utf-8" %>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>

<h2>EL経由で <i>HttpServletRequest</i>のgetterにアクセス</h2>

<h2>interface <i>HttpServletRequest</i> getProperty via EL</h2>
<table>
<tr><td>EL$</td><td>value</td><td>Type Method</td></tr>
<tr><td> EL{pageContext.request.authType} </td> <td> ${pageContext.request.authType} </td> <td> java.lang.String&nbsp;getAuthType()</td> </tr>
<tr><td> EL{pageContext.request.contextPath} </td> <td> ${pageContext.request.contextPath} </td> <td> java.lang.String&nbsp;getContextPath()</td> </tr>
<tr><td> EL{pageContext.request.cookies[0]} </td> <td> ${pageContext.request.cookies[0].value} </td> <td> Cookie[]&nbsp;getCookies()</td> </tr>
<tr><td> EL{pageContext.request.dateHeader} </td> <td> <b>NG</b>{pageContext.request.dateHeader} </td> <td> long&nbsp;getDateHeader(java.lang.String</td> </tr>
<tr><td> EL{pageContext.request.header}ではなくEL{header[key]}</td>
<td> <c:forEach items="${pageContext.request.headerNames}" var="hdn" >
${hdn} : ${header[hdn]} <br>
</c:forEach> </td> <td> java.lang.String&nbsp;getHeader(java.lang.String</td> </tr>
<tr><td> EL{pageContext.request.headerNames} </td> <td>

<c:forEach items="${pageContext.request.headerNames}" var="hdn" >
name: <c:out value="${hdn}" /><br>
</c:forEach>

</td> <td> java.util.Enumeration<java.lang.String>&nbsp;getHeaderNames()</td> </tr>
<tr><td> EL{pageContext.request.headers} </td> <td> <b>NG</b>{pageContext.request.headers} </td> <td> java.util.Enumeration<java.lang.String>&nbsp;getHeaders(java.lang.String</td> </tr>
<tr><td> EL{pageContext.request.intHeader} </td> <td> <b>NG</b>{pageContext.request.intHeader} </td> <td> int&nbsp;getIntHeader(java.lang.String</td> </tr>
<tr><td> EL{pageContext.request.method} </td> <td> ${pageContext.request.method} </td> <td> java.lang.String&nbsp;getMethod()</td> </tr>
<tr><td> EL{pageContext.request.part} </td> <td> <b>NG</b>{pageContext.request.part} </td> <td> Part&nbsp;getPart(java.lang.String</td> </tr>
<tr><td> EL{pageContext.request.parts} </td> <td> <b>NG</b>{pageContext.request.parts} </td> <td> java.util.Collection<Part>&nbsp;getParts()</td> </tr>
<tr><td> EL{pageContext.request.pathInfo} </td> <td> ${pageContext.request.pathInfo} </td> <td> java.lang.String&nbsp;getPathInfo()</td> </tr>
<tr><td> EL{pageContext.request.pathTranslated} </td> <td> ${pageContext.request.pathTranslated} </td> <td> java.lang.String&nbsp;getPathTranslated()</td> </tr>
<tr><td> EL{pageContext.request.queryString} </td> <td> ${pageContext.request.queryString} </td> <td> java.lang.String&nbsp; getQueryString()</td> </tr>
<tr><td> EL{pageContext.request.remoteuser} </td> <td> ${pageContext.request.remoteUser} </td> <td> java.lang.String&nbsp;getRemoteUser()</td> </tr>
<tr><td> EL{pageContext.request.requestURI} </td> <td> ${pageContext.request.requestURI} </td> <td> java.lang.String&nbsp;getRequestURI()</td> </tr>
<tr><td> EL{pageContext.request.requestURL} </td> <td> ${pageContext.request.requestURL} </td> <td> java.lang.StringBuffer&nbsp;getRequestURL()</td> </tr>
<tr><td> EL{pageContext.request.servletPath}${pageContext.request.servletPath} </td> <td> java.lang.String </td> <td> getServletPath()&nbsp;</td> </tr>
<tr><td> EL{pageContext.request.session} </td> <td> ${pageContext.request.session} </td> <td> HttpSession&nbsp;getSession()</td> </tr>
<tr><td> EL{pageContext.request.userPrincipal} </td> <td> ${pageContext.request.userPrincipal} </td> <td> java.security.Principal&nbsp;getUserPrincipal()</td> </tr>
<tr><td> EL{pageContext.request.requestedSessionIdFromCookie} </td> <td> ${pageContext.request.requestedSessionIdFromCookie} </td> <td> boolean&nbsp;isRequestedSessionIdFromCookie()</td> </tr>
<tr><td> EL{pageContext.request.requestedSessionIdFromURL} </td> <td> ${pageContext.request.requestedSessionIdFromURL} </td> <td> boolean&nbsp;isRequestedSessionIdFromURL()</td> </tr>
<tr><td> EL{pageContext.request.requestedSessionIdValid} </td> <td> ${pageContext.request.requestedSessionIdValid} </td> <td> boolean&nbsp;isRequestedSessionIdValid()</td> </tr>
<tr><td> EL{pageContext.request.userInRole} </td> <td> <b>NG</b>{pageContext.request.userInRole} </td> <td> boolean&nbsp;isUserInRole(java.lang.String</td> </tr>



</table>

結果

EL経由で HttpServletRequestのgetterにアクセス





























EL$valueType Method
EL{pageContext.request.authType} java.lang.String getAuthType()
EL{pageContext.request.contextPath} /ggrks java.lang.String getContextPath()
EL{pageContext.request.cookies[0]} D6F1A7761C589C57A864CF3350ABD9F9 Cookie[] getCookies()
EL{pageContext.request.dateHeader} NG{pageContext.request.dateHeader} long getDateHeader(java.lang.String
EL{pageContext.request.header}ではなくEL{header[key]}
host : 127.0.0.1:8080

user-agent : Mozilla/5.0 (X11; U; Linux x86_64; ja; rv:1.9.2.10) Gecko/20100915 Ubuntu/10.04 (lucid) Firefox/3.6.10

accept : text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8

accept-language : ja,en-us;q=0.7,en;q=0.3

accept-encoding : gzip,deflate

accept-charset : Shift_JIS,utf-8;q=0.7,*;q=0.7

keep-alive : 115

connection : keep-alive

cookie : JSESSIONID=D6F1A7761C589C57A864CF3350ABD9F9

cache-control : max-age=0

java.lang.String getHeader(java.lang.String
EL{pageContext.request.headerNames}
name: host

name: user-agent

name: accept

name: accept-language

name: accept-encoding

name: accept-charset

name: keep-alive

name: connection

name: cookie

name: cache-control

java.util.Enumeration getHeaderNames()
EL{pageContext.request.headers} NG{pageContext.request.headers} java.util.Enumeration getHeaders(java.lang.String
EL{pageContext.request.intHeader} NG{pageContext.request.intHeader} int getIntHeader(java.lang.String
EL{pageContext.request.method} GET java.lang.String getMethod()
EL{pageContext.request.part} NG{pageContext.request.part} Part getPart(java.lang.String
EL{pageContext.request.parts} NG{pageContext.request.parts} java.util.Collection getParts()
EL{pageContext.request.pathInfo} java.lang.String getPathInfo()
EL{pageContext.request.pathTranslated} java.lang.String getPathTranslated()
EL{pageContext.request.queryString} java.lang.String  getQueryString()
EL{pageContext.request.remoteuser} java.lang.String getRemoteUser()
EL{pageContext.request.requestURI} /ggrks/elgetter.jsp java.lang.String getRequestURI()
EL{pageContext.request.requestURL} http://127.0.0.1:8080/ggrks/elgetter.jsp java.lang.StringBuffer getRequestURL()
EL{pageContext.request.servletPath}/elgetter.jsp java.lang.String getServletPath() 
EL{pageContext.request.session} org.apache.catalina.session.StandardSessionFacade@3488b1e6 HttpSession getSession()
EL{pageContext.request.userPrincipal} java.security.Principal getUserPrincipal()
EL{pageContext.request.requestedSessionIdFromCookie} true boolean isRequestedSessionIdFromCookie()
EL{pageContext.request.requestedSessionIdFromURL} false boolean isRequestedSessionIdFromURL()
EL{pageContext.request.requestedSessionIdValid} true boolean isRequestedSessionIdValid()
EL{pageContext.request.userInRole} NG{pageContext.request.userInRole} boolean isUserInRole(java.lang.String

コメント

このブログの人気の投稿

4.3.0 Temporary Lookup Failureでドツボってた話

tomcat起動時の環境変数でJRE_HOMEを指定するときに

何が得られて何処へ向かうかだけを問うべき