1 33 34 package com.icesoft.faces.env; 35 36 import java.security.Principal ; 37 import java.util.Enumeration ; 38 import java.util.Hashtable ; 39 import java.util.Locale ; 40 import java.util.Vector ; 41 42 48 public abstract class CommonEnvironmentRequest { 49 50 protected String authType; 52 protected String remoteUser; 53 protected Principal userPrincipal; 54 protected String requestedSessionId; 55 protected boolean isRequestedSessionIdValid; 56 protected String scheme; 57 protected String serverName; 58 protected int serverPort; 59 protected Locale locale; 60 protected boolean isSecure; 61 protected Hashtable attributes; 62 protected Hashtable parameters; 63 protected String contextPath; 64 protected Vector locales; 65 66 69 70 public String getAuthType() { 71 return authType; 72 } 73 74 public String getContextPath() { 75 return contextPath; 76 } 77 78 public String getRemoteUser() { 79 return remoteUser; 80 } 81 82 public abstract boolean isUserInRole(String role); 83 84 public Principal getUserPrincipal() { 85 return userPrincipal; 86 } 87 88 public String getRequestedSessionId() { 89 return requestedSessionId; 90 } 91 92 public boolean isRequestedSessionIdValid() { 93 return isRequestedSessionIdValid; 94 } 95 96 public Object getAttribute(String name) { 97 return attributes.get(name); 98 } 99 100 public Enumeration getAttributeNames() { 101 return attributes.keys(); 102 } 103 104 public String getParameter(String name) { 105 Object o = parameters.get(name); 106 if (o instanceof String []) { 107 return ((String [])o)[0]; 108 } else { 109 return (String ) o; 110 } 111 } 112 113 public Enumeration getParameterNames() { 114 return parameters.keys(); 115 } 116 117 public String [] getParameterValues(String name) { 118 return (String []) parameters.get(name); 119 } 120 121 public java.util.Map getParameterMap() { 122 return parameters; 123 } 124 125 public String getScheme() { 126 return scheme; 127 } 128 129 public String getServerName() { 130 return serverName; 131 } 132 133 public int getServerPort() { 134 return serverPort; 135 } 136 137 public void setAttribute(String name, Object value) { 138 if (null == value) { 139 attributes.remove(name); 140 } else { 141 attributes.put(name, value); 142 } 143 } 144 145 public void removeAttribute(String name) { 146 attributes.remove(name); 147 } 148 149 public Locale getLocale() { 150 return locale; 151 } 152 153 public Enumeration getLocales() { 154 return locales.elements(); 155 } 156 157 public boolean isSecure() { 158 return isSecure; 159 } 160 161 } 162 | Popular Tags |