List of usage examples for javax.servlet.http HttpServletRequest setAttribute
public void setAttribute(String name, Object o);
From source file:com.redhat.rhn.frontend.taglibs.list.ListTagHelper.java
/** * Stores how many objects are selected for use by the list tag * @param listName name of list//w ww. j a v a2 s . c om * @param amount amount of items selected * @param request current HttpServletRequest */ public static void setSelectedAmount(String listName, int amount, HttpServletRequest request) { String uniqueName = TagHelper.generateUniqueName(listName); String selectedName = ListTagUtil.makeSelectedAmountName(uniqueName); request.setAttribute(selectedName, String.valueOf(amount)); }
From source file:com.ocpsoft.pretty.PrettyContext.java
/** * Package private -- only PrettyFilter or this class should be calling this * method -- it overwrites existing contexts in Request object */// ww w. j a v a 2s . c o m public static void setCurrentContext(final HttpServletRequest request, final PrettyContext prettyContext) { request.setAttribute(CONTEXT_REQUEST_KEY, prettyContext); }
From source file:com.runwaysdk.controller.ErrorUtility.java
private static void prepareThrowable(Throwable t, HttpServletRequest req) { String localizedMessage = t.getLocalizedMessage(); req.setAttribute(ErrorUtility.ERROR_MESSAGE, localizedMessage); if (t instanceof ProgrammingErrorExceptionDTO) { try {// ww w . j av a2 s. c o m ProgrammingErrorExceptionDTO pee = (ProgrammingErrorExceptionDTO) t; String developerMessage = pee.getDeveloperMessage(); req.setAttribute(ErrorUtility.DEVELOPER_MESSAGE, developerMessage); } catch (Exception e) { // TODO Auto-generated catch block e.printStackTrace(); } } else if (t instanceof RuntimeException) { throw (RuntimeException) t; } }
From source file:de.ifgi.fmt.web.filter.auth.Authorization.java
/** * //w ww.j ava2 s . com * @param cr * @param sr * @param u */ public static void auth(ContainerRequest cr, HttpServletRequest sr, User u) { log.debug("Authorizing session for user {}", u); if (sr != null) { if (sr.getAttribute(AUTH_TYPE_SESSION_ATTRIBUTE) == null) { sr.setAttribute(AUTH_TYPE_SESSION_ATTRIBUTE, Auth.HTTP_BASIC); } sr.setAttribute(USER_SESSION_ATTRIBUTE, u); } if (cr != null) { cr.setSecurityContext(new FmtSecurityContext(u)); } }
From source file:edu.cornell.mannlib.vitro.webapp.modelaccess.ModelAccess.java
public static RequestModelAccess on(HttpServletRequest req) { Object o = req.getAttribute(ATTRIBUTE_NAME); if (o instanceof RequestModelAccess) { return (RequestModelAccess) o; } else {/*from www. ja v a2 s . com*/ RequestModelAccess access = factory.buildRequestModelAccess(req); req.setAttribute(ATTRIBUTE_NAME, access); return access; } }
From source file:edu.ucsb.nceas.metacat.util.RequestUtil.java
/** * Add a list of general messages to the request. The pages will pick up the * messages and display them where appropriate. * //from www .java 2 s . c o m * @param request * the request that will get forwarded * @param errorVector * a list of general message strings */ public static void clearRequestMessages(HttpServletRequest request) { request.setAttribute("formMessage", null); request.setAttribute("formSuccess", null); request.setAttribute("formErrors", null); request.setAttribute("processingMessage", null); request.setAttribute("processingSuccess", null); request.setAttribute("formFieldErrors", null); request.setAttribute("processingErrors", null); }
From source file:com.aoindustries.website.signup.SignupTechnicalActionHelper.java
public static void setConfirmationRequestAttributes(ServletContext servletContext, HttpServletRequest request, SignupTechnicalForm signupTechnicalForm) throws IOException, SQLException { // Lookup things needed by the view AOServConnector rootConn = SiteSettings.getInstance(servletContext).getRootAOServConnector(); // Store as request attribute for the view request.setAttribute("baCountry", getBaCountry(rootConn, signupTechnicalForm)); }
From source file:com.threewks.thundr.request.servlet.ServletSupport.java
/** * Add the given attributes to the request * //from www.j av a2 s. c om * @param request * @param attributes */ public static void addAttributes(HttpServletRequest request, Map<String, Object> attributes) { if (request != null) { for (Map.Entry<String, Object> attribute : attributes.entrySet()) { request.setAttribute(attribute.getKey(), attribute.getValue()); } } }
From source file:com.aoindustries.website.signup.SignupBusinessActionHelper.java
public static void setConfirmationRequestAttributes(ServletContext servletContext, HttpServletRequest request, SignupBusinessForm signupBusinessForm) throws IOException, SQLException { // Lookup things needed by the view AOServConnector rootConn = SiteSettings.getInstance(servletContext).getRootAOServConnector(); // Store as request attribute for the view request.setAttribute("businessCountry", getBusinessCountry(rootConn, signupBusinessForm)); }
From source file:com.mapviewer.business.UserRequestManager.java
/** * Updates the request done by the user. * * @param request//from w w w . j ava2 s. c o m */ public static boolean updateDataSelected(HttpServletRequest request) { String[] url = request.getParameterValues("URL"); boolean existeURL = false; if (url != null) { existeURL = true; request.setAttribute("layersSpecData", url); } return existeURL; }