当前位置: 首页>>代码示例>>Java>>正文


Java WebRequest类代码示例

本文整理汇总了Java中org.apache.wicket.request.http.WebRequest的典型用法代码示例。如果您正苦于以下问题:Java WebRequest类的具体用法?Java WebRequest怎么用?Java WebRequest使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


WebRequest类属于org.apache.wicket.request.http包,在下文中一共展示了WebRequest类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: newWebRequest

import org.apache.wicket.request.http.WebRequest; //导入依赖的package包/类
@Override
public WebRequest newWebRequest(HttpServletRequest servletRequest, String filterPath) {
	return new ServletWebRequest(servletRequest, filterPath) {

		@Override
		public boolean shouldPreserveClientUrl() {
			if (RequestCycle.get().getActiveRequestHandler() instanceof RenderPageRequestHandler) {
				RenderPageRequestHandler requestHandler = 
						(RenderPageRequestHandler) RequestCycle.get().getActiveRequestHandler();
				
				/*
				 *  Add this to make sure that the page url does not change upon errors, so that 
				 *  user can know which page is actually causing the error. This behavior is common
				 *  for main stream applications.   
				 */
				if (requestHandler.getPage() instanceof BaseErrorPage) 
					return true;
			}
			return super.shouldPreserveClientUrl();
		}
		
	};
}
 
开发者ID:jmfgdev,项目名称:gitplex-mit,代码行数:24,代码来源:GitPlexWebApplication.java

示例2: MarkdownEditor

import org.apache.wicket.request.http.WebRequest; //导入依赖的package包/类
/**
 * @param id 
 * 			component id of the editor
 * @param model
 * 			markdown model of the editor
 * @param compactMode
 * 			editor in compact mode occupies horizontal space and is suitable 
 * 			to be used in places such as comment aside the code
 */
public MarkdownEditor(String id, IModel<String> model, boolean compactMode) {
	super(id, model);
	this.compactMode = compactMode;
	
	String cookieKey;
	if (compactMode)
		cookieKey = "markdownEditor.compactMode.split";
	else
		cookieKey = "markdownEditor.normalMode.split";
	
	WebRequest request = (WebRequest) RequestCycle.get().getRequest();
	Cookie cookie = request.getCookie(cookieKey);
	if (cookie!=null && "true".equals(cookie.getValue())) {
		initialSplit = true;
	} else {
		initialSplit = !compactMode;
	}
}
 
开发者ID:jmfgdev,项目名称:gitplex-mit,代码行数:28,代码来源:MarkdownEditor.java

示例3: AdvancedSearchPanel

import org.apache.wicket.request.http.WebRequest; //导入依赖的package包/类
public AdvancedSearchPanel(String id, IModel<Project> projectModel, IModel<String> revisionModel) {
	super(id);
	
	this.projectModel = projectModel;
	this.revisionModel = revisionModel;
	
	WebRequest request = (WebRequest) RequestCycle.get().getRequest();
	Cookie cookie = request.getCookie(COOKIE_SEARCH_TYPE);
	if (cookie != null) {
		try {
			option = (SearchOption) Class.forName(cookie.getValue()).newInstance();
		} catch (Exception e) {
			logger.debug("Error restoring search option from cookie", e);
		}
	}
}
 
开发者ID:jmfgdev,项目名称:gitplex-mit,代码行数:17,代码来源:AdvancedSearchPanel.java

示例4: newWebRequest

import org.apache.wicket.request.http.WebRequest; //导入依赖的package包/类
@Override
public WebRequest newWebRequest(final HttpServletRequest servletRequest, final String filterPath) {
    if(!DEMO_MODE_USING_CREDENTIALS_AS_QUERYARGS) {
        return super.newWebRequest(servletRequest, filterPath);
    } 

    // else demo mode
    try {
        final String uname = servletRequest.getParameter("user");
        if (uname != null) {
            servletRequest.getSession().invalidate();
        }
    } catch (Exception ignored) {
    }

    return super.newWebRequest(servletRequest, filterPath);
}
 
开发者ID:incodehq,项目名称:ecpcrm,代码行数:18,代码来源:EcpCrmApplication.java

示例5: newWebRequest

import org.apache.wicket.request.http.WebRequest; //导入依赖的package包/类
@Override
public WebRequest newWebRequest(HttpServletRequest servletRequest, String filterPath) {
    if(!DEMO_MODE_USING_CREDENTIALS_AS_QUERYARGS) {
        return super.newWebRequest(servletRequest, filterPath);
    } 

    // else demo mode
    try {
        String uname = servletRequest.getParameter("user");
        if (uname != null) {
            servletRequest.getSession().invalidate();
        }
    } catch (Exception e) {
    }
    WebRequest request = super.newWebRequest(servletRequest, filterPath);
    return request;
}
 
开发者ID:TesisTarjetasMejorar,项目名称:TarjetasISIS,代码行数:18,代码来源:SimpleApplication.java

示例6: SSOLogoutPage

import org.apache.wicket.request.http.WebRequest; //导入依赖的package包/类
public SSOLogoutPage() {
    WebRequest request = (WebRequest) getRequest();

    String ssoSessionId = SSOUtils.getSsoSessionIdFromCookie(request);

    if (StringUtils.hasText(ssoSessionId)) {
        sessionService.deleteSSOSession(ssoSessionId);
    }

    String subsystemIdentifier = request.getRequestParameters().getParameterValue("subsystemIdentifier").toString();

    if (StringUtils.hasText(subsystemIdentifier)) {
        UISubsystem subsystem = subsystemService.getSubsystemByName(subsystemIdentifier);
        if (subsystem != null && StringUtils.hasText(subsystem.getSubsystemUrl())) {
            SSOUtils.redirect(this, subsystem.getSubsystemUrl());
        }
    }
}
 
开发者ID:payneteasy,项目名称:superfly,代码行数:19,代码来源:SSOLogoutPage.java

示例7: onBeginRequest

import org.apache.wicket.request.http.WebRequest; //导入依赖的package包/类
@Override
public void onBeginRequest(RequestCycle cycle) {
	WebRequest request = (WebRequest) cycle.getRequest();
	String authorization = request.getHeader(AUTHORIZATION_HEADER);
	if(authorization!=null && authorization.startsWith("Basic"))
	{
		String[] pair = new String(Base64.decodeBase64(authorization.substring(6))).split(":"); 
           if (pair.length == 2) { 
               String userName = pair[0]; 
               String password = pair[1]; 
               OrientDbWebSession session = OrientDbWebSession.get();
               if(!session.signIn(userName, password))
               {
               	cycle.setMetaData(LAZY_AUTHORIZED, false);
               }
           }
	}
}
 
开发者ID:OrienteerBAP,项目名称:wicket-orientdb,代码行数:19,代码来源:LazyAuthorizationRequestCycleListener.java

示例8: onInitialize

import org.apache.wicket.request.http.WebRequest; //导入依赖的package包/类
@Override
   protected void onInitialize() {
super.onInitialize();

// configure the ajax callbacks

AjaxSettings ajax = settings.getAjax(true);

ajax.setData(String
	.format("function(term, page) { return { term: term, page:page, '%s':true, '%s':[window.location.protocol, '//', window.location.host, window.location.pathname].join('')}; }",
		WebRequest.PARAM_AJAX, WebRequest.PARAM_AJAX_BASE_URL));

ajax.setResults("function(data, page) { return data; }");

   // configure the localized strings/renderers
   getSettings().setFormatNoMatches("function() { return '" + getEscapedJsString("noMatches") + "';}");
   getSettings().setFormatInputTooShort("function(input, min) { return min - input.length == 1 ? '" + getEscapedJsString("inputTooShortSingular") + "' : '" + getEscapedJsString("inputTooShortPlural") + "'.replace('{number}', min - input.length); }");
   getSettings().setFormatSelectionTooBig("function(limit) { return limit == 1 ? '" + getEscapedJsString("selectionTooBigSingular") + "' : '" + getEscapedJsString("selectionTooBigPlural") + "'.replace('{limit}', limit); }");
   getSettings().setFormatLoadMore("function() { return '" + getEscapedJsString("loadMore") + "';}");
   getSettings().setFormatSearching("function() { return '" + getEscapedJsString("searching") + "';}");
   }
 
开发者ID:PkayJava,项目名称:pluggable,代码行数:22,代码来源:AbstractSelect2Choice.java

示例9: logout

import org.apache.wicket.request.http.WebRequest; //导入依赖的package包/类
public static void logout(final MySession mySession, final WebRequest request, final WebResponse response,
    final UserXmlPreferencesCache userXmlPreferencesCache, final MenuBuilder menuBuilder)
{
  final PFUserDO user = mySession.getUser();
  if (user != null) {
    userXmlPreferencesCache.flushToDB(user.getId());
    userXmlPreferencesCache.clear(user.getId());
    if (menuBuilder != null) {
      menuBuilder.expireMenu(user.getId());
    }
  }
  mySession.logout();
  final Cookie stayLoggedInCookie = UserFilter.getStayLoggedInCookie(WicketUtils.getHttpServletRequest(request));
  if (stayLoggedInCookie != null) {
    stayLoggedInCookie.setMaxAge(0);
    stayLoggedInCookie.setValue(null);
    stayLoggedInCookie.setPath("/");
    response.addCookie(stayLoggedInCookie);
  }
}
 
开发者ID:micromata,项目名称:projectforge-webapp,代码行数:21,代码来源:LoginPage.java

示例10: throwAmbiguousMethodsException

import org.apache.wicket.request.http.WebRequest; //导入依赖的package包/类
/**
 * Throw an exception if two o more methods have the same "score" for the
 * current request. See method selectMostSuitedMethod.
 * 
 * @param list
 *            the list of ambiguous methods.
 */
private void throwAmbiguousMethodsException(List<MethodMappingInfo> list) {
	WebRequest request = (WebRequest) RequestCycle.get().getRequest();
	String methodsNames = "";

	for (MethodMappingInfo urlMappingInfo : list) {
		if (!methodsNames.isEmpty())
			methodsNames += ", ";

		methodsNames += urlMappingInfo.getMethod().getName();
	}

	throw new WicketRuntimeException("Ambiguous methods mapped for the current request: URL '"
			+ request.getClientUrl() + "', HTTP method " + HttpUtils.getHttpMethod(request)
			+ ". " + "Mapped methods: " + methodsNames);
}
 
开发者ID:bitstorm,项目名称:Wicket-rest-annotations,代码行数:23,代码来源:AbstractRestResource.java

示例11: AbstractWebSocketProcessor

import org.apache.wicket.request.http.WebRequest; //导入依赖的package包/类
/**
 * Constructor.
 *
 * @param request
 *      the http request that was used to create the TomcatWebSocketProcessor
 * @param application
 *      the current Wicket Application
 */
public AbstractWebSocketProcessor(final HttpServletRequest request, final WebApplication application)
{
	this.sessionId = request.getSession(true).getId();

	String pageId = request.getParameter("pageId");
	resourceName = request.getParameter("resourceName");
	if (Strings.isEmpty(pageId) && Strings.isEmpty(resourceName))
	{
		throw new IllegalArgumentException("The request should have either 'pageId' or 'resourceName' parameter!");
	}
	if (Strings.isEmpty(pageId) == false)
	{
		this.pageId = Integer.parseInt(pageId, 10);
	}
	else
	{
		this.pageId = NO_PAGE_ID;
	}

	String baseUrl = request.getParameter(WebRequest.PARAM_AJAX_BASE_URL);
	Checks.notNull(baseUrl, String.format("Request parameter '%s' is required!", WebRequest.PARAM_AJAX_BASE_URL));
	this.baseUrl = Url.parse(baseUrl);

	WicketFilter wicketFilter = application.getWicketFilter();
	this.servletRequest = new ServletRequestCopy(request);

	this.application = Args.notNull(application, "application");

	this.webSocketSettings = WebSocketSettings.Holder.get(application);

	this.webRequest = webSocketSettings.newWebSocketRequest(request, wicketFilter.getFilterPath());

	this.connectionRegistry = webSocketSettings.getConnectionRegistry();

	this.connectionFilter = webSocketSettings.getConnectionFilter();
}
 
开发者ID:jmfgdev,项目名称:gitplex-mit,代码行数:45,代码来源:AbstractWebSocketProcessor.java

示例12: SourceFormatPanel

import org.apache.wicket.request.http.WebRequest; //导入依赖的package包/类
public SourceFormatPanel(String id, 
		@Nullable OptionChangeCallback indentTypeChangeCallback, 
		@Nullable OptionChangeCallback tabSizeChangeCallback, 
		@Nullable OptionChangeCallback lineWrapModeChangeCallback) {
	super(id);

	this.indentTypeChangeCallback = indentTypeChangeCallback;
	this.tabSizeChangeCallback = tabSizeChangeCallback;
	this.lineWrapModeChangeCallback = lineWrapModeChangeCallback;
	
	WebRequest request = (WebRequest) RequestCycle.get().getRequest();
	Cookie cookie = request.getCookie(COOKIE_INDENT_TYPE);
	if (cookie != null)
		indentType = cookie.getValue();
	else
		indentType = "Tabs";
	
	cookie = request.getCookie(COOKIE_TAB_SIZE);
	if (cookie != null)
		tabSize = cookie.getValue();
	else
		tabSize = "4";
	
	cookie = request.getCookie(COOKIE_LINE_WRAP_MODE);
	if (cookie != null)
		lineWrapMode = cookie.getValue();
	else
		lineWrapMode = "Soft wrap";
}
 
开发者ID:jmfgdev,项目名称:gitplex-mit,代码行数:30,代码来源:SourceFormatPanel.java

示例13: onInitialize

import org.apache.wicket.request.http.WebRequest; //导入依赖的package包/类
@Override
protected void onInitialize() {
	super.onInitialize();

	add(new DragAndDropBehavior());
	
	// configure the ajax callbacks

	AjaxSettings ajax = settings.getAjax(true);

	ajax.setData(String.format(
			"function(term, page) { return { term: term, page:page, '%s':true, '%s':[window.location.protocol, '//', window.location.host, window.location.pathname].join('')}; }",
			WebRequest.PARAM_AJAX, WebRequest.PARAM_AJAX_BASE_URL));

	ajax.setResults("function(data, page) { return data; }");

	// configure the localized strings/renderers
	getSettings().setFormatNoMatches("function() { return '" + getEscapedJsString("noMatches") + "';}");
	getSettings().setFormatInputTooShort("function(input, min) { return min - input.length == 1 ? '"
			+ getEscapedJsString("inputTooShortSingular") + "' : '" + getEscapedJsString("inputTooShortPlural")
			+ "'.replace('{number}', min - input.length); }");
	getSettings().setFormatSelectionTooBig(
			"function(limit) { return limit == 1 ? '" + getEscapedJsString("selectionTooBigSingular") + "' : '"
					+ getEscapedJsString("selectionTooBigPlural") + "'.replace('{limit}', limit); }");
	getSettings().setFormatLoadMore("function() { return '" + getEscapedJsString("loadMore") + "';}");
	getSettings().setFormatSearching("function() { return '" + getEscapedJsString("searching") + "';}");
}
 
开发者ID:jmfgdev,项目名称:gitplex-mit,代码行数:28,代码来源:AbstractSelect2Choice.java

示例14: getRecentOpened

import org.apache.wicket.request.http.WebRequest; //导入依赖的package包/类
private List<String> getRecentOpened() {
	List<String> recentOpened = new ArrayList<>();
	WebRequest request = (WebRequest) RequestCycle.get().getRequest();
	Cookie cookie = request.getCookie(COOKIE_RECENT_OPENED);
	if (cookie != null && cookie.getValue() != null) {
		try {
			String decoded = URLDecoder.decode(cookie.getValue(), Charsets.UTF_8.name());
			recentOpened.addAll(Splitter.on("\n").splitToList(decoded));
		} catch (UnsupportedEncodingException e) {
			throw new RuntimeException(e);
		}
	} 
	return recentOpened;
}
 
开发者ID:jmfgdev,项目名称:gitplex-mit,代码行数:15,代码来源:QuickSearchPanel.java

示例15: SearchOptionEditor

import org.apache.wicket.request.http.WebRequest; //导入依赖的package包/类
public SearchOptionEditor(String markupId) {
	super("searchOptions", markupId, AdvancedSearchPanel.this);
	
	WebRequest request = (WebRequest) RequestCycle.get().getRequest();
	Cookie cookie = request.getCookie(option.getClass().getName());
	if (cookie != null) {
		try {
			byte[] bytes = Base64.decode(cookie.getValue());
			option = (SearchOption) SerializationUtils.deserialize(bytes);
		} catch (Exception e) {
			logger.debug("Error restoring search option from cookie", e);
		}
	} 
}
 
开发者ID:jmfgdev,项目名称:gitplex-mit,代码行数:15,代码来源:AdvancedSearchPanel.java


注:本文中的org.apache.wicket.request.http.WebRequest类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。