List of usage examples for javax.servlet.http HttpServletRequest getAttribute
public Object getAttribute(String name);
Object
, or null
if no attribute of the given name exists. From source file:info.magnolia.cms.util.Resource.java
/** * <p>//from ww w . ja va 2 s . c o m * get file object associated with the requested atom * </p> * @param req HttpServletRequest as received in JSP or servlet * @return currently atom */ public static File getFile(HttpServletRequest req) { return (File) req.getAttribute(Aggregator.FILE); }
From source file:info.magnolia.cms.beans.config.MIMEMapping.java
/** * Get MIME type String.//from w ww . ja va 2 s . co m * @param request * @return MIME type */ public static String getMIMEType(HttpServletRequest request) { String extension = (String) request.getAttribute(Aggregator.EXTENSION); if (StringUtils.isEmpty(extension)) { // the . could be in the middle of the url extension = StringUtils.substringAfterLast(request.getRequestURI(), "/"); extension = StringUtils.substringAfterLast(extension, "."); //$NON-NLS-1$ if (StringUtils.isEmpty(extension)) { extension = Server.getDefaultExtension(); } } String mimeType = getMIMEType(extension); if (mimeType == null && StringUtils.isNotEmpty(extension)) { log.info("Cannot find MIME type for extension \"" + extension + "\""); //$NON-NLS-1$ //$NON-NLS-2$ mimeType = ((MIMEMappingItem) MIMEMapping.cachedContent.get(Server.getDefaultExtension())).mime; } return mimeType; }
From source file:info.magnolia.cms.util.Resource.java
/** * <p>//from w ww . jav a 2s .c o m * get Content object as requested from the URI * </p> * @param req HttpServletRequest as received in JSP or servlet * @return currently active page, as requested from the URI */ public static Content getActivePage(HttpServletRequest req) { return (Content) req.getAttribute(Aggregator.ACTPAGE); }
From source file:info.magnolia.cms.util.Resource.java
/** * <p>// ww w . jav a 2s . c om * this only works for forms which uses enctype=multipart/form-data * </p> * @param req HttpServletRequest as received in JSP or servlet * @return initialised multipart form object with the posted data */ public static MultipartForm getPostedForm(HttpServletRequest req) { return (MultipartForm) req.getAttribute("multipartform"); //$NON-NLS-1$ }
From source file:com.curl.orb.servlet.InstanceManagementUtil.java
/** * Get InstanceManagementRequest.// www.j a v a 2s .co m */ public static InstanceManagementRequest getRequest(HttpServletRequest httpRequest) { return (InstanceManagementRequest) httpRequest.getAttribute(InstanceManagementServlet.REQUEST_OBJECT); }
From source file:info.magnolia.cms.util.Resource.java
/** * Get HierarchyManager object from the request OR from the user session this hierarchy manager points to website * repository, in order to swith between user and website repositories, use method (changeContext) on this object. * @param req HttpServletRequest as received in JSP or servlet * @return hierarchy manager, for the website repository * @deprecated as on magnolia 2.0, use SessionAccessControl instead * @see info.magnolia.cms.security.SessionAccessControl#getHierarchyManager(javax.servlet.http.HttpServletRequest) *///from w ww.j a v a 2 s. co m public static HierarchyManager getHierarchyManager(HttpServletRequest req) { return (HierarchyManager) req.getAttribute(Aggregator.HIERARCHY_MANAGER); }
From source file:ee.ria.xroad.proxy.clientproxy.AbstractClientProxyHandler.java
protected static IsAuthenticationData getIsAuthenticationData(HttpServletRequest request) { X509Certificate[] certs = (X509Certificate[]) request.getAttribute("javax.servlet.request.X509Certificate"); return new IsAuthenticationData(certs != null && certs.length != 0 ? certs[0] : null, !"https".equals(request.getScheme()) // if not HTTPS, it's plaintext );//from ww w. j a va 2 s .com }
From source file:info.magnolia.cms.util.Resource.java
/** * *///from w w w. j a va 2 s .c o m public static String getLocalContentNodeCollectionName(HttpServletRequest req) { try { return (String) req.getAttribute(Resource.LOCAL_CONTENT_NODE_COLLECTION_NAME); } catch (Exception e) { return StringUtils.EMPTY; } }
From source file:info.magnolia.cms.util.ServletUtil.java
/** * Returns the dispatcher type of the request, the dispatcher type is defined to be identical to the semantics of * filter mappings in web.xml.// w ww .j av a2 s. c o m */ public static DispatcherType getDispatcherType(HttpServletRequest request) { // The order of these tests is important. if (request.getAttribute(INCLUDE_REQUEST_URI_ATTRIBUTE) != null) { return DispatcherType.INCLUDE; } if (request.getAttribute(FORWARD_REQUEST_URI_ATTRIBUTE) != null) { return DispatcherType.FORWARD; } if (request.getAttribute(ERROR_REQUEST_STATUS_CODE_ATTRIBUTE) != null) { return DispatcherType.ERROR; } return DispatcherType.REQUEST; }
From source file:info.magnolia.cms.util.Resource.java
/** * <p>/*from www . ja v a2 s . c o m*/ * get ContentNode object as passed to the include tag * </p> * @param req HttpServletRequest as received in JSP or servlet * @return ContentNode , local container specific to the current JSP/Servlet paragraph */ public static Content getLocalContentNode(HttpServletRequest req) { try { return (Content) req.getAttribute(Resource.LOCAL_CONTENT_NODE); } catch (Exception e) { return null; } }