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


Java PageServlet类代码示例

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


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

示例1: handle

import com.alibaba.dubbo.container.page.PageServlet; //导入依赖的package包/类
public Page handle(URL url) {
    List<List<String>> rows = new ArrayList<List<String>>();
    for (PageHandler handler : PageServlet.getInstance().getMenus()) {
        String uri = ExtensionLoader.getExtensionLoader(PageHandler.class).getExtensionName(handler);
        Menu menu = handler.getClass().getAnnotation(Menu.class);
        List<String> row = new ArrayList<String>();
        row.add("<a href=\"" + uri + ".html\">" + menu.name() + "</a>");
        row.add(menu.desc());
        rows.add(row);
    }
    return new Page("Home", "Menus",  new String[] {"Menu Name", "Menu Desc"}, rows);
}
 
开发者ID:dachengxi,项目名称:EatDubbo,代码行数:13,代码来源:HomePageHandler.java

示例2: start

import com.alibaba.dubbo.container.page.PageServlet; //导入依赖的package包/类
public void start() {
    String serverPort = ConfigUtils.getProperty(JETTY_PORT);
    int port;
    if (serverPort == null || serverPort.length() == 0) {
        port = DEFAULT_JETTY_PORT;
    } else {
        port = Integer.parseInt(serverPort);
    }
    connector = new SelectChannelConnector();
    connector.setPort(port);
    ServletHandler handler = new ServletHandler();
    
    String resources = ConfigUtils.getProperty(JETTY_DIRECTORY);
    if (resources != null && resources.length() > 0) {
        FilterHolder resourceHolder = handler.addFilterWithMapping(ResourceFilter.class, "/*", Handler.DEFAULT);
        resourceHolder.setInitParameter("resources", resources);
    }
    
    ServletHolder pageHolder = handler.addServletWithMapping(PageServlet.class, "/*");
    pageHolder.setInitParameter("pages", ConfigUtils.getProperty(JETTY_PAGES));
    pageHolder.setInitOrder(2);
    
    Server server = new Server();
    server.addConnector(connector);
    server.addHandler(handler);
    try {
        server.start();
    } catch (Exception e) {
        throw new IllegalStateException("Failed to start jetty server on " + NetUtils.getLocalHost() + ":" + port + ", cause: " + e.getMessage(), e);
    }
}
 
开发者ID:dachengxi,项目名称:EatDubbo,代码行数:32,代码来源:JettyContainer.java

示例3: start

import com.alibaba.dubbo.container.page.PageServlet; //导入依赖的package包/类
public void start() {
    String serverPort = ConfigUtils.getProperty(JETTY_PORT);
    int port;
    if (serverPort == null || serverPort.length() == 0) {
        port = DEFAULT_JETTY_PORT;
    } else {
        port = Integer.parseInt(serverPort);
    }
    connector = new SelectChannelConnector();
    
    connector.setPort(port);
    ServletHandler handler = new ServletHandler();
    
    String resources = ConfigUtils.getProperty(JETTY_DIRECTORY);
    if (resources != null && resources.length() > 0) {
        FilterHolder resourceHolder = handler.addFilterWithMapping(ResourceFilter.class, "/*", Handler.DEFAULT);
        resourceHolder.setInitParameter("resources", resources);
    }
    
    ServletHolder pageHolder = handler.addServletWithMapping(PageServlet.class, "/*");
    pageHolder.setInitParameter("pages", ConfigUtils.getProperty(JETTY_PAGES));
    pageHolder.setInitOrder(2);
    
    Server server = new Server();
    server.addConnector(connector);
    server.addHandler(handler);
    try {
        server.start();
    } catch (Exception e) {
        throw new IllegalStateException("Failed to start jetty server on " + NetUtils.getLocalHost() + ":" + port + ", cause: " + e.getMessage(), e);
    }
}
 
开发者ID:spccold,项目名称:dubbo-comments,代码行数:33,代码来源:JettyContainer.java

示例4: handle

import com.alibaba.dubbo.container.page.PageServlet; //导入依赖的package包/类
public Page handle(URL url) {
    List<List<String>> rows = new ArrayList<List<String>>();
    for (PageHandler handler : PageServlet.getInstance().getMenus()) {
        String uri = ExtensionLoader.getExtensionLoader(PageHandler.class).getExtensionName(handler);
        Menu menu = handler.getClass().getAnnotation(Menu.class);
        List<String> row = new ArrayList<String>();
        row.add("<a href=\"" + uri + ".html\">" + menu.name() + "</a>");
        row.add(menu.desc());
        rows.add(row);
    }
    return new Page("Home", "Menus", new String[]{"Menu Name", "Menu Desc"}, rows);
}
 
开发者ID:hufeng,项目名称:dubbo2.js,代码行数:13,代码来源:HomePageHandler.java

示例5: start

import com.alibaba.dubbo.container.page.PageServlet; //导入依赖的package包/类
public void start() {
    String serverPort = ConfigUtils.getProperty(JETTY_PORT);
    int port;
    if (serverPort == null || serverPort.length() == 0) {
        port = DEFAULT_JETTY_PORT;
    } else {
        port = Integer.parseInt(serverPort);
    }
    connector = new SelectChannelConnector();
    connector.setPort(port);
    ServletHandler handler = new ServletHandler();

    String resources = ConfigUtils.getProperty(JETTY_DIRECTORY);
    if (resources != null && resources.length() > 0) {
        FilterHolder resourceHolder = handler.addFilterWithMapping(ResourceFilter.class, "/*", Handler.DEFAULT);
        resourceHolder.setInitParameter("resources", resources);
    }

    ServletHolder pageHolder = handler.addServletWithMapping(PageServlet.class, "/*");
    pageHolder.setInitParameter("pages", ConfigUtils.getProperty(JETTY_PAGES));
    pageHolder.setInitOrder(2);

    Server server = new Server();
    server.addConnector(connector);
    server.addHandler(handler);
    try {
        server.start();
    } catch (Exception e) {
        throw new IllegalStateException("Failed to start jetty server on " + NetUtils.getLocalHost() + ":" + port + ", cause: " + e.getMessage(), e);
    }
}
 
开发者ID:hufeng,项目名称:dubbo2.js,代码行数:32,代码来源:JettyContainer.java


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