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学习笔记的更多相关文章

  1. js学习笔记:webpack基础入门(一)

    之前听说过webpack,今天想正式的接触一下,先跟着webpack的官方用户指南走: 在这里有: 如何安装webpack 如何使用webpack 如何使用loader 如何使用webpack的开发者 ...

  2. PHP-自定义模板-学习笔记

    1.  开始 这几天,看了李炎恢老师的<PHP第二季度视频>中的“章节7:创建TPL自定义模板”,做一个学习笔记,通过绘制架构图.UML类图和思维导图,来对加深理解. 2.  整体架构图 ...

  3. PHP-会员登录与注册例子解析-学习笔记

    1.开始 最近开始学习李炎恢老师的<PHP第二季度视频>中的“章节5:使用OOP注册会员”,做一个学习笔记,通过绘制基本页面流程和UML类图,来对加深理解. 2.基本页面流程 3.通过UM ...

  4. 2014年暑假c#学习笔记目录

    2014年暑假c#学习笔记 一.C#编程基础 1. c#编程基础之枚举 2. c#编程基础之函数可变参数 3. c#编程基础之字符串基础 4. c#编程基础之字符串函数 5.c#编程基础之ref.ou ...

  5. JAVA GUI编程学习笔记目录

    2014年暑假JAVA GUI编程学习笔记目录 1.JAVA之GUI编程概述 2.JAVA之GUI编程布局 3.JAVA之GUI编程Frame窗口 4.JAVA之GUI编程事件监听机制 5.JAVA之 ...

  6. seaJs学习笔记2 – seaJs组建库的使用

    原文地址:seaJs学习笔记2 – seaJs组建库的使用 我觉得学习新东西并不是会使用它就够了的,会使用仅仅代表你看懂了,理解了,二不代表你深入了,彻悟了它的精髓. 所以不断的学习将是源源不断. 最 ...

  7. CSS学习笔记

    CSS学习笔记 2016年12月15日整理 CSS基础 Chapter1 在console输入escape("宋体") ENTER 就会出现unicode编码 显示"%u ...

  8. HTML学习笔记

    HTML学习笔记 2016年12月15日整理 Chapter1 URL(scheme://host.domain:port/path/filename) scheme: 定义因特网服务的类型,常见的为 ...

  9. DirectX Graphics Infrastructure(DXGI):最佳范例 学习笔记

    今天要学习的这篇文章写的算是比较早的了,大概在DX11时代就写好了,当时龙书11版看得很潦草,并没有注意这篇文章,现在看12,觉得是跳不过去的一篇文章,地址如下: https://msdn.micro ...

随机推荐

  1. ISSCC 2017论文导读 Session 14:ENVISION: A 0.26-to-10 TOPS/W Subword-Parallel DVAFS CNN Processor in 28nm

    ENVISION: A 0.26-to-10 TOPS/W Subword-Parallel Dynamic-Voltage-Accuracy-Frequency-Scalable CNN Proce ...

  2. Cocos2d-x学习笔记(三)main方法

    0. UNREFERENCED_PARAMETER(X)避免编译器关于未引用参数的警告. 下边代码用于屏蔽单个函数的警告: #pragma warning( push ) #pragma warnin ...

  3. ORA-01940:无法删除当前已连接的用户

    当时时间比较着急,直接采取了釜底抽薪的办法——拔网线,这招很管用,再次执行drop user就成功了.考虑到以后不一定所有场合都允许你采取这种简单粗暴的办法,就在虚拟机上重现了这个报错,寻求一种较为温 ...

  4. 深入Animation,在SurfaceView中照样使用Android—Tween Animation!

    第一类:Frame By Frame 帧动画( 不推荐游戏开发中使用)             所谓帧动画,就是顺序播放事先做好的图像,类似于放电影:             分析: 此种方式类似我之 ...

  5. Java 常用对象-System类

    2017-11-02 21:41:06 System类:System 类包含一些有用的类字段和方法.它不能被实例化. *常用方法 public static void gc() 运行垃圾回收器. 调用 ...

  6. windows 命令巧用(持续更新)

    netstat -ano netstat -anvb netstat -s -p [tcp|udp|ip|icmp] # 关闭/打开防火墙 netsh firewall set opmode disa ...

  7. English trip -- Phonics 3 元音字母e

    xu言: 额...今天给我上自然拼读的maple老师 - . -和上次给我上第二集自然拼读的是同一个老师.突然考了考我上次学的内容~感觉大脑一片空白.看来review不能光说而不下苦功夫啊... 元音 ...

  8. 在 Confluence 6 中的 Jira 高级权限

    启用嵌套用户组(Enable Nested Groups) 为嵌套组启用或禁用支持. 在启用嵌套用户组之前,你需要检查你在 JIRA 服务器中的嵌套用户组是否启用了.当嵌套用户组启用成功后,你可以将一 ...

  9. ssh The authenticity of host '10.11.26.2 (10.11.26.2)' can't be established

    The authenticity of host '10.11.26.2 (10.11.26.2)' can't be established. ECDSA key fingerprint is SH ...

  10. 170301、使用Spring AOP实现MySQL数据库读写分离案例分析

    使用Spring AOP实现MySQL数据库读写分离案例分析 原创 2016-12-29 徐刘根 Java后端技术 一.前言 分布式环境下数据库的读写分离策略是解决数据库读写性能瓶颈的一个关键解决方案 ...