jsp page not loading if another user is loading page - jboss

I have a jsp page that is performing a select and then needs to display a lot of data. It can take a minute or so to load. The issue I am having is that if another user tries to access said page, they just get a spinning browser until the first user's page has completed. I was able to duplicate this with the following test page
The page is:
<%# page isThreadSafe="false" import="java.util.*" errorPage="error2.jsp" %>
<html>
<head>
<title>Test page</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body>
<center>
<%
for (int i = 1;i <= 10000; i++) { %>
line <%=i%> <%=new Date()%><br>
<% for (int j = 1;j <= 900000; j++) {
}
}
%>
</center>
</body>
</html>
When I go to this page on two browsers at the same time, both start to spin , one will start to display the "line 1.... " data the other will continue to spin until the first one displays "line 10000..." and then the second browser will start to display.
The first and last lines of display in the first browser are:
line 1 Wed Jan 16 15:35:25 EST 2019
line 10000 Wed Jan 16 15:35:39 EST 2019
and the first and last lines of display in the second browser are:
line 1 Wed Jan 16 15:35:39 EST 2019
line 10000 Wed Jan 16 15:35:53 EST 2019
I have been able to duplicate this in JBoss 7 and in Wildfly 9. Both in standalone mode.
Is there some setting in standalone.xml that I need to set so that two JBoss/Wildfly will produce two or more instances of the same page at the same time?

It looks like it is the "isThreadSafe" page directive attribute. When I change it from false to true, the pages are displayed in multiple browsers concurrently.

Related

How to prove site has been unaltered

I have a simple site. It's one html page, and just plain text entries. The HTML is like this...
<div class='box'>
April 15, 2021
Today, I got a cat.
</div>
<div class='box'>
April 16, 2021
Today, I named the cat toby and fed him fish.
</div>
Is there a way to prove through some type of hash, that the entries have been unaltered? Like a way to prove that I never went back and changed one of the entries?

Opening hours go over midnight

Is it possible to set an opening time which goes, for example, from 22:00 to 03:00?
It’s not defined in the description of Schema.org’s openingHours. If it’s not working with openingHours, does it work with the properties opens/closes from OpeningHoursSpecification?
For example like this:
<div itemprop="openingHoursSpecification" itemscope
itemtype="http://schema.org/OpeningHoursSpecification">Mo,
<link itemprop="dayOfWeek"
href="http://purl.org/goodrelations/v1#Monday" />
<meta itemprop="opens" content="22:00:00">22:00 -
<meta itemprop="closes" content="03:00:00">03:00
</div>
I don’t have any experience with this, but I would have assumed that using opens and closes like that should be fine, as their descriptions say
The opening hour of the place or service on the given day(s) of the week.
The closing hour of the place or service on the given day(s) of the week.
and on "the given day(s) of the week", the opening hour is 22:00, and the closing hour is 03:00, no matter if that’s the closing hour of the previous opening or not.
However, Martin Hepp explained in an email how OpeningHoursSpecification from his GoodRelations vocabulary should be used, and as Schema.org’s class is derived from this, it might be relevant:
I.e., opening hours that cross midnight must be broken into two chunks, one opening hour specification for the first day, then closing at 23:59:59, and one for the next day of the week, opening ant 00:00:00.
So according to this, you would have to use something (ugly) like this:
<div itemprop="openingHoursSpecification" itemscope itemtype="http://schema.org/OpeningHoursSpecification">
<link itemprop="dayOfWeek" href="http://purl.org/goodrelations/v1#Monday" />
<meta itemprop="opens" content="22:00:00">
<meta itemprop="closes" content="23:59:59">
</div>
<div itemprop="openingHoursSpecification" itemscope itemtype="http://schema.org/OpeningHoursSpecification">
<link itemprop="dayOfWeek" href="http://purl.org/goodrelations/v1#Tuesday" />
<meta itemprop="opens" content="00:00:00">
<meta itemprop="closes" content="03:00:00">
</div>
<div itemprop="openingHoursSpecification" itemscope itemtype="http://schema.org/OpeningHoursSpecification">
<link itemprop="dayOfWeek" href="http://purl.org/goodrelations/v1#Tuesday" />
<meta itemprop="opens" content="22:00:00">
<meta itemprop="closes" content="23:59:59">
</div>
(Instead of repeating it for each day, you could specify it in two OpeningHoursSpecification with multiple dayOfWeek, unless the times are different, of course.)

Selenium: different frame handling between FF and Chrome?

I have a Selenium 2.0 test system that works fine with Firefox. The pages are organized like so:
<html>
<head>
<frameset> 35,* rows
<frame> 'Header' 35 rows H x full width
<frameset> 182,* cols
<frame> 'TOC' remaining rows H x 182 cols W
<frameset> *,0,0 rows
<frame> 'Main' remaining rows H x remaining cols W
<frame> 'HiddenFrame' 0 rows H x remaining cols W
<frame> 'UploadFrame' 0 rows H x remaining cols W
(Please don't chew me out for this... I didn't write it and I can't change it. I just have to test it.)
Anyway, my code (Perl Selenium::Remote::Driver 0.17 language binding, 2.38.0 server) basically loads the page and then does a $driver->switch_to_frame(); $driver->switch_to_frame('TOC');. It works fine in Firefox, but in Chrome, after successfully loading the page, it returns "Server returned status code 204 but no data" and it's not going to the TOC (navigation) frame so I can click on links. The console error message mentions "no such frame".
Does Chrome (or Selenium using Chrome) do something different with frames? Note that these are not iframes, but old-fashioned frames. I can change the test code to do something different based on the browser model, if necessary. Thanks!
Add: here is the top-level HTML:
<html>
<head>
<frameset rows="35,*" framespacing="0" frameborder="NO" border="0">
<frame scrolling="NO" src="title.php" noresize="" name="Header" marginwidth="0" marginheight="0" frameborder="no">
<frameset cols="182,*" framespacing="2" frameborder="no" border="0">
<frame scrolling="auto" src="toc.php" name="TOC" marginwidth="2" marginheight="8" frameborder="no">
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html> ... navigation frame
<head>
<body> ... links to expand/collapse categories, and page links
</html>
</frame>
<frameset rows="*,0,0" framespacing="0" frameborder="no" border="0">
<frame src="Welcome.php" name="Main" marginwidth="2" marginheight="10" frameborder="no">
<!DOCTYPE html>
<html> ... main content
<head>
<body> ... forms, output, buttons, etc.
</html>
</frame>
<frame src="javascript:''" name="HiddenFrame" frameborder="no">
<frame src="javascript:''" name="UploadFrame" frameborder="no">
</frameset>
</frameset>
<noframes>
<body bgcolor="#fff9f1" link="#0000ff" vlink="#0000ff" alink="#0000ff">
<p> Your browser does not support frames. The Administrator supports Netscape and Internet Explorer version 4.0 or later. </p>
</body>
</noframes>
</frameset>
</html>
It's a proprietary system and scripting language (not really .php) that's not publicly accessible, so I hope that's enough to figure out what's going on. Many thanks if you can spot what Chrome doesn't like, that Firefox has no problem with. Using the suggested workaround ($ele = $driver->find_element("//frame[#name='TOC']"); $driver->switch_to_frame($ele);, I can get into the TOC frame, but I can't do the same thing for 'Main' frame.
There is no difference in the frame handling between Chrome and Firefox. I do know that sometimes you can run Firefox with "native actions" and , in theory, it might be different if you did that, but most likely it sounds like you aren't doing that. So, I may be wrong, but in both cases, I believe Selenium most likely just uses Javascript to locate the frames.
I think the only way you are going to solve this is by writing a simple test example that reproduces the issue you think you are seeing. You could share it on GitHub. Then, with that example as proof of the problem, I think people would be more willing to help.

Typo3: Sub-page Template not loading

Maybe I'm just missing something ... obviously, and so far I've googled up nothing to help.
the issue, seems simple, I'm just trying to load a "slightly" different for one Page in my Root tree. All other pages share the Root template, but I need for this one page to have a completely different kind of content and a slightly different header, thus the need for a secondary template.
I've done the following for it:
# Default PAGE object:
page = PAGE
# Define the template
page.10 = TEMPLATE
# Our template is a file
page.10.template = FILE
# Our template file is fileadmin/template/media/media.html
page.10.template.file = fileadmin/template/media/media.html
But all this leads too is a completely blank HTML upon page load. No errors, no nothing! The page source just comes up:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<!--
This website is powered by TYPO3 - inspiring people to share!
TYPO3 is a free open source Content Management Framework initially created by Kasper Skaarhoj and licensed under GNU/GPL.
TYPO3 is copyright 1998-2013 of Kasper Skaarhoj. Extensions are copyright of their respective owners.
Information and contribution at http://typo3.org/
-->
<link rel="shortcut icon" href="http://192.168.206.11/introductionpackage-6.1.0/fileadmin/template/media/favicon.ico" type="image/x-ico; charset=binary">
<link rel="icon" href="http://192.168.206.11/introductionpackage-6.1.0/fileadmin/template/media/favicon.ico" type="image/x-ico; charset=binary">
<title>Media</title>
<meta name="generator" content="TYPO3 6.1 CMS">
<link rel="stylesheet" type="text/css" href="typo3temp/stylesheet_15a396fd13.css?1369410324" media="all">
<link rel="stylesheet" type="text/css" href="fileadmin/template/style.css?1369398600" media="all">
</head>
<body>
</body>
</html>
So, I suppose the question is, how can I get a single Page to have a separate template?
A typical error can be you forgot to include the default page typoscript template because the typoscript object page in your code needs it to show the content or pull it from the database. In the template configuration of template look in the include static typoscript template and include css.styled.content.
Don't know if this is correct, but this is what I found to do.
I made my template and placed it in a specific folder. Then I did the following and it works!
# Default PAGE object:
# page = PAGE
page.10 = NULL
page.includeJSlibs.jwplayer = 1
page.includeJSlibs.jwplayer = fileadmin/template/js/jwplayer/jwplayer.js
# Define the template
page.20 = TEMPLATE
# Our template is a file
page.20.template = FILE
# Our template file is fileadmin/template/media/media.html
page.20.template.file = fileadmin/template/media/media.html
# Insert shortcut icon in the head of the website
page.shortcutIcon = fileadmin/template/media/favicon.ico
# Insert stylesheet in the head of the website
# page.stylesheet = fileadmin/template/style.css
# Work with the subpart "DOCUMENT"
# page.20.workOnSubpart = DOCUMENT
######################################################
#
# Configuration of SUBPARTS
#
######################################################
# Define the subparts, which are inside the subpart DOCUMENT
page.20.subparts {
}
######################################################
#
# Configuration of MARKERS
#
######################################################
# Define the markers inside the subpart DOCUMENT
page.20.marks {
# Load the logo
LOGO = IMAGE
LOGO.file = fileadmin/templates/images/logo.png
LOGO.altText = Mountain Top
# Menu 1 cObject
menu_1 = HMENU
}
# First level menu-object, textual
page.20.marks.menu_1.1 = TMENU
page.20.marks.marks.menu_1.1 {
# Normal state properties
NO.allWrap = <li> | </li>
# Enable active state and set properties:
ACT = 1
ACT.allWrap = <li class="active"> | </li>
}
# Second level menu-object, textual
page.20.marks.menu_1.2 = TMENU
page.20.marks.menu_1.2 {
# Normal state properties
NO.allWrap = <div class="menu1-level2-no"> | </div>
# Enable active state and set properties:
ACT = 1
ACT.allWrap = <div class="menu1-level2-act"> | </div>
}

AJAXControlToolkit TabContainer - bug in dynamically adding/removing tabs?

I am using AjaxControlToolkit version 4.1.40412.0, .NET 4.0, VS2010
Using the TabContainer control I want to add/remove tabs dynamically, but it looks like all of my dynamic changes are not persistent. Here is my scenario: I start with a tabcontainer with 1 tabpanel (hardcoded, i.e. added at design time), then dynamically I add more tabpanels and hide the original tabpanel (run time). As expected I see only the new tabpanels on the page, however any time I try to select a different tab the whole control reverts back to its design time state, i.e. only shows the original tabpanel, which was supposed to be gone and the new tabpanels are nowhere to be found. What am I missing? I guess as a workaround I can add 50 or so tabs at design time and then dynamically hide/display rather than remove/add, but this seems clunky, sloppy and unnecessary.
Here is my code if you want to duplicate the issue:
ASPX
<%# Page Language="vb" AutoEventWireup="false" CodeBehind="WebForm1.aspx.vb" Inherits="WebApplication1.WebForm1" %>
<%# Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="asp" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:ToolkitScriptManager ID="ToolkitScriptManager1" runat="server"/>
<asp:TabContainer ID="tcMain" runat="server" AutoPostBack="true" ScrollBars="auto" >
<asp:TabPanel ID="tbTab0" runat="server" HeaderText="Tab0"/>
</asp:TabContainer>
</div>
</form>
</body>
</html>
ASPX.VB
Public Class WebForm1
Inherits System.Web.UI.Page
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
If Not Page.IsPostBack Then
For i As Integer = 0 To 3
Dim ol As New Label
ol.Text = i.ToString
Dim oT As New AjaxControlToolkit.TabPanel
oT.Controls.Add(ol)
oT.HeaderText = i.ToString
tcMain.Tabs.Add(oT)
Next
For i As Integer = 1 To tcMain.Tabs.Count
If tcMain.Tabs(tcMain.Tabs.Count - i).HeaderText = "Tab0" Then tcMain.Tabs.RemoveAt(tcMain.Tabs.Count - i)
Next
End If
End Sub
End Class
Note: If you comment out "If Not Page.IsPostBack Then" , i.e. run the code under it on every page load, the tabcontainer works as expected - I can select any tab without problems. In my real project this cannot be the solution though - I will be adding/removing tabs based on user input, so unless I keep a log of all changes ever made to the control I cannot load those changes every time the page loads.
You need to run your code in the page init or pre init, because by the page load, the page is already built along with the view state.