Creates a new velocity page to use. With session.
160021
protected Page newPage(final HttpServletRequest req, final HttpServletResponse resp,
      final Session session, final String template) {
    final Page page = new Page(req, resp, getApplication().getVelocityEngine(), template);
    page.add("version", jarVersion);
    page.add("azkaban_name", this.name);
    page.add("azkaban_label", this.label);
    page.add("azkaban_color", this.color);
    page.add("note_type", NoteServlet.type);
    page.add("note_message", NoteServlet.message);
    page.add("note_url", NoteServlet.url);
    page.add("timezone", TimeZone.getDefault().getID());
    page.add("currentTime", (new DateTime()).getMillis());
    page.add("size", getDisplayExecutionPageSize());
    page.add("System", System.class);
    page.add("TimeUtils", TimeUtils.class);
    page.add("WebUtils", WebUtils.class);

    if (session != null && session.getUser() != null) {
      page.add("user_id", session.getUser().getUserId());
    }

    final String errorMsg = getErrorMessageFromCookie(req);
    page.add("error_message", errorMsg == null || errorMsg.isEmpty() ? "null"
        : errorMsg);
    setErrorMessageInCookie(resp, null);

    final String warnMsg = getWarnMessageFromCookie(req);
    page.add("warn_message", warnMsg == null || warnMsg.isEmpty() ? "null"
        : warnMsg);
    setWarnMessageInCookie(resp, null);

    final String successMsg = getSuccessMessageFromCookie(req);
    page.add("success_message",
        successMsg == null || successMsg.isEmpty() ? "null" : successMsg);
    setSuccessMessageInCookie(resp, null);

    // @TODO, allow more than one type of viewer. For time sake, I only install
    // the first one
    if (this.viewerPlugins != null && !this.viewerPlugins.isEmpty()) {
      page.add("viewers", this.viewerPlugins);
    }

    if (this.triggerPlugins != null && !this.triggerPlugins.isEmpty()) {
      page.add("triggerPlugins", this.triggerPlugins);
    }

    return page;
  }
33274
def new_page(self, page_number, new_chapter, **kwargs):
        """"""
        right_template = self.document.get_page_template(self, 'right')
        left_template = self.document.get_page_template(self, 'left')
        page_template = right_template if page_number % 2 else left_template
        return page_template.page(self, page_number, self.chain, new_chapter,
                                  **kwargs)
366187
protected Page newPage(final HttpServletRequest req, final HttpServletResponse resp,
      final String template) {
    final Page page = new Page(req, resp, getApplication().getVelocityEngine(), template);
    page.add("version", jarVersion);
    page.add("azkaban_name", this.name);
    page.add("azkaban_label", this.label);
    page.add("azkaban_color", this.color);
    page.add("note_type", NoteServlet.type);
    page.add("note_message", NoteServlet.message);
    page.add("note_url", NoteServlet.url);
    page.add("timezone", TimeZone.getDefault().getID());
    page.add("currentTime", (new DateTime()).getMillis());
    page.add("size", getDisplayExecutionPageSize());

    // @TODO, allow more than one type of viewer. For time sake, I only install
    // the first one
    if (this.viewerPlugins != null && !this.viewerPlugins.isEmpty()) {
      page.add("viewers", this.viewerPlugins);
      final ViewerPlugin plugin = this.viewerPlugins.get(0);
      page.add("viewerName", plugin.getPluginName());
      page.add("viewerPath", plugin.getPluginPath());
    }

    if (this.triggerPlugins != null && !this.triggerPlugins.isEmpty()) {
      page.add("triggers", this.triggerPlugins);
    }

    return page;
  }
1232333
public function CreatePage() 
	{
		parent::CreatePage(); 
	
		$this->_myWords = $this->WordCollection();
		
		$this->defaultXmlnukeDocument->addMenuItem("module:Xmlnuke.Admin.FileManagement",$this->_myWords->Value("FILEMANAGEMENT"),"");
		
		$this->_block = new XmlBlockCollection($this->_myWords->Value("FILEMANAGEMENT"), BlockPosition::Center);
		$this->setTitlePage($this->_myWords->Value("TITLE"));
		$this->setHelp($this->_myWords->Value("DESCRIPTION"));
		$this->defaultXmlnukeDocument->addXmlnukeObject($this->_block);
		
		
		//get the current folder
		$root = $this->_context->get("folder");
		
		$browser = new XmlFileBrowser($root, $this->_action, $this->_context);
		
		//SET FILEBROWSER ACESS LEVEL
		$processor = new AnydatasetFilenameProcessor("filemanagement");
		$processor->setFilenameLocation(ForceFilenameLocation::UseWhereExists );
		$anyDataSet = new AnyDataset($processor->FullQualifiedNameAndPath());

		$ignoreAdmin = false;

		$it = $anyDataSet->getIterator();
		while($it->hasNext())
		{
			$row = $it->moveNext();
			switch ($row->getField("type"))
			{
				case "INITIAL_DIR":
					$initial_dir = $row->getFieldArray("value");
					$browser->setSubFoldersPermitted($initial_dir);
					break;
				case "VALID_FILE_NEW":
					$file_new_list = $row->getFieldArray("value");
					$browser->setFileNewList($file_new_list);
					break;
				case "VALID_FILE_VIEW":
					$file_view_list = $row->getFieldArray("value");
					$browser->setFileViewList($file_view_list);
					break;
				case "VALID_FILE_EDIT":
					$file_edit_list = $row->getFieldArray("value");
					$browser->setFileEditList($file_edit_list);
					break;
				case "VALID_FILE_DELETE":
					$file_delete_list = $row->getFieldArray("value");
					$browser->setFileDeleteList($file_delete_list);
					break;
				case "VALID_FILE_UPLOAD":
					$file_upload_list = $row->getFieldArray("value");
					$browser->setFileUploadList($file_upload_list);
					break;
				case "VALID_FILE_MAX_UPLOAD":
					$file_max_upload = $row->getField("value");
					$browser->setFileMaxUpload($file_max_upload);
					break;
				case "PERMISSION":
					$browser->setFileNew($row->getField("file_new"));
					$browser->setFileView($row->getField("file_view"));
					$browser->setFileEdit($row->getField("file_edit"));
					$browser->setFileDelete($row->getField("file_delete"));
					$browser->setFileUpload($row->getField("file_upload"));
					$browser->setFolderNew($row->getField("folder_new"));
					$browser->setFolderView($row->getField("folder_view"));
					$browser->setFolderEdit($row->getField("folder_edit"));
					$browser->setFolderDelete($row->getField("folder_delete"));
					$ignoreAdmin = ($row->getField("ignore_admin")=="true");
					break;
			}
		}		
		
		if ($this->isUserAdmin() && !$ignoreAdmin)
			$browser->setUserType(FileBrownserUserType::ADMIN );
		
		$this->_block->addXmlnukeObject($browser);                                                                             
		
		return $this->defaultXmlnukeDocument->generatePage();
	}
767795
def new_request_session(config, cookies):
    """"""
    session = requests.Session()
    if cookies:
        session.cookies = cookies
    session.max_redirects = config["maxhttpredirects"]
    session.headers.update({
        "User-Agent": config["useragent"],
    })
    if config["cookiefile"]:
        for cookie in cookies.from_file(config["cookiefile"]):
            session.cookies = requests.cookies.merge_cookies(session.cookies, cookie)
    return session
846553
async function createPages({ actions: { createPage } }) {
  if (includeDevPages) {
    createPage({
      path: '/dev/logos',
      component: require.resolve('./frontend/components/development/logo-page'),
    })
  }

  categories.forEach(category => {
    const { id } = category
    createPage({
      path: `/category/${id}`,
      component: require.resolve('./frontend/components/main'),
      // `context` provided here becomes `props.pageContext` on the page.
      context: { category },
    })
  })
}
626863
public HttpSession newHttpSession(HttpServletRequest request)
    {
        Session session = newSession(request);
        session.setMaxInactiveInterval(_dftMaxIdleSecs);
        synchronized(__allSessions)
        {
            synchronized(this)
            {
              _sessions.put(session.getId(),session);
              __allSessions.add(session.getId(), session);
              if (_sessions.size() > this._maxSessions)
                  this._maxSessions = _sessions.size ();
            }
        }
        
        HttpSessionEvent event=new HttpSessionEvent(session);
        
        for(int i=0;i<_sessionListeners.size();i++)
            ((HttpSessionListener)_sessionListeners.get(i))
            .sessionCreated(event);
        
        if (getCrossContextSessionIDs())
            request.setAttribute(__NEW_SESSION_ID, session.getId());
        return session;
    }
134712
def create_page(self, space, title, body, parent_id=None, type='page'):
        
        log.info('Creating {type} "{space}" -> "{title}"'.format(space=space, title=title, type=type))
        url = 'rest/api/content/'
        data = {
            'type': type,
            'title': title,
            'space': {'key': space},
            'body': {'storage': {
                'value': body,
                'representation': 'storage'}}}
        if parent_id:
            data['ancestors'] = [{'type': type, 'id': parent_id}]
        return self.post(url, data=data)
530563
def _create_websession(self):
        """"""
        from socket import AF_INET
        from aiohttp import ClientTimeout, TCPConnector

        _LOGGER.debug('Creating web session')
        conn = TCPConnector(
            family=AF_INET,
            limit_per_host=5,
            enable_cleanup_closed=True,
        )

        # Create session object.
        session_timeout = ClientTimeout(connect=10)
        self._websession = ClientSession(connector=conn,
                                         timeout=session_timeout)
        self._supplied_websession = False
773015
function create(pageIndex) {
      var debug = document.createElement('div');
      debug.id = 'stepper' + pageIndex;
      debug.setAttribute('hidden', true);
      debug.className = 'stepper';
      stepperDiv.appendChild(debug);
      var b = document.createElement('option');
      b.textContent = 'Page ' + (pageIndex + 1);
      b.value = pageIndex;
      stepperChooser.appendChild(b);
      var initBreakPoints = breakPoints[pageIndex] || [];
      var stepper = new Stepper(debug, pageIndex, initBreakPoints);
      steppers.push(stepper);
      if (steppers.length === 1) {
        this.selectStepper(pageIndex, false);
      }
      return stepper;
    }
1302330
function createPage(ref, user) {
  const NOW = new Date().toISOString(),
    users = [userOrRobot(user)],
    meta = {
      createdAt: NOW,
      archived: false,
      published: false,
      publishTime: null,
      updateTime: null,
      urlHistory: [],
      firstPublishTime: null,
      url: '',
      title: '',
      authors: [],
      users,
      history: [{action: 'create', timestamp: NOW, users }],
      siteSlug: sitesService.getSiteFromPrefix(ref.substring(0, ref.indexOf('/_pages'))).slug
    };

  return putMeta(ref, meta);
}
1288998
protected VelocityEngine createTemplateEngine(Properties properties) {
        Properties actualProperties = properties;
        if (actualProperties == null) {
            actualProperties = new Properties();
        }

        String resourceLoader = actualProperties.getProperty(VelocityEngine.RESOURCE_LOADER);
        if (StringUtils.isBlank(resourceLoader)) {
            actualProperties.setProperty(VelocityEngine.RESOURCE_LOADER, "classpath");
            actualProperties.setProperty("classpath.resource.loader.class", ClasspathResourceLoader.class.getName());
        }

        String loggerClass = actualProperties.getProperty(VelocityEngine.RUNTIME_LOG_LOGSYSTEM_CLASS);
        if (StringUtils.isBlank(loggerClass)) {
            actualProperties.setProperty(VelocityEngine.RUNTIME_LOG_LOGSYSTEM_CLASS,
                    "org.apache.velocity.runtime.log.NullLogChute");
        }

        VelocityEngine velocity = new VelocityEngine(actualProperties);
        velocity.init();

        return velocity;
    }
739122
function setupPage( pageName ) {
         assert( pageName ).hasType( String ).isNotNull();

         publishDebugInfo( 'willLoad.page', { page: pageName } );

         return pageLoader.load( pageName )
            .then( page => {
               areaHelper = createAreaHelper( page, log );
               visibilityManager.setAreaHelper( areaHelper );

               const layoutPromise = layoutLoader.load( page.layout )
                  .then( layoutInfo => {
                     cleanUpLayout = renderLayout( pageElement, areaHelper, layoutInfo );
                  } );

               localeManager.subscribe();
               const layoutWidget = widget => layoutWidgetAdapterFor( areaHelper, widget );

               // instantiate controllers wrapped by widget adapters
               const widgetPromises = widgetsForPage( page )
                  .map( widget => 'layout' in widget ?
                     layoutWidget( widget ) :
                     widgetLoader.load( widget, {}, instanceContext ) );

               return Promise.all( [ ...widgetPromises, layoutPromise ] )
                  .then( results => results.slice( 0, -1 ) );
            } )
            .then( widgetAdapterWrappers => {
               publishDebugInfo( 'didLoad.page', { page: pageName } );

               activePage = pageName;
               activeWidgetAdapterWrappers = widgetAdapterWrappers;
            } )
            .then( localeManager.initialize )
            .then( () => {
               return eventBus.publishAndGatherReplies(
                  'beginLifecycleRequest.default', LIFECYCLE_EVENT, EVENT_OPTIONS
               );
            } )
            .then( visibilityManager.initialize )
            // Give the widgets (a little) time to settle on the event bus before $digesting and painting:
            .then( () => delay( WIDGET_ATTACH_DELAY_MS ) )
            .then( () => areaHelper.attachWidgets( activeWidgetAdapterWrappers ) );
      }
395913
function createPageHandler(page) {
        if (DEBUG && !page.phantom) inspectArgs("createPageHandler: ", page);

        phPage = page;
        var matches;

        if (option.viewportsize) {
            matches = option.viewportsize.match(/^(\d+)x(\d+)$/);
            if (matches !== null) {
                page.property("viewportSize", {width: matches[1], height: matches[2]});
            }
        }

        if (option.cliprect) {
            matches = option.cliprect.match(/^(\d+)x(\d+)x(\d+)x(\d+)$/);
            if (matches !== null) {
                page.setting("clipRect", {top: matches[1], left: matches[2],
                    width: matches[3], height: matches[4]});
            }
        }

        if (option["user-agent"]) {
            page.setting("userAgent", option["user-agent"]);
        }

        if (option.zoomfactor) {
            page.setting("zoomFactor", parseFloat(option.zoomfactor));
        }

        if (option.timeout) {
            timer = setTimeout(function () {
                var err = `capturejs: cannot access ${option.uri}: request timed out`;
                console.error(err);
                phInstance.exit();
                process.nextTick(function () { callback(err) });
            }, +option.timeout);
        }

        return page.open(option.uri);
    }
1130195
function newPage($insert = 0, $id = 0, $pos = 'after')
    {
        // if there is a state saved, then go up the stack closing them
        // then on the new page, re-open them with the right setings

        if ($this->nStateStack) {
            for ($i = $this->nStateStack; $i >= 1; $i--) {
                $this->restoreState($i);
            }
        }

        $this->numObj++;

        if ($insert) {
            // the id from the ezPdf class is the id of the contents of the page, not the page object itself
            // query that object to find the parent
            $rid = $this->objects[$id]['onPage'];
            $opt = array('rid' => $rid, 'pos' => $pos);
            $this->o_page($this->numObj, 'new', $opt);
        } else {
            $this->o_page($this->numObj, 'new');
        }

        // if there is a stack saved, then put that onto the page
        if ($this->nStateStack) {
            for ($i = 1; $i <= $this->nStateStack; $i++) {
                $this->saveState($i);
            }
        }

        // and if there has been a stroke or fill color set, then transfer them
        if (isset($this->currentColor)) {
            $this->setColor($this->currentColor, true);
        }

        if (isset($this->currentStrokeColor)) {
            $this->setStrokeColor($this->currentStrokeColor, true);
        }

        // if there is a line style set, then put this in too
        if (mb_strlen($this->currentLineStyle, '8bit')) {
            $this->addContent("\n$this->currentLineStyle");
        }

        // the call to the o_page object set currentContents to the present page, so this can be returned as the page id
        return $this->currentContents;
    }
998252
def new
      @page.parent ||= Page.where(id: params['parent_id']).first
      respond_to do |format|
        format.html { render layout: false if request.xhr? }
        format.json { render json: @page }
      end
    end
197017
def create(self):
        
        plugin = CMSPlugin.objects.filter(plugin_type=self.apphook)
        if plugin.exists():
            log.debug('Plugin page for "%s" plugin already exist, ok.',
                      self.apphook)
            raise plugin

        page, created = super(CmsPluginPageCreator, self).create()

        if created:
            # Add a plugin with content in all languages to the created page.
            # But only on new created page
            for placeholder_slot in self.placeholder_slots:
                self.fill_content(page, placeholder_slot)

        return page, created