Solved

Servlets priority

Posted on 2003-11-16
6
459 Views
Last Modified: 2013-11-24
Hi all
Is it possible to priorities servlets?
I have two different servlets, I want to be able to control which clients handled first.
One of the servlets is more important.
0
Comment
Question by:dannysh
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
6 Comments
 
LVL 86

Accepted Solution

by:
CEHJ earned 40 total points
ID: 9758760
The servlets will be called in the order your program flow decides. If you mean can you prioritise the order in which they load on startup then you can change the loadonstartup tag of the servlet in your web.xml. The lower the figure the earlier the load. Here's an example:

<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application
2.2//EN"
    "http://java.sun.com/j2ee/dtds/web-app_2_2.dtd">
<web-app>
 <servlet>
  <servlet-name>deegreewms</servlet-name>
  <servlet-class>org.deegree_impl.enterprise.WMSServlet</servlet-class>
  <init-param>
   <param-name>capabilities</param-name>

<param-value>file:///C:/daten/software/geotools/deegreewms/WEB-INF/xml/sample_wms_capabilities.xml</param-value>

  </init-param>
  <init-param>
   <param-name>debug</param-name>
   <param-value>ERRORS_AND_COMMENTS</param-value>
  </init-param>
  <load-on-startup>
   1
  </load-on-startup>
 </servlet>
 <servlet-mapping>
  <servlet-name>deegreewms</servlet-name>
  <url-pattern>/wms</url-pattern>
 </servlet-mapping>
</web-app>


0
 
LVL 92

Expert Comment

by:objects
ID: 9759799
Am not aware of anything to achieve that, and thinking I'm not sure how you would achive it. Generally client requests are recieved by the server sequentially and each processed seperately, they don't wait for the previous request to be handled.
What is it exactly that you'd like to do instead?
0
 
LVL 86

Expert Comment

by:CEHJ
ID: 9760025
If you're looking for a processing 'pipeline'  methodology/pattern, then a sequence of Struts Action may fit the bill
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 92

Expert Comment

by:objects
ID: 9761998
load-on-startup has nothing to do with priority of client requests.
0
 

Author Comment

by:dannysh
ID: 9762033
Hi Objects yes I know.
I close this question by mistake, sorry. I will open it again

http://www.experts-exchange.com/Programming/Programming_Languages/Java/Q_20800063.html
0
 
LVL 86

Expert Comment

by:CEHJ
ID: 9763244
>>load-on-startup has nothing to do with priority of client requests.

I hope you or dannysh didn't think that I suggested that ;-)
0

Featured Post

Learn by Doing. Anytime. Anywhere.

Do you like to learn by doing?
Our labs and exercises give you the chance to do just that: Learn by performing actions on real environments.

Hands-on, scenario-based labs give you experience on real environments provided by us so you don't have to worry about breaking anything.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

INTRODUCTION Working with files is a moderately common task in Java.  For most projects hard coding the file names, using parameters in configuration files, or using command-line arguments is sufficient.   However, when your application has vi…
In this post we will learn different types of Android Layout and some basics of an Android App.
Viewers learn about the “while” loop and how to utilize it correctly in Java. Additionally, viewers begin exploring how to include conditional statements within a while loop and avoid an endless loop. Define While Loop: Basic Example: Explanatio…
Video by: Michael
Viewers learn about how to reduce the potential repetitiveness of coding in main by developing methods to perform specific tasks for their program. Additionally, objects are introduced for the purpose of learning how to call methods in Java. Define …

728 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question