Note that there are some explanatory texts on larger screens.

plurals
  1. POSingle action class for multiple dynamic URIs throws exception when concurrent requesting
    primarykey
    data
    text
    <p>I've developed a web site using Struts2 as a controller and integrated it with Spring and Hibernate to do the business logic and DB stuff. The website's URIs are <a href="http://my.domian.com/URI" rel="nofollow noreferrer">http://my.domian.com/URI</a>; which {URI} is dynamically generated thorough the admin cms. The mapping of each uri to the servlet are done with help of Apache mod_rewrite, as follow: </p> <pre><code>RewriteCond %{HTTP_HOST} ^www\.domain\.com RewriteRule ^([a-zA-Z0-9_-]+)$ /dynamic\.action?f=$1 [QSA,L] </code></pre> <p>(Before any further information, is this a good and suitable approach?)</p> <p>The struts configuration is just a typically-academic one as: </p> <pre><code>&lt;package name="Default" extends="struts-default" namespace="/"&gt; ... &lt;action name="dynamic" class="DynamicContentAction"&gt; &lt;result name="index"&gt;/content/web/dynamic/index.jsp&lt;/result&gt; &lt;/action&gt; &lt;/package&gt; </code></pre> <p>DynamicContentAction is extending ActionSupport and implementing ServletRequestAware, ServletContextAware. I'm checking a couple of things (such as a current visiting language which is identified as a subdomain), looking up in the database that the requested uri is valid or not, generating that uri's content and setting a couple of runtime global variables (such as current visiting page id, layout config due to current visiting language ...) and put it on a Request object in this servlet.</p> <p>Everything looks good and even works perfectly ok, unless too many dynamic pages being requested by a single user concurrently. "Too Many" in my case is at least 9-10 pages. In this case it throws exceptions, different ones! Sometimes the HttpServletRequest request is null, sometimes ServletContext servletContext is null, some other times these are ok, but the runtime variables are null which is used in business logic or db querying.</p> <p>I've googled about it and found out that this action is being instantiated "Per Request". Isn't this so? If there is an action per request, what's wrong with this conflict or "nullability thing". Should I do some thread-like thing in that action, beyond the threading of struts?</p> <p>I'd be so appreciated if you could help me out or point me a direction.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload