private static boolean hasParameter(VaadinRequest request, String parameterName) { return request.getParameter(parameterName) != null; }
private boolean isOtherRequest(VaadinRequest request) { return request.getParameter( ApplicationConstants.REQUEST_TYPE_PARAMETER) == null; }
/** * Returns whether the given request is of the given type. * * @param request * the request to check * @param requestType * the type to check for * @return <code>true</code> if the request is of the given type, * <code>false</code> otherwise */ public static boolean isRequestType(VaadinRequest request, RequestType requestType) { return requestType.getIdentifier().equals(request .getParameter(ApplicationConstants.REQUEST_TYPE_PARAMETER)); }
/** * For internal use only. Updates all properties in the class according to * the given information. * * @param request * the Vaadin request to read the information from */ public void updateRequestDetails(VaadinRequest request) { locale = request.getLocale(); address = request.getRemoteAddr(); secureConnection = request.isSecure(); // Headers are case insensitive according to the specification but are // case sensitive in Weblogic portal... String agent = request.getHeader("User-Agent"); if (agent != null) { browserApplication = agent; browserDetails = new BrowserDetails(agent); } if (request.getParameter("v-sw") != null) { updateClientSideDetails(request.getParameter("v-sw"), request.getParameter("v-sh"), request.getParameter("v-tzo"), request.getParameter("v-rtzo"), request.getParameter("v-dstd"), request.getParameter("v-dston"), request.getParameter("v-tzid"), request.getParameter("v-curdate"), request.getParameter("v-td") != null); } }
/** * Finds the {@link UI} that belongs to the provided request. This is * generally only supported for UIDL requests as other request types are not * related to any particular UI or have the UI information encoded in a * non-standard way. The returned UI is also set as the current UI ( * {@link UI#setCurrent(UI)}). * * @param request * the request for which a UI is desired * @return the UI belonging to the request or null if no UI is found */ public UI findUI(VaadinRequest request) { // getForSession asserts that the lock is held VaadinSession session = loadSession(request.getWrappedSession()); // Get UI id from the request String uiIdString = request .getParameter(ApplicationConstants.UI_ID_PARAMETER); UI ui = null; if (uiIdString != null && session != null) { int uiId = Integer.parseInt(uiIdString); ui = session.getUIById(uiId); } UI.setCurrent(ui); return ui; }