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


Java WebRequest.getCookie方法代码示例

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


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

示例1: 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

示例2: 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

示例3: 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

示例4: 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

示例5: 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

示例6: isOutlineVisibleInitially

import org.apache.wicket.request.http.WebRequest; //导入方法依赖的package包/类
private boolean isOutlineVisibleInitially() {
	if (!symbols.isEmpty()) {
		WebRequest request = (WebRequest) RequestCycle.get().getRequest();
		Cookie cookie = request.getCookie(COOKIE_OUTLINE);
		return cookie==null || !cookie.getValue().equals("no");
	} else {
		return false;
	}
}
 
开发者ID:jmfgdev,项目名称:gitplex-mit,代码行数:10,代码来源:SourceViewPanel.java

示例7: onInitialize

import org.apache.wicket.request.http.WebRequest; //导入方法依赖的package包/类
@Override
protected void onInitialize() {
	super.onInitialize();
	
	List<PageTab> tabs = new ArrayList<>();
	tabs.add(new ProjectTab(Model.of("Files"), "fa fa-fw fa-file-text-o", 0, ProjectBlobPage.class));
	tabs.add(new ProjectTab(Model.of("Commits"), "fa fa-fw fa-ext fa-commit", 0,
			ProjectCommitsPage.class, CommitDetailPage.class));
	tabs.add(new ProjectTab(Model.of("Branches"), "fa fa-fw fa-code-fork", 
			0, ProjectBranchesPage.class));
	tabs.add(new ProjectTab(Model.of("Tags"), "fa fa-fw fa-tag", 
			0, ProjectTagsPage.class));
	
	tabs.add(new ProjectTab(Model.of("Pull Requests"), "fa fa-fw fa-ext fa-branch-compare", 
			0, RequestListPage.class, NewRequestPage.class, RequestDetailPage.class));
	
	tabs.add(new ProjectTab(Model.of("Compare"), "fa fa-fw fa-ext fa-file-diff", 0, RevisionComparePage.class));
	
	if (SecurityUtils.canManage(getProject()))
		tabs.add(new ProjectTab(Model.of("Setting"), "fa fa-fw fa-cog", 0, GeneralSettingPage.class, ProjectSettingPage.class));
	
	WebMarkupContainer sidebar = new WebMarkupContainer("sidebar");
	add(sidebar);
	
	/*
	 * Add mini class here instead of project.js as we want the sidebar to 
	 * be minimized initially even if the page takes some time to load 
	 */
	WebRequest request = (WebRequest) RequestCycle.get().getRequest();
	Cookie cookie = request.getCookie("project.miniSidebar");
	if (cookie != null && "yes".equals(cookie.getValue()))
		sidebar.add(AttributeAppender.append("class", " mini"));
	
	sidebar.add(new Tabbable("projectTabs", tabs));
}
 
开发者ID:jmfgdev,项目名称:gitplex-mit,代码行数:36,代码来源:ProjectPage.java

示例8: getCookie

import org.apache.wicket.request.http.WebRequest; //导入方法依赖的package包/类
public static String getCookie(String name) {
    WebRequest request = (WebRequest) RequestCycle.get().getRequest();
    Cookie cookie = request.getCookie(name);
    if (cookie == null) {
        return null;
    }
    return cookie.getValue();
}
 
开发者ID:alancnet,项目名称:artifactory,代码行数:9,代码来源:CookieUtils.java

示例9: getSsoSessionIdFromCookie

import org.apache.wicket.request.http.WebRequest; //导入方法依赖的package包/类
public static String getSsoSessionIdFromCookie(WebRequest request) {
    String ssoSessionId = null;
    Cookie cookie = request.getCookie(SSOUtils.SSO_SESSION_ID_COOKIE_NAME);
    if (cookie != null) {
        ssoSessionId = cookie.getValue();
    }
    return ssoSessionId;
}
 
开发者ID:payneteasy,项目名称:superfly,代码行数:9,代码来源:SSOUtils.java

示例10: RevisionDiffPanel

import org.apache.wicket.request.http.WebRequest; //导入方法依赖的package包/类
public RevisionDiffPanel(String id, IModel<Project> projectModel, IModel<PullRequest> requestModel, 
		String oldRev, String newRev, IModel<String> pathFilterModel, IModel<WhitespaceOption> whitespaceOptionModel, 
		@Nullable IModel<String> blameModel, @Nullable MarkSupport markSupport) {
	super(id);
	
	this.projectModel = projectModel;
	this.requestModel = requestModel;
	this.oldRev = oldRev;
	this.newRev = newRev;
	this.pathFilterModel = pathFilterModel;
	this.blameModel = new IModel<String>() {

		@Override
		public void detach() {
			blameModel.detach();
		}

		@Override
		public String getObject() {
			return blameModel.getObject();
		}

		@Override
		public void setObject(String object) {
			AjaxRequestTarget target = RequestCycle.get().find(AjaxRequestTarget.class);
			String prevBlameFile = blameModel.getObject();
			blameModel.setObject(object);
			if (prevBlameFile != null && object != null && !prevBlameFile.equals(object)) {
				SourceAware sourceAware = getSourceAware(prevBlameFile);
				sourceAware.onUnblame(target);
			}
			target.appendJavaScript("gitplex.server.revisionDiff.reposition();");
		}
		
	};
	this.whitespaceOptionModel = whitespaceOptionModel;
	this.markSupport = markSupport;
	
	WebRequest request = (WebRequest) RequestCycle.get().getRequest();
	Cookie cookie = request.getCookie(COOKIE_VIEW_MODE);
	if (cookie == null)
		diffMode = DiffViewMode.UNIFIED;
	else
		diffMode = DiffViewMode.valueOf(cookie.getValue());
}
 
开发者ID:jmfgdev,项目名称:gitplex-mit,代码行数:46,代码来源:RevisionDiffPanel.java

示例11: extractParameterFromCookies

import org.apache.wicket.request.http.WebRequest; //导入方法依赖的package包/类
/**
 * Extract method parameter's value from cookies.
 * 
 * @param annotation
 *            the {@link CookieParam} annotation used for the current method
 *            parameter.
 * @param argClass
 *            the type of the current method parameter.
 * @return the extracted value converted to argClass.
 */
private Object extractParameterFromCookies(CookieParam cookieParam, Class<?> argClass) {
	String value = cookieParam.value();
	WebRequest webRequest = (WebRequest) RequestCycle.get().getRequest();

	if (webRequest.getCookie(value) == null)
		return null;

	return toObject(argClass, webRequest.getCookie(value).getValue());
}
 
开发者ID:bitstorm,项目名称:Wicket-rest-annotations,代码行数:20,代码来源:AbstractRestResource.java


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