本文整理汇总了Java中javax.faces.context.ExternalContext.getRequest方法的典型用法代码示例。如果您正苦于以下问题:Java ExternalContext.getRequest方法的具体用法?Java ExternalContext.getRequest怎么用?Java ExternalContext.getRequest使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javax.faces.context.ExternalContext
的用法示例。
在下文中一共展示了ExternalContext.getRequest方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: FlippedIconRequest
import javax.faces.context.ExternalContext; //导入方法依赖的package包/类
public FlippedIconRequest(
UIXRenderingContext context,
String source
)
{
super(source);
ExternalContext external = context.getFacesContext().getExternalContext();
Object requestObj = external.getRequest();
if (requestObj instanceof ServletRequest)
_request = (ServletRequest) requestObj;
// We need to resolve source now and save it relative to context root
setSource( _resolveSourceName( external, source));
}
示例2: __saveUploadedFilesForWindow
import javax.faces.context.ExternalContext; //导入方法依赖的package包/类
static synchronized Map<String, UploadedFiles> __saveUploadedFilesForWindow(UploadedFiles files,
ExternalContext externalContext,
RequestContext requestContext)
{
Map<String, UploadedFiles> uploadedFilesSessionMap = null;
String windowId = _getCurrentWindowId(externalContext, requestContext);
if (externalContext.getRequest() instanceof HttpServletRequest)
{
HttpSession session = ((HttpServletRequest) externalContext.getRequest()).getSession();
uploadedFilesSessionMap = (Map<String, UploadedFiles>) session.getAttribute(_UPLOADED_FILES_KEY);
if (uploadedFilesSessionMap == null)
{
uploadedFilesSessionMap = new HashMap<String, UploadedFiles>();
}
uploadedFilesSessionMap.put(windowId, files);
// Weblogic HA only replicates the HTTP Session if setAttribute() was called
// so we cannot call getSessionMap().put(_UPLOADED_FILES_KEY, uploadedFilesSessionMap) instead
session.setAttribute(_UPLOADED_FILES_KEY, uploadedFilesSessionMap);
}
return uploadedFilesSessionMap;
}
示例3: getRequestInputStream
import javax.faces.context.ExternalContext; //导入方法依赖的package包/类
/**
* Returns the request input stream if one is available
*
* @param ec the current external context
* @return the request's input stream
* @throws IOException if there was a problem getting the input stream
*/
public static InputStream getRequestInputStream(ExternalContext ec)
throws IOException
{
RequestType type = getRequestType(ec);
if(type.isRequestFromClient())
{
Object req = ec.getRequest();
if(type.isPortlet())
{
return (InputStream)_runMethod(req, "getPortletInputStream");
}
else
{
return ((ServletRequest) ec.getRequest()).getInputStream();
}
}
return null;
}
示例4: _getRequest
import javax.faces.context.ExternalContext; //导入方法依赖的package包/类
private ServletRequest _getRequest(ExternalContext ec)
{
String uid = ec.getRequestParameterMap().get(_LAUNCH_KEY);
if(uid != null)
{
/**
* We use pageflow scope so that if something fails on the redirect, we
* have a chance of getting cleaned up early. This will not always happen
* so the object may stick around for a while.
*/
Map<String, Object> sessionMap = ec.getSessionMap();
LaunchData data = (LaunchData)sessionMap.remove(_getKey(uid));
//We are returning from a dialog:
if(data != null)
{
Map<String, Object> requestMap = ec.getRequestMap();
//Setting the flag to properly support isExecutingDialogReturn.
//This is needed for isExecutingDialogReturn.
requestMap.put(_IS_RETURNING_KEY, Boolean.TRUE);
UIViewRoot launchView = data.getLaunchView();
if(launchView != null)
{
requestMap.put(RequestContextImpl.LAUNCH_VIEW, data.getLaunchView());
}
return new ReplaceParametersRequestWrapper(
(HttpServletRequest) ec.getRequest(),
data.getLaunchParam());
}
}
return (ServletRequest)ec.getRequest();
}
示例5: createAgent
import javax.faces.context.ExternalContext; //导入方法依赖的package包/类
@Override
public Agent createAgent(FacesContext facesContext)
{
AgentImpl agent = new AgentImpl();
// Get the RequestHeaderMap to help populate the agent
Map<String, String> headerMap;
ExternalContext extContext = null;
if (facesContext != null)
{
extContext = facesContext.getExternalContext();
headerMap = extContext.getRequestHeaderMap();
}
else
{
headerMap = Collections.emptyMap();
}
// determine whether we are being called outside of a request, since in that case, we won't be
// able to determine the real agent, since we won't have any headers.
// This happens during JSF bootstrap
boolean noRequest = (extContext == null) || (extContext.getRequest() == null);
_populateAgentImpl(facesContext, headerMap, noRequest, agent);
return agent;
}
示例6: UploadActionRequestWrapper
import javax.faces.context.ExternalContext; //导入方法依赖的package包/类
public UploadActionRequestWrapper(
ExternalContext ec,
Map<String, String[]> params)
{
super((ActionRequest)ec.getRequest());
_response = (ActionResponse)ec.getResponse();
_manager = new UploadRequestManager(ec, params);
}
示例7: getUploadedFilesForWindow
import javax.faces.context.ExternalContext; //导入方法依赖的package包/类
/**
* Returns the map of uploaded files for the current session.
*/
@SuppressWarnings("unchecked")
static public synchronized UploadedFiles getUploadedFilesForWindow(ExternalContext externalContext)
{
RequestContext requestContext = RequestContext.getCurrentInstance();
String windowId = _getCurrentWindowId(externalContext, requestContext);
UploadedFiles files = null;
if (externalContext.getRequest() instanceof HttpServletRequest)
{
HttpSession session = ((HttpServletRequest) externalContext.getRequest()).getSession();
Map<String, UploadedFiles> uploadedFilesSessionMap =
(Map<String, UploadedFiles>) session.getAttribute(_UPLOADED_FILES_KEY);
if (uploadedFilesSessionMap == null)
{
uploadedFilesSessionMap = __saveUploadedFilesForWindow(files, externalContext, requestContext);
}
files = uploadedFilesSessionMap.get(windowId);
}
if (files == null)
{
files = new UploadedFiles();
__saveUploadedFilesForWindow(files, externalContext, requestContext);
}
return files;
}
示例8: _isSetRequestBugPresent
import javax.faces.context.ExternalContext; //导入方法依赖的package包/类
static private boolean _isSetRequestBugPresent(ExternalContext ec)
{
// This first check is here in order to skip synchronization until
// absolutely necessary.
if (!_sSetRequestBugTested)
{
synchronized (GlobalConfiguratorImpl.class)
{
//This second check is here in case a couple of things enter before the
//boolean is set. This is only an exception case and will make it so
//the initialization code runs only once.
if (!_sSetRequestBugTested)
{
ServletRequest orig = (ServletRequest) ec.getRequest();
// Call getInitParameterMap() up front
ec.getInitParameterMap();
ec.setRequest(new TestRequest(orig));
_sHasSetRequestBug = !TestRequest.isTestParamPresent(ec);
_sSetRequestBugTested = true;
ec.setRequest(orig);
}
}
}
return _sHasSetRequestBug;
}
示例9: _isContextValid
import javax.faces.context.ExternalContext; //导入方法依赖的package包/类
/**
* Checks if the faces context that we have is valid for this request
*/
private boolean _isContextValid(FacesContext context)
{
ExternalContext ec = context.getExternalContext();
// a bogus context would not have a request object
return ((ec != null) && (ec.getRequest() != null));
}
示例10: isSecure
import javax.faces.context.ExternalContext; //导入方法依赖的package包/类
/**
* Provides access to {@link ServletRequest#isSecure()} or {@link javax.portlet.PortletRequest#isSecure()}
* @param ec
* @return
*/
public static boolean isSecure(
ExternalContext ec)
{
Object req = ec.getRequest();
if (isPortlet(ec))
{
return (Boolean)_runMethod(req, "isSecure");
}
else
{
return ((ServletRequest)req).isSecure();
}
}
示例11: _handleDialogReturn
import javax.faces.context.ExternalContext; //导入方法依赖的package包/类
private void _handleDialogReturn(ExternalContext ec)
throws IOException
{
Map<String, Object> reqMap = ec.getRequestMap();
if(Boolean.TRUE.equals(reqMap.get(DialogServiceImpl.DIALOG_RETURN)))
{
/**
* We use pageflow scope so that if something fails on the redirect, we
* have a chance of getting cleaned up early. This will not always happen
* so the object may stick around for a while.
*/
Map<String, Object> sessionMap = ec.getSessionMap();
String uid = UUID.randomUUID().toString();
LaunchData data = new LaunchData((UIViewRoot)reqMap.get(RequestContextImpl.LAUNCH_VIEW), (Map<String, String[]>) reqMap.get(RequestContextImpl.LAUNCH_PARAMETERS));
sessionMap.put(_getKey(uid), data);
//Construct URL
//TODO: sobryan I believe some of this can be added to the RequestContextUtils to allow
// this url to be constructed for both portlet and servlet environments. We'll want to research.
HttpServletRequest req = (HttpServletRequest) ec.getRequest();
StringBuffer url = req.getRequestURL().append("?");
String queryStr = req.getQueryString();
if((queryStr != null) && (queryStr.trim().length() >0))
{
url.append(queryStr)
.append("&");
}
url.append(_LAUNCH_KEY)
.append("=")
.append(uid);
//Extensions to Trinidad may have alternatve means of handling PPR. This
//flag allows those extensions to for the <redirect> AJAX message to be returned.
if (RequestContext.getCurrentInstance().isPartialRequest(_PSEUDO_FACES_CONTEXT.get()) ||
Boolean.TRUE.equals(RequestStateMap.getInstance(ec).get(_FORCE_PPR_DIALOG_RETURN)))
{
//Special handling for XmlHttpRequest. Would be cool to handle this much cleaner.
HttpServletResponse resp = (HttpServletResponse) ec.getResponse();
XmlHttpConfigurator.sendXmlRedirect(resp.getWriter(), url.toString());
}
else
{
ec.redirect(url.toString());
}
}
}
示例12: _isMultipartHttpServletRequest
import javax.faces.context.ExternalContext; //导入方法依赖的package包/类
private static boolean _isMultipartHttpServletRequest(ExternalContext externalContext)
{
return (MultipartFormHandler.isMultipartRequest(externalContext) &&
(externalContext.getRequest() instanceof HttpServletRequest));
}
示例13: UploadRequestWrapper
import javax.faces.context.ExternalContext; //导入方法依赖的package包/类
public UploadRequestWrapper(ExternalContext ec, Map<String, String[]> params)
{
super((HttpServletRequest) ec.getRequest());
_manager = new UploadRequestManager(ec, params);
}
示例14: UploadActionInvocationHandler
import javax.faces.context.ExternalContext; //导入方法依赖的package包/类
public UploadActionInvocationHandler(ExternalContext ec, Map<String, String[]> params)
{
_request = ec.getRequest();
_response = ec.getResponse();
_manager = new UploadRequestManager(ec, params);
}
示例15: UploadResourceRequest
import javax.faces.context.ExternalContext; //导入方法依赖的package包/类
public UploadResourceRequest(ExternalContext ec, Map<String, String[]> params)
{
super((ResourceRequest) ec.getRequest());
_response = (ActionResponse) ec.getResponse();
_manager = new UploadRequestManager(ec, params);
}