本文整理汇总了Java中org.apache.wicket.request.Request类的典型用法代码示例。如果您正苦于以下问题:Java Request类的具体用法?Java Request怎么用?Java Request使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
Request类属于org.apache.wicket.request包,在下文中一共展示了Request类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getBaseURL
import org.apache.wicket.request.Request; //导入依赖的package包/类
public static String getBaseURL() {
final RequestCycle requestCycle = RequestCycle.get();
final Request request = requestCycle.getRequest();
final String currentPath = request.getUrl().toString();
String fullUrl = requestCycle.getUrlRenderer().renderFullUrl(request.getUrl());
if (org.apache.commons.lang3.StringUtils.isNotBlank(currentPath)) {
final int beginPath = fullUrl.lastIndexOf(currentPath);
fullUrl = fullUrl.substring(0, beginPath - 1);
}
final Optional<String> contextPath = Optional.ofNullable(requestCycle.getRequest().getContextPath());
final Optional<String> filterPath = Optional.ofNullable(requestCycle.getRequest().getFilterPath());
return fullUrl + contextPath.orElse("") + filterPath.orElse("");
}
示例2: getPaginatorRows
import org.apache.wicket.request.Request; //导入依赖的package包/类
public Integer getPaginatorRows(final Request request,
final String key) {
Integer result = getPaginatorChoices().get(0);
String value = get(request, key);
if (value != null) {
try {
result = Integer.valueOf(value);
} catch (NumberFormatException e) {
LOG.error("Unparsable value " + value, e);
}
}
return result;
}
示例3: SpringAuthenticatedWebSession
import org.apache.wicket.request.Request; //导入依赖的package包/类
public SpringAuthenticatedWebSession(Request request)
{
super(request);
injectDependencies();
ensureDependenciesNotNull();
// If the a proper (non-anonymous) authentication has already been performed (e.g. via
// external pre-authentication) then also mark the Wicket session as signed-in.
Authentication authentication = SecurityContextHolder.getContext().getAuthentication();
if (
authentication != null &&
authentication.isAuthenticated() &&
authentication instanceof PreAuthenticatedAuthenticationToken
//!(authentication instanceof AnonymousAuthenticationToken && !isSignedIn())
) {
signIn(true);
}
}
示例4: bind
import org.apache.wicket.request.Request; //导入依赖的package包/类
@Override
public void bind(Request request, Session newSession)
{
if (getAttribute(request, Session.SESSION_ATTRIBUTE_NAME) != newSession)
{
// call template method
onBind(request, newSession);
for (BindListener listener : getBindListeners())
{
listener.bindingSession(request, newSession);
}
HttpSession httpSession = getHttpSession(request, false);
if (httpSession != null)
{
// register an unbinding listener for cleaning up
String applicationKey = Application.get().getName();
httpSession.setAttribute("Wicket:SessionUnbindingListener-" + applicationKey,
new SessionBindingListener(applicationKey, newSession));
}
// register the session object itself
setAttribute(request, Session.SESSION_ATTRIBUTE_NAME, newSession);
}
}
示例5: fixSimpleRepoBrowsingUrl
import org.apache.wicket.request.Request; //导入依赖的package包/类
private void fixSimpleRepoBrowsingUrl(Request request, Url url) {
RepoPath repoPath = RequestUtils.getRepoPath((HttpServletRequest) request.getContainerRequest());
if (repoPath != null) {
/*ArrayList<String> prefix = new ArrayList<String>();
String path = repoPath.getPath();
if (StringUtils.isNotEmpty(path)) {
int nesting = new StringTokenizer(path, "/").countTokens() + 1;
while (nesting > 0) {
prefix.add("..");
nesting--;
}
} else {
prefix.add("..");
}
*/
List<String> prefix = Lists.newArrayList("..");
String filterPath = request.getFilterPath();
if (StringUtils.isNotEmpty(filterPath) && filterPath.startsWith("/")) {
prefix.add(filterPath.substring(1));
}
url.prependLeadingSegments(prefix);
}
}
示例6: SyncopeEnduserSession
import org.apache.wicket.request.Request; //导入依赖的package包/类
public SyncopeEnduserSession(final Request request) {
super(request);
// define cookie utility to manage application cookies
cookieUtils = new CookieUtils();
anonymousClient = SyncopeEnduserApplication.get().getClientFactory().
create(new AnonymousAuthenticationHandler(
SyncopeEnduserApplication.get().getAnonymousUser(),
SyncopeEnduserApplication.get().getAnonymousKey()));
platformInfo = anonymousClient.getService(SyncopeService.class).platform();
datePlainSchemas = anonymousClient.getService(SchemaService.class).
list(new SchemaQuery.Builder().type(SchemaType.PLAIN).build());
datePlainSchemas.removeAll(datePlainSchemas.stream().
filter(object -> object.getType() != AttrSchemaType.Date).collect(Collectors.toSet()));
}
示例7: set
import org.apache.wicket.request.Request; //导入依赖的package包/类
public void set(final Request request, final Response response, final Map<String, List<String>> prefs) {
Map<String, String> current = new HashMap<>();
String prefString = COOKIE_UTILS.load(COOKIE_NAME);
if (prefString != null) {
current.putAll(getPrefs(new String(Base64.getDecoder().decode(prefString.getBytes()))));
}
// after retrieved previous setting in order to overwrite the key ...
prefs.entrySet().forEach(entry -> {
current.put(entry.getKey(), StringUtils.join(entry.getValue(), ";"));
});
try {
COOKIE_UTILS.save(COOKIE_NAME, Base64.getEncoder().encodeToString(setPrefs(current).getBytes()));
} catch (IOException e) {
LOG.error("Could not save {} info: {}", getClass().getSimpleName(), current, e);
}
}
示例8: MySession
import org.apache.wicket.request.Request; //导入依赖的package包/类
public MySession(final Request request)
{
super(request);
setLocale(request);
final ClientInfo info = getClientInfo();
if (info instanceof WebClientInfo) {
clientProperties = ((WebClientInfo) clientInfo).getProperties();
clientProperties.setTimeZone(PFUserContext.getTimeZone());
userAgent = ((WebClientInfo) info).getUserAgent();
userAgentDevice = UserAgentDevice.getUserAgentDevice(userAgent);
userAgentOS = UserAgentOS.getUserAgentOS(userAgent);
mobileUserAgent = userAgentDevice.isMobile();
final UserAgentDetection userAgentDetection = UserAgentDetection.browserDetect(userAgent);
userAgentBrowser = userAgentDetection.getUserAgentBrowser();
userAgentBrowserVersionString = userAgentDetection.getUserAgentBrowserVersion();
} else {
log.error("Oups, ClientInfo is not from type WebClientInfo: " + info);
}
setUser(PFUserContext.getUser());
this.csrfToken = NumberHelper.getSecureRandomUrlSaveString(20);
}
示例9: MenuConfig
import org.apache.wicket.request.Request; //导入依赖的package包/类
/**
* @param id
*/
@SuppressWarnings("serial")
public MenuConfig(final String id, final Menu menu, final FavoritesMenu favoritesMenu)
{
super(id);
configureLink = new WebMarkupContainer("configureLink");
add(configureLink);
configureBehavior = new AbstractDefaultAjaxBehavior() {
@Override
protected void respond(final AjaxRequestTarget target)
{
final Request request = RequestCycle.get().getRequest();
final StringValue configuration = request.getPostParameters().getParameterValue("configuration");
final String xml = configuration.toString("");
if (log.isDebugEnabled() == true) {
log.debug(xml);
}
favoritesMenu.readFromXml(xml);
favoritesMenu.storeAsUserPref();
}
};
add(configureBehavior);
add(new MenuConfigContent("content", menu));
}
示例10: respond
import org.apache.wicket.request.Request; //导入依赖的package包/类
@Override
protected void respond() {
Request r = getCalendar().getRequest();
String sid = r.getRequestParameters().getParameterValue(SOURCE_ID).toString();
DateTime start = new DateTime(r.getRequestParameters().getParameterValue("start").toLong());
DateTime end = new DateTime(r.getRequestParameters().getParameterValue("end").toLong());
if (getCalendar().getConfig().isIgnoreTimezone()) {
// Convert to same DateTime in local time zone.
int remoteOffset = -r.getRequestParameters().getParameterValue("timezoneOffset").toInt();
int localOffset = DateTimeZone.getDefault().getOffset(null) / 60000;
int minutesAdjustment = remoteOffset - localOffset;
start = start.plusMinutes(minutesAdjustment);
end = end.plusMinutes(minutesAdjustment);
}
EventSource source = getCalendar().getEventManager().getEventSource(sid);
EventProvider provider = source.getEventProvider();
String response = getCalendar().toJson(provider.getEvents(start, end));
getCalendar().getRequestCycle().scheduleRequestHandlerAfterCurrent(
new TextRequestHandler("application/json", "UTF-8", response));
}
示例11: onEvent
import org.apache.wicket.request.Request; //导入依赖的package包/类
@Override
protected boolean onEvent(final AjaxRequestTarget target)
{
final Request r = getCalendar().getRequest();
final String eventId = r.getRequestParameters().getParameterValue("eventId").toString();
final String sourceId = r.getRequestParameters().getParameterValue("sourceId").toString();
final EventSource source = getCalendar().getEventManager().getEventSource(sourceId);
final Event event = source.getEventProvider().getEventForId(eventId);
final int dayDelta = r.getRequestParameters().getParameterValue("dayDelta").toInt();
final int minuteDelta = r.getRequestParameters().getParameterValue("minuteDelta").toInt();
final boolean allDay = r.getRequestParameters().getParameterValue("allDay").toBoolean();
return onEventDropped(new DroppedEvent(source, event, dayDelta, minuteDelta, allDay), new CalendarResponse(getCalendar(), target));
}
示例12: onEvent
import org.apache.wicket.request.Request; //导入依赖的package包/类
@Override
protected boolean onEvent(final AjaxRequestTarget target) {
final Request r = getCalendar().getRequest();
final String eventId = r.getRequestParameters().getParameterValue("eventId").toString();
final String sourceId = r.getRequestParameters().getParameterValue("sourceId").toString();
final EventSource source = getCalendar().getEventManager().getEventSource(sourceId);
final Event event = source.getEventProvider().getEventForId(eventId);
final int dayDelta = r.getRequestParameters().getParameterValue("dayDelta").toInt();
final int minuteDelta = r.getRequestParameters().getParameterValue("minuteDelta").toInt();
return onEventResized(new ResizedEvent(source, event, dayDelta, minuteDelta), new CalendarResponse(
getCalendar(), target));
}
示例13: respond
import org.apache.wicket.request.Request; //导入依赖的package包/类
@Override
protected void respond(final AjaxRequestTarget target) {
final Request r = target.getPage().getRequest();
final ViewType type = ViewType.forCode(r.getRequestParameters().getParameterValue("view").toString());
final DateTimeFormatter fmt = ISODateTimeFormat.dateTimeParser().withZone(PFUserContext.getDateTimeZone());
final DateMidnight start = fmt.parseDateTime(r.getRequestParameters().getParameterValue("start").toString())
.toDateMidnight();
final DateMidnight end = fmt.parseDateTime(r.getRequestParameters().getParameterValue("end").toString())
.toDateMidnight();
final DateMidnight visibleStart = fmt.parseDateTime(
r.getRequestParameters().getParameterValue("visibleStart").toString()).toDateMidnight();
final DateMidnight visibleEnd = fmt
.parseDateTime(r.getRequestParameters().getParameterValue("visibleEnd").toString()).toDateMidnight();
final View view = new View(type, start, end, visibleStart, visibleEnd);
final CalendarResponse response = new CalendarResponse(getCalendar(), target);
onViewDisplayed(view, response);
}
示例14: respond
import org.apache.wicket.request.Request; //导入依赖的package包/类
@Override
protected void respond(final AjaxRequestTarget target) {
final Request r = getCalendar().getRequest();
DateTime start = new DateTime(r.getRequestParameters().getParameterValue("startDate").toLong());
DateTime end = new DateTime(r.getRequestParameters().getParameterValue("endDate").toLong());
if (ignoreTimezone) {
// Convert to same DateTime in local time zone.
final int remoteOffset = -r.getRequestParameters().getParameterValue("timezoneOffset").toInt();
final int localOffset = DateTimeZone.getDefault().getOffset(null) / 60000;
final int minutesAdjustment = remoteOffset - localOffset;
start = start.plusMinutes(minutesAdjustment);
end = end.plusMinutes(minutesAdjustment);
}
final boolean allDay = r.getRequestParameters().getParameterValue("allDay").toBoolean();
onSelect(new SelectedRange(start, end, allDay), new CalendarResponse(getCalendar(), target));
}
示例15: NextServerSession
import org.apache.wicket.request.Request; //导入依赖的package包/类
public NextServerSession(Request request) {
super(request);
Injector.get().inject(this);
sectionContexts = new HashMap<String, SectionContext>();
List<Section> sections = sectionManager.getSections();
for (Section section : sections) {
sectionContexts.put(section.getId(), SectionContextFactory.createSectionContext(section));
}
// if (!sections.isEmpty()) {
// selectedSectionId = sections.get(0).getId();
// }
String language = storageService.getSettings().getLanguage();
Locale locale = LanguageManager.getInstance().getLocale(language);
setLocale(locale);
LOG.info("--------------------> Set locale to: " + language);
}