focusSNS学习笔记
FocusSNS是一个社交类型的网站架构
系统的加载过程
所有的分发都从RouteController开始
@RequestMapping(value={"/", "/home"}, method=RequestMethod.GET)
public String route0() {
return "page:dashboards?path=/home";
}
@RequestMapping(value={"/", "/home"}表示的是url路径,也就是一开始打开的主页(上面的图片)
返回的路径表示对应的文件路径
WEB-INF/pages/dashboards.xml
这个页面就是我们看到的主页的XML配置
<?xml version="1.0" encoding="UTF-8"?>
<pages>
<page parent="parent/global" path="/home">
<placeholder name="mainColumn">
<widget name="eventWidget" path="/calendar/event/upcoming-view"
cache="60">
<title>即将到来的活动</title>
<prefs>
<limit>10</limit>
<categoryCodes>people,groups</categoryCodes>
</prefs>
</widget>
<widget name="topicWidget" path="/discussion/topic/recent-view">
<title>最新讨论</title>
<prefs>
<limit>10</limit>
<categoryCodes>people,groups</categoryCodes>
</prefs>
</widget>
<widget name="postWidget" path="/blog/post/recent-view">
<title>最新博文</title>
<prefs>
<limit>10</limit>
<categoryCodes>people,groups</categoryCodes>
</prefs>
</widget>
</placeholder>
<placeholder name="rightColumn">
<widget name="userWidget" path="/system/user/login-view">
<title>登录</title>
</widget>
<widget name="activityWidget" path="/stream/activity/recent-view">
<title>说了些什么...</title>
<prefs>
<limit>5</limit>
<activityTypes>user-input</activityTypes>
</prefs>
</widget>
<widget name="questionWidget" path="/knowledge/question/recent-view">
<title>问了些什么...</title>
<prefs>
<limit>5</limit>
<categoryCodes>people,groups</categoryCodes>
</prefs>
</widget>
</placeholder>
</page> <page parent="parent/global" path="/people">
<placeholder name="leftColumn">
<widget name="menuWidget" path="/system/menu/custom-menu">
<prefs>
<userRequired>true</userRequired>
<items><![CDATA[
${base}/people/all=所有成员
]]></items>
</prefs>
</widget>
<widget name="profileSearchWidget" path="/search/profile/form-view">
<title>搜索</title>
</widget>
</placeholder>
<placeholder name="mainColumn">
<widget name="profileWidget" path="/profile/profile/list-view">
<title>成员列表</title>
<prefs>
<categoryCode>people</categoryCode>
</prefs>
</widget>
</placeholder>
</page> <page parent="parent/global" path="/groups">
<placeholder name="leftColumn">
<widget name="menuWidget" path="/system/menu/custom-menu">
<prefs>
<userRequired>true</userRequired>
<items><![CDATA[
${base}/groups/form=添加圈子
${base}/groups/all=所有圈子
]]></items>
</prefs>
</widget>
<widget name="profileSearchWidget" path="/search/profile/form-view">
<title>搜索</title>
</widget>
</placeholder>
<placeholder name="mainColumn">
<widget name="profileWidget" path="/profile/profile/list-view">
<title>圈子列表</title>
<prefs>
<categoryCode>groups</categoryCode>
</prefs>
</widget>
</placeholder>
</page>
</pages>
可以看下最新博文
<widget name="postWidget" path="/blog/post/recent-view">
<title>最新博文</title>
<prefs>
<limit>10</limit>
<categoryCodes>people,groups</categoryCodes>
</prefs>
</widget>
postWidget对应的类,
/blog/post/recent-view表示对应的url 这个是通过spring的注释标识的
@Widget
@RequestMapping("/blog/post")
public class PostWidget { private LinkService linkService;
private PostService postService;
private StatisticService statisticService;
private CommentService commentService;
private PostCategoryService postCategoryService; .........
@RequestMapping("/recent-view")
public String doRecentView(Page<Post> page,
@PrefParam(required=false) String categoryCodes, @RequestAttr Project project, Model model) {
page.setPageNo(1);
page.desc("p.entered");
if(StringUtils.isNotBlank(categoryCodes)) {
List<String> codes = Arrays.asList(StringUtils.split(categoryCodes, ",")); .........
}
第二行的/blog/post和12行的/recent-view合起来就是XML中的path,
上面的函数返回值是一个字符串:
return "blog/post-recent"; 这个字符串就是后面要加载的freemaker文件:WEB-INF/views/blog/post-recent.ftl 同样的,通过同样的方式加载其他的Widget,就可以拼成整个的页面。
focusSNS学习笔记的更多相关文章
- js学习笔记:webpack基础入门(一)
之前听说过webpack,今天想正式的接触一下,先跟着webpack的官方用户指南走: 在这里有: 如何安装webpack 如何使用webpack 如何使用loader 如何使用webpack的开发者 ...
- PHP-自定义模板-学习笔记
1. 开始 这几天,看了李炎恢老师的<PHP第二季度视频>中的“章节7:创建TPL自定义模板”,做一个学习笔记,通过绘制架构图.UML类图和思维导图,来对加深理解. 2. 整体架构图 ...
- PHP-会员登录与注册例子解析-学习笔记
1.开始 最近开始学习李炎恢老师的<PHP第二季度视频>中的“章节5:使用OOP注册会员”,做一个学习笔记,通过绘制基本页面流程和UML类图,来对加深理解. 2.基本页面流程 3.通过UM ...
- 2014年暑假c#学习笔记目录
2014年暑假c#学习笔记 一.C#编程基础 1. c#编程基础之枚举 2. c#编程基础之函数可变参数 3. c#编程基础之字符串基础 4. c#编程基础之字符串函数 5.c#编程基础之ref.ou ...
- JAVA GUI编程学习笔记目录
2014年暑假JAVA GUI编程学习笔记目录 1.JAVA之GUI编程概述 2.JAVA之GUI编程布局 3.JAVA之GUI编程Frame窗口 4.JAVA之GUI编程事件监听机制 5.JAVA之 ...
- seaJs学习笔记2 – seaJs组建库的使用
原文地址:seaJs学习笔记2 – seaJs组建库的使用 我觉得学习新东西并不是会使用它就够了的,会使用仅仅代表你看懂了,理解了,二不代表你深入了,彻悟了它的精髓. 所以不断的学习将是源源不断. 最 ...
- CSS学习笔记
CSS学习笔记 2016年12月15日整理 CSS基础 Chapter1 在console输入escape("宋体") ENTER 就会出现unicode编码 显示"%u ...
- HTML学习笔记
HTML学习笔记 2016年12月15日整理 Chapter1 URL(scheme://host.domain:port/path/filename) scheme: 定义因特网服务的类型,常见的为 ...
- DirectX Graphics Infrastructure(DXGI):最佳范例 学习笔记
今天要学习的这篇文章写的算是比较早的了,大概在DX11时代就写好了,当时龙书11版看得很潦草,并没有注意这篇文章,现在看12,觉得是跳不过去的一篇文章,地址如下: https://msdn.micro ...
随机推荐
- 【附6】hystrix metrics and monitor
一.基本方式 hystrix为每一个commandKey提供了计数器 二.实现流程 https://raw.githubusercontent.com/wiki/Netflix/Hystrix/ima ...
- chromedriver下载安装
博主开发平台是win10,Python版本是3.6.最近需要用到chromedriver+selenium,下载好selenium后,pip install chromedriver,直接安装到pyt ...
- 【Cuda编程】加法归约
目录 cuda编程并行归约 AtomicAdd调用出错 gpu cpu下时间计算 加法的归约 矩阵乘法 矩阵转置 统计数目 平方和求和 分块处理 线程相邻 多block计算 cuda编程并行归约 At ...
- CSU 1808 地铁(最短路变形)
http://acm.csu.edu.cn/csuoj/problemset/problem?pid=1808 题意: Bobo 居住在大城市 ICPCCamp. ICPCCamp 有 n 个地铁站, ...
- Linux——文件处理命令简单学习总结
linux中一共有三种用户: 1: 所有者u(User) 2: 所属组g(group) 3: 其他用户o(other) linux中权限一共分三种: 1: r read 读权限 2: w write ...
- vue-cli 组件运用
// components ----- helloworld.vue <script> export default { name: 'Hellowworld', props: { //接 ...
- [VIM插件]fedora22编译vim7.4对perl组件支持的问题
在fedora22下,重新编译安装vim7.4的时,在编译perl组件支持时,出现如下错误: /bin/perl -e 'unless ( $] >= 5.005 ) { for (qw(na ...
- angular5 生命周期钩子函数
生命周期执行顺序ngOnChanges 在有输入属性的情况下才会调用,该方法接受当前和上一属性值的SimpleChanges对象.如果有输入属性,会在ngOnInit之前调用. ngOnInit 在组 ...
- JS-Object(2) 原型对象 ,prototype属性。
基础✅ prototype(✅) JS中的继承 使用JSON数据 构建对象实战 基础 关键字"this"指向了当前代码运行时的对象( 原文:the current object t ...
- 安卓本地化之SharedPreferences
SharedPreferences的本质是基于XML文件存储key-value键值对数据,通常用来存储一些简单的配置信息,用Sqlite数据库来存放并不划算,因为数据库连接跟操作等耗时大大影响了程序的 ...