Servletcontext question

If I have an array of integers in the ServletContext and I will be doing reads only on it, should this be declared as synchronized/volatile?
Also, how do I pull out that array from the ServletContext in say a function that is under the ServletContext but does not have the import javax.servlet.* and javax.servlet.http.*? Do I have to just pass the array from the servlet?
Thanks

Reme wrote:
If I have an array of integers in the ServletContext and I will be doing reads only on it, should this be declared as synchronized/volatile?Wrap it in a javabean with only a getter.
Also, how do I pull out that array from the ServletContext in say a function that is under the ServletContext but does not have the import javax.servlet.* and javax.servlet.http.*? Do I have to just pass the array from the servlet?I don't understand you. Please use the right terminology at the correct places.

Similar Messages

  • Two Questions About SSL

    When I try to stablish a secure connection (via
    https://localhost:7002/AdminMain) the console gives me this error (please
    see
    below), which is the same when I run . startWebLogic.sh to start it.
    Two questions:
    1.- What is this problem about?
    2.- Even with this error, I can see AdminMain in secure mode. Should I be
    worried about the
    error?
    I'm using Weblogic Server Manager 5.1.0 04/03/2000 17:13:23 #66825 (without
    any service pack) on a Red Hat Linux 6.2 Machine & jdk 1.2.2
    Thanks in advance
    Sergio Rios Mendoza
    Departamento de Sistemas
    Corporativo de Servicios Grupo Comercial Mexicana
    PS: this is the error:
    java.lang.UnsatisfiedLinkError: no jsafe in java.library.path
    at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1287)
    at java.lang.Runtime.loadLibrary0(Runtime.java:469)
    at java.lang.System.loadLibrary(System.java:774)
    at
    COM.rsa.jsafe.JSAFE_DeviceBuilderNative.buildObjects(JSAFE_DeviceBuilderNati
    ve.java)
    at
    COM.rsa.jsafe.JSAFE_AsymmetricCipher.getInstance(JSAFE_AsymmetricCipher.java
    at
    COM.rsa.jsafe.JSAFE_AsymmetricCipher.getInstance(JSAFE_AsymmetricCipher.java
    at weblogic.security.RSA.performOPJSafe(RSA.java:178)
    at weblogic.security.RSA.performOp(RSA.java:104)
    at weblogic.security.RSApkcs1.decrypt(RSApkcs1.java:153)
    at
    weblogic.security.SSL.ClientKeyExchange.input(ClientKeyExchange.java:132)
    at weblogic.security.SSL.Handshake.input(Handshake.java:109)
    at weblogic.security.SSL.SSLSocket.getHandshake(SSLSocket.java:928)
    at weblogic.security.SSL.SSLSocket.serverInit2(SSLSocket.java:655)
    at weblogic.security.SSL.SSLSocket.serverInit(SSLSocket.java:529)
    at weblogic.security.SSL.SSLSocket.initialize(SSLSocket.java:219)
    at
    weblogic.security.SSL.SSLSocket.performAcceptHandshake(SSLSocket.java:192)
    at
    weblogic.security.SSL.SSLSocket.getInputStream(SSLSocket.java:1001)
    at weblogic.socket.ResettableSocket.<init>(ResettableSocket.java:30)
    at
    weblogic.socket.JVMSocketManager.accept(JVMSocketManager.java:377)
    at
    weblogic.t3.srvr.ListenThread$RJVMListenRequest.execute(ListenThread.java:50
    6)
    at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:120)
    java.lang.UnsatisfiedLinkError: no jsafe in java.library.path
    at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1287)
    at java.lang.Runtime.loadLibrary0(Runtime.java:469)
    at java.lang.System.loadLibrary(System.java:774)
    at
    COM.rsa.jsafe.JSAFE_DeviceBuilderNative.buildObjects(JSAFE_DeviceBuilderNati
    ve.java)
    at
    COM.rsa.jsafe.JSAFE_AsymmetricCipher.getInstance(JSAFE_AsymmetricCipher.java
    at
    COM.rsa.jsafe.JSAFE_AsymmetricCipher.getInstance(JSAFE_AsymmetricCipher.java
    at weblogic.security.RSA.performOPJSafe(RSA.java:178)
    at weblogic.security.RSA.performOp(RSA.java:104)
    at weblogic.security.RSApkcs1.decrypt(RSApkcs1.java:153)
    at
    weblogic.security.SSL.ClientKeyExchange.input(ClientKeyExchange.java:132)
    at weblogic.security.SSL.Handshake.input(Handshake.java:109)
    at weblogic.security.SSL.SSLSocket.getHandshake(SSLSocket.java:928)
    at weblogic.security.SSL.SSLSocket.serverInit2(SSLSocket.java:655)
    at weblogic.security.SSL.SSLSocket.serverInit(SSLSocket.java:546)
    at weblogic.security.SSL.SSLSocket.initialize(SSLSocket.java:219)
    at
    weblogic.security.SSL.SSLSocket.performAcceptHandshake(SSLSocket.java:192)
    at
    weblogic.security.SSL.SSLSocket.getInputStream(SSLSocket.java:1001)
    at weblogic.socket.ResettableSocket.<init>(ResettableSocket.java:30)
    at
    weblogic.socket.JVMSocketManager.accept(JVMSocketManager.java:377)
    at
    weblogic.t3.srvr.ListenThread$RJVMListenRequest.execute(ListenThread.java:50
    6)
    at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:120)
    java.lang.UnsatisfiedLinkError: no jsafe in java.library.path
    at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1287)
    at java.lang.Runtime.loadLibrary0(Runtime.java:469)
    at java.lang.System.loadLibrary(System.java:774)
    at
    COM.rsa.jsafe.JSAFE_DeviceBuilderNative.buildObjects(JSAFE_DeviceBuilderNati
    ve.java)
    at
    COM.rsa.jsafe.JSAFE_AsymmetricCipher.getInstance(JSAFE_AsymmetricCipher.java
    at
    COM.rsa.jsafe.JSAFE_AsymmetricCipher.getInstance(JSAFE_AsymmetricCipher.java
    at weblogic.security.RSA.performOPJSafe(RSA.java:178)
    at weblogic.security.RSA.performOp(RSA.java:104)
    at weblogic.security.RSApkcs1.decrypt(RSApkcs1.java:153)
    at
    weblogic.security.SSL.ClientKeyExchange.input(ClientKeyExchange.java:132)
    at weblogic.security.SSL.Handshake.input(Handshake.java:109)
    at weblogic.security.SSL.SSLSocket.getHandshake(SSLSocket.java:928)
    at weblogic.security.SSL.SSLSocket.serverInit2(SSLSocket.java:655)
    at weblogic.security.SSL.SSLSocket.serverInit(SSLSocket.java:546)
    at weblogic.security.SSL.SSLSocket.initialize(SSLSocket.java:219)
    at
    weblogic.security.SSL.SSLSocket.performAcceptHandshake(SSLSocket.java:192)
    at
    weblogic.security.SSL.SSLSocket.getInputStream(SSLSocket.java:1001)
    at weblogic.socket.ResettableSocket.<init>(ResettableSocket.java:30)
    at
    weblogic.socket.JVMSocketManager.accept(JVMSocketManager.java:377)
    at
    weblogic.t3.srvr.ListenThread$RJVMListenRequest.execute(ListenThread.java:50
    6)
    at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:120)
    Tue Nov 14 15:31:51 CST 2000:<I> <ServletContext-General> AdminMain: init
    Tue Nov 14 15:31:54 CST 2000:<I> <ServletContext-General> servletimages:
    init
    java.lang.UnsatisfiedLinkError: no jsafe in java.library.path
    at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1287)
    at java.lang.Runtime.loadLibrary0(Runtime.java:469)
    at java.lang.System.loadLibrary(System.java:774)
    at
    COM.rsa.jsafe.JSAFE_DeviceBuilderNative.buildObjects(JSAFE_DeviceBuilderNati
    ve.java)
    at
    COM.rsa.jsafe.JSAFE_AsymmetricCipher.getInstance(JSAFE_AsymmetricCipher.java
    at
    COM.rsa.jsafe.JSAFE_AsymmetricCipher.getInstance(JSAFE_AsymmetricCipher.java
    at weblogic.security.RSA.performOPJSafe(RSA.java:178)
    at weblogic.security.RSA.performOp(RSA.java:104)
    at weblogic.security.RSApkcs1.decrypt(RSApkcs1.java:153)
    at
    weblogic.security.SSL.ClientKeyExchange.input(ClientKeyExchange.java:132)
    at weblogic.security.SSL.Handshake.input(Handshake.java:109)
    at weblogic.security.SSL.SSLSocket.getHandshake(SSLSocket.java:928)
    at weblogic.security.SSL.SSLSocket.serverInit2(SSLSocket.java:655)
    at weblogic.security.SSL.SSLSocket.serverInit(SSLSocket.java:546)
    at weblogic.security.SSL.SSLSocket.initialize(SSLSocket.java:219)
    at
    weblogic.security.SSL.SSLSocket.performAcceptHandshake(SSLSocket.java:192)
    at
    weblogic.security.SSL.SSLSocket.getInputStream(SSLSocket.java:1001)
    at weblogic.socket.ResettableSocket.<init>(ResettableSocket.java:30)
    at
    weblogic.socket.JVMSocketManager.accept(JVMSocketManager.java:377)
    at
    weblogic.t3.srvr.ListenThread$RJVMListenRequest.execute(ListenThread.java:50
    6)
    at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:120)

    When I try to stablish a secure connection (via
    https://localhost:7002/AdminMain) the console gives me this error (please
    see
    below), which is the same when I run . startWebLogic.sh to start it.
    Two questions:
    1.- What is this problem about?
    2.- Even with this error, I can see AdminMain in secure mode. Should I be
    worried about the
    error?
    I'm using Weblogic Server Manager 5.1.0 04/03/2000 17:13:23 #66825 (without
    any service pack) on a Red Hat Linux 6.2 Machine & jdk 1.2.2
    Thanks in advance
    Sergio Rios Mendoza
    Departamento de Sistemas
    Corporativo de Servicios Grupo Comercial Mexicana
    PS: this is the error:
    java.lang.UnsatisfiedLinkError: no jsafe in java.library.path
    at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1287)
    at java.lang.Runtime.loadLibrary0(Runtime.java:469)
    at java.lang.System.loadLibrary(System.java:774)
    at
    COM.rsa.jsafe.JSAFE_DeviceBuilderNative.buildObjects(JSAFE_DeviceBuilderNati
    ve.java)
    at
    COM.rsa.jsafe.JSAFE_AsymmetricCipher.getInstance(JSAFE_AsymmetricCipher.java
    at
    COM.rsa.jsafe.JSAFE_AsymmetricCipher.getInstance(JSAFE_AsymmetricCipher.java
    at weblogic.security.RSA.performOPJSafe(RSA.java:178)
    at weblogic.security.RSA.performOp(RSA.java:104)
    at weblogic.security.RSApkcs1.decrypt(RSApkcs1.java:153)
    at
    weblogic.security.SSL.ClientKeyExchange.input(ClientKeyExchange.java:132)
    at weblogic.security.SSL.Handshake.input(Handshake.java:109)
    at weblogic.security.SSL.SSLSocket.getHandshake(SSLSocket.java:928)
    at weblogic.security.SSL.SSLSocket.serverInit2(SSLSocket.java:655)
    at weblogic.security.SSL.SSLSocket.serverInit(SSLSocket.java:529)
    at weblogic.security.SSL.SSLSocket.initialize(SSLSocket.java:219)
    at
    weblogic.security.SSL.SSLSocket.performAcceptHandshake(SSLSocket.java:192)
    at
    weblogic.security.SSL.SSLSocket.getInputStream(SSLSocket.java:1001)
    at weblogic.socket.ResettableSocket.<init>(ResettableSocket.java:30)
    at
    weblogic.socket.JVMSocketManager.accept(JVMSocketManager.java:377)
    at
    weblogic.t3.srvr.ListenThread$RJVMListenRequest.execute(ListenThread.java:50
    6)
    at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:120)
    java.lang.UnsatisfiedLinkError: no jsafe in java.library.path
    at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1287)
    at java.lang.Runtime.loadLibrary0(Runtime.java:469)
    at java.lang.System.loadLibrary(System.java:774)
    at
    COM.rsa.jsafe.JSAFE_DeviceBuilderNative.buildObjects(JSAFE_DeviceBuilderNati
    ve.java)
    at
    COM.rsa.jsafe.JSAFE_AsymmetricCipher.getInstance(JSAFE_AsymmetricCipher.java
    at
    COM.rsa.jsafe.JSAFE_AsymmetricCipher.getInstance(JSAFE_AsymmetricCipher.java
    at weblogic.security.RSA.performOPJSafe(RSA.java:178)
    at weblogic.security.RSA.performOp(RSA.java:104)
    at weblogic.security.RSApkcs1.decrypt(RSApkcs1.java:153)
    at
    weblogic.security.SSL.ClientKeyExchange.input(ClientKeyExchange.java:132)
    at weblogic.security.SSL.Handshake.input(Handshake.java:109)
    at weblogic.security.SSL.SSLSocket.getHandshake(SSLSocket.java:928)
    at weblogic.security.SSL.SSLSocket.serverInit2(SSLSocket.java:655)
    at weblogic.security.SSL.SSLSocket.serverInit(SSLSocket.java:546)
    at weblogic.security.SSL.SSLSocket.initialize(SSLSocket.java:219)
    at
    weblogic.security.SSL.SSLSocket.performAcceptHandshake(SSLSocket.java:192)
    at
    weblogic.security.SSL.SSLSocket.getInputStream(SSLSocket.java:1001)
    at weblogic.socket.ResettableSocket.<init>(ResettableSocket.java:30)
    at
    weblogic.socket.JVMSocketManager.accept(JVMSocketManager.java:377)
    at
    weblogic.t3.srvr.ListenThread$RJVMListenRequest.execute(ListenThread.java:50
    6)
    at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:120)
    java.lang.UnsatisfiedLinkError: no jsafe in java.library.path
    at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1287)
    at java.lang.Runtime.loadLibrary0(Runtime.java:469)
    at java.lang.System.loadLibrary(System.java:774)
    at
    COM.rsa.jsafe.JSAFE_DeviceBuilderNative.buildObjects(JSAFE_DeviceBuilderNati
    ve.java)
    at
    COM.rsa.jsafe.JSAFE_AsymmetricCipher.getInstance(JSAFE_AsymmetricCipher.java
    at
    COM.rsa.jsafe.JSAFE_AsymmetricCipher.getInstance(JSAFE_AsymmetricCipher.java
    at weblogic.security.RSA.performOPJSafe(RSA.java:178)
    at weblogic.security.RSA.performOp(RSA.java:104)
    at weblogic.security.RSApkcs1.decrypt(RSApkcs1.java:153)
    at
    weblogic.security.SSL.ClientKeyExchange.input(ClientKeyExchange.java:132)
    at weblogic.security.SSL.Handshake.input(Handshake.java:109)
    at weblogic.security.SSL.SSLSocket.getHandshake(SSLSocket.java:928)
    at weblogic.security.SSL.SSLSocket.serverInit2(SSLSocket.java:655)
    at weblogic.security.SSL.SSLSocket.serverInit(SSLSocket.java:546)
    at weblogic.security.SSL.SSLSocket.initialize(SSLSocket.java:219)
    at
    weblogic.security.SSL.SSLSocket.performAcceptHandshake(SSLSocket.java:192)
    at
    weblogic.security.SSL.SSLSocket.getInputStream(SSLSocket.java:1001)
    at weblogic.socket.ResettableSocket.<init>(ResettableSocket.java:30)
    at
    weblogic.socket.JVMSocketManager.accept(JVMSocketManager.java:377)
    at
    weblogic.t3.srvr.ListenThread$RJVMListenRequest.execute(ListenThread.java:50
    6)
    at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:120)
    Tue Nov 14 15:31:51 CST 2000:<I> <ServletContext-General> AdminMain: init
    Tue Nov 14 15:31:54 CST 2000:<I> <ServletContext-General> servletimages:
    init
    java.lang.UnsatisfiedLinkError: no jsafe in java.library.path
    at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1287)
    at java.lang.Runtime.loadLibrary0(Runtime.java:469)
    at java.lang.System.loadLibrary(System.java:774)
    at
    COM.rsa.jsafe.JSAFE_DeviceBuilderNative.buildObjects(JSAFE_DeviceBuilderNati
    ve.java)
    at
    COM.rsa.jsafe.JSAFE_AsymmetricCipher.getInstance(JSAFE_AsymmetricCipher.java
    at
    COM.rsa.jsafe.JSAFE_AsymmetricCipher.getInstance(JSAFE_AsymmetricCipher.java
    at weblogic.security.RSA.performOPJSafe(RSA.java:178)
    at weblogic.security.RSA.performOp(RSA.java:104)
    at weblogic.security.RSApkcs1.decrypt(RSApkcs1.java:153)
    at
    weblogic.security.SSL.ClientKeyExchange.input(ClientKeyExchange.java:132)
    at weblogic.security.SSL.Handshake.input(Handshake.java:109)
    at weblogic.security.SSL.SSLSocket.getHandshake(SSLSocket.java:928)
    at weblogic.security.SSL.SSLSocket.serverInit2(SSLSocket.java:655)
    at weblogic.security.SSL.SSLSocket.serverInit(SSLSocket.java:546)
    at weblogic.security.SSL.SSLSocket.initialize(SSLSocket.java:219)
    at
    weblogic.security.SSL.SSLSocket.performAcceptHandshake(SSLSocket.java:192)
    at
    weblogic.security.SSL.SSLSocket.getInputStream(SSLSocket.java:1001)
    at weblogic.socket.ResettableSocket.<init>(ResettableSocket.java:30)
    at
    weblogic.socket.JVMSocketManager.accept(JVMSocketManager.java:377)
    at
    weblogic.t3.srvr.ListenThread$RJVMListenRequest.execute(ListenThread.java:50
    6)
    at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:120)

  • Passing Objects: ServletContext versus JNDI

    I am currently developing a Web application that uses a variation of the (often recommended) model-view-controller architecture. Specifically, I have a single Front Controller Servlet that identifies what the request is for, and then delegates processing to an appropriate RequestHandler object. As implied by the name, the RequestHandler object has access to the original HttpServletRequest object.
    In its init() method, the Front Controller Servlet prepares a pool of database connections. Each RequestHandler will obtain a connection through a DataSource object (in accordance with "best practices" for using the JDBC 2.0 Optional Extension). Then, the RequestHandler will retrieve data from the database, instantiate a Java Bean, and pass the Bean on to a corresponding JSP page for display.
    Here is my dilemma: what is the best way to make the DataSource available to the RequestHandler objects?
    Most sources suggest registering the DataSource with JNDI, but - as far as I can tell - this seems to require "administrative" access to the Web application server. For example, performing this action with Tomcat 4.0 requires modification of the server.xml file (as described at http://jakarta.apache.org/tomcat/tomcat-4.0-doc/jndi-resources-howto.html).
    I would prefer to just stuff the DataSource into the ServletContext so that it is accessible throughout my Web application. (Then my DataSource would not be accessible, via JNDI, to other applications on the same server - such as in a shared hosting environment.) However, the problem is that my helper classes - the RequestHandlers - are not Servlets or JSPs (just regular classes), and therefore do not have access to a ServletConfig and, consequently, cannot access the ServletContext. Of course, I could stuff a reference to the ServletContext in every HttpServletRequest before passing it on to the helpers, but that doesn't seem "clean."
    So, to summarize this lengthy inquiry,
    (1) How can helper classes (i.e., not Servlets) access the Web application context (ServletContext)?
    (2) What are the advantages/disadvantages to using JNDI to expose resources, versus simply storing objects in the ServletContext object, when trying to make resources available throughout a single Web application?
    Thanks!
    - Scott
    [email protected]

    Right you deal two problems:
    1 The passing of servletcontext to helper classes. You can avoid this by creating a web application and storing it in a war file. You place all your servlets/jsp/helper classes in the war file according to a given structure. Each war file has a web.xml file. The web.xml file has all mappings between names in the program and the references to the objects. The web.xml can also have references between jndi names and references using the <env-entry> tag. There is only one servletcontext per web application. You can place all the information that both helper classes and servlets use e.g. jndi references into the web.xml. It is possible for the servletcontext and helper classes to refer to the same web.xml.So you have no need to exchange a servletContext reference around. See information on servletcontext interface:
    http://java.sun.com/products/servlet/2.2/javadoc/javax/servlet/ServletContext.html
    Second the question of isolating Datasources between applications. Could you not password protect the datasources so that access is only permissible if you have the correct password? Hence you can control the use of the datasource.
    There are a number of tools to create a war application and to add jndi references to a war file.
    You can use the graphical deployment tool from Sun's J2EE implementation.
    All details for creating a war file are: http://java.sun.com/j2ee/tutorial/1_3-fcs/doc/WebComponents3.html
    There are facilites to register environment variables like DataSources using the tool - look in the J2EE tutorial under configuring web clients.
    Or you can use the packager tool found in Sun's J2EE application:
    http://java.sun.com/j2ee/j2sdkee/techdocs/guides/ejb/html/Tools7.html
    You can then port these war files onto tomcat to be hosted.
    You will need to download the J2EE implementation.
    For information on how to structure your web application and create a war file see: http://java.sun.com/j2ee/j2sdkee/techdocs/guides/ejb/html/Tools7.html
    All information to create J2EE components:
    http://developer.java.sun.com/developer/onlineTraining/J2EE/Intro/
    Hope this helps.

  • Need information abt ServletContext and ServletConfig

    i want to know the information and difference b/w in ServletContext and ServletConfig pls help me.
    Thanks&Regards
    kishore

    ServletConfig serves a very specific purpose, a means to get configuration parameters from the web.xml INTO you servlet. AFAIK, it doesn't serve much purpose beyond that...
    ServletContext provides the mechanism for a Servlet to communication with the Container. You can get path information, use it to store application wide attributes and parameters, etc.
    The two really have absolutely nothing in common. So to answer your rather vague question:
    "The difference b/w ServletContext and ServletConfig: Everything."
    Do you have a more specific question? Is there a particular thing (like maybe the fact they both have methods named getInitParameter and getInitParmaterNames....) that is confusing you?

  • ServletContext Vs Properties file

    Dear Friends,
    My question is related to optimization.
    In our Servlet application, We have to read some values
    from properties files. In this which one is better from the following
    or is there any better way of doing?
    1. Reading from the Properties file everytime required. (So for each user the Properties file have to be accessed)
    or
    2. Reading from the Properties file once in the init method of the servlet and store those in the Servlet Context variables and use it whenever required.
    Please suggest me the best way.
    Thanks in advance.
    Regards,
    Goudham

    I think the best way would be to read the property
    file one time and store it as a hashtable and the last
    modified date, stored as a Long, should be stored up
    in a Hashtable, keyed on the filename. The Properties
    should be loaded from the file only if the last
    modified time in the Hashtable is less than the last
    modified time of the file, or if the filename isn't
    found. This insures that a modification check is done
    for each Properties file individually, and that they
    are all continually up to date. Also on server
    restart, all files are reloaded since they aren't
    initially listed in the Hashtable.
    Just a opinion
    -AsheeshThanks!
    If I understand correctly, Read the Properties file once and store the Key Value pairs in a Hashtable then maintain this Hashtable in ServletContext? Is this correct?
    - Goudham

  • Newbie question... I think

    hello fellow java developers!
    I have a somewhat simple question, I think....
    I have a web application that I built in 2 parts.
    Part 1: Does some big task that takes lots of server time and acts as a resource
    Part 2: Uses the resource created in (Part 1) to achieve a task.
    Kind of like an indexer indexing a website, and a search box using the index - something similar to this...
    My question is, how can I achieve (Part 1) so that it is something that remains accessible in memory in a jsp page? Is there something I can do on the server when it boots or something? I just don't know where to put it so that it will run once and be available until the server is turned off....
    Thanks in advance!

    Certainly this is quite possible.
    If it is a shared resource accessible to all users, the best place to store it would be in ServletContext/application scope.
    So write a servlet that as part of its init() method loads the resource, and stores it into memory:
    public void init() throws ServletException{
      Object myInfo = executeBigTaskThatTakesLotsOfServerTime();
      ServletContext application = getServletConfig().getServletContext();
      application.setAttribute("resource", myInfo);
    }That will execute the action, and store the into memory accessible by all users of your web application when this Servlet is loaded.
    They can get it via <jsp:useBean scope="application"/>, <%= application.getAttribute("resource") %> or using EL ${applicationScope.resource} or even just ${resource}
    Next question - how do you make this code run at startup?
    In your web.xml - configure the servlet to <load-on-startup>
    <servlet>
         <servlet-name>MyResourceLoader</servlet-name>
         <servlet-class>com.my.ResourceLoaderServlet</servlet-class>
         <load-on-startup>1</load-on-startup>
    </servlet>You may want to start a seperate thread to do the resource loading, so you can let your server get on with starting up, but thats entirely up to you, and may result in the server being available for requests before your "indexing" service or whatever has finished. Up to you.
    Cheers,
    evnafets

  • Basic jsp and servlet question (JSP Model 2)

    Hi
    I want to make an website where i use JSP Model 2 architecture. However I got a basic question
    1. I need to separate business logic from presentation with the use of jsp and servlets. Meaning I want no html code in the servlet. Can you give a simple example of how this can be done? If I map my implementation of httpServlet to a jsp page in web.xml and override doPost() and doGet(). The calls to the jsp page comes to the servlet as it should. I want to process some methods (calling sessionbeans or similar which in turn calls entitybeans) and then show the jsp page.
    How do I show the jsp page without mixing html in the servlet as I've done below:
    doGet(HttpServletRequest req, HttpServletResponse res)
    PrintWriter p = response.getWriter();
    p.print("<html><body>Hello world</body></html>"); //I dont want to do //this, I want to display the JSP site
    doPost(HttpServletRequest req, HttpServletResponse res)
    //doSomething
    }Message was edited by:
    CbbLe

    You should treat your servlet class much like a controller, where you can then use JSP as the view. The way you achieve this is to use the forward() method in RequestDispatcher.
    Say you've got a servlet class org.yoursite.controller.YourController:
    public void doGet(HttpServletRequest req, HttpServletResponse resp)
      throws ServletException, IOException {
      //Set some value for use in the JSP file associated wth me
      req.setAttribute("greeting", "Hello world!");
      //Done with our business logic, off we go to the JSP file
      ServletContext app = getServletContext();
        RequestDispatcher disp;
        disp = app.getRequestDispatcher("/some/jsp/file.jsp);
        disp.forward(req, resp);
    }Now in your JSP file:
    <h1>Example</h1>
    <div>
      I just want to say <%= request.getAttribute("greeting") %>
    </div>Going to that servlet now executes business logic and then points to the JSP file for the view. You can forward from servlet to servlet too if needs be. The string you pass to forward() is whatever would be in the URI of the request so any <servlet-mapping> configurations in web.xml are used ;)
    There is some pretty in-depth documentation on the J2EE blueprints website, namely service-to-worker and front-controller patterns. I dare say if you're looking for this sort of code you'll want to look at the composite view pattern too (also on blueprints).

  • Access to ServletContext

    I want to read files and directories within the web application. For that I need to know the 'real path' of context directory in which the JSF application is installed.
    This information I normally get from the ServletContext:
    String filename = getServletContext().getRealPath("/WEB-INF/defs/myfile.xml");
    Question:
    How do I get the JSF servlet instance from within a backing bean?

    FacesContext context =
    FacesContext.getCurrentInstance();               
    ServletContext servletContext =
    (ServletContext)context.getExternalContext().getContex
    t();
    will work, but I am not sure if it is the right way
    of doing things, preferable I would like to just use
    the Faces context, but I create a object in a startup
    servlet but at this point the faces context does not
    seem to in initialised at this point as
    FacesContext.getCurrentInstance() returns null. There
    must be a better way of doing this????If you are creating the object in a servlet, you have access to the ServletContext via the standard means, leave the FacesContext out of it.

  • Struts question ?

    hi,
    i am using the struts framework, i have createa my own
    RequestProcessor class in order to check if the user have already loggged on.
    import javax.servlet.*;
    import javax.servlet.http.*;
    import org.apache.struts.action.*;
    public class eShoopRequestProcessor extends RequestProcessor {          
    protected boolean processPreprocess(HttpServletRequest request,                                        HttpServletResponse response) {
                   HttpSession session = request.getSession();          
    //the user has already logged on          
    if (session.getAttribute("user") != null)
                   super.processPreprocess(request,response);          
    //the user has to logon          
    else {               
    //forward to login.jsp ?          }                   }}My question is, which is the best way to forward the request to another ressource "/jsps/logon.jsp", have i to use the ServletContext ??? or ActionMappings (how to access the ActionMappings class) ???
    i have also to say that there's a global-forward defined
    in structs-config.xml...
    <global-forwards>       
    <forward name="logon" path="/jsps/logon.jsp">
    </forward>
    </global-forwards>thanks for your answer.

    This is a cross-post:
    http://forum.java.sun.com/thread.jsp?forum=4&thread=439879&tstart=0&trange=15
    It's considered rude. You don't increase your chances of getting an answer when you submit the same question to several forums. It's better to pick the appropriate one and see what happens. If you get no response, THEN it might be considered okay to send it to another forum, as long as you let people know that it's a cross-post and provide a link to the original.
    Have you tried the Struts mailing list? Those folks are pretty responsive, and you're guaranteed to get a knowledgable audience. - MOD

  • ServletContext or HttpSession??

    Hi,
    I'm a new comer to servlets and I'm developing an interface to an old xBase database.
    I intend to use connection pooling and want to set up one pool manager for the application.
    I have heard of different methods for doing this and was planning on either
    (a) inititalizing in the first page (jsp) by using the <jsp:useBean> tag with 'scope=application'
    or
    (b) using the init() method of a non http serving servlet which I configured to load on startup in the web.xml file for the app.
    The main question I have is how would the initialized pool manager be available to the other servlets/jsp pages in the application....?
    Do I put a reference to it into the session or do I use the ServletContext and store it using setAttribute()..?
    all help appreciated as I'm a little confused,
    Niall.

    Good question.
    When you declare a variable in a JSP via the jsp:useBean tag with a scope of application, the object is actually stored in the ServletContext object of the webapp. You may retrieve this value with the following code.
    In the servlet,
        PoolManager poolManager = getServletContext().getAttribute("poolManager") ;NOTE:This call will return a valid poolManager object if it is executed AFTER a JSP has been called that has the jsp:useBean tag defined earlier AND the servlet is in the same WebApp as the JSP.
    You may notice that I called getAttribute() with the same name as I used before in the jsp:useBean example. That is because the attribute stored in the ServletContext is keyed off that name. To ensure you only have one instance of your pool, keep the name the same on each JSP so you don't accidentally declare multiple connection pool objects.
    Anything else, let me know.
    Mark

  • My first two questions about SSL

    When I try to stablish a secure connection (via
    https://localhost:7002/AdminMain) the console gives me this error (please
    see
    below), which is the same when I run . startWebLogic.sh to start it.
    Two questions:
    1.- What is this problem about?
    2.- Even with this error, I can see AdminMain in secure mode. Should I be
    worried about the
    error?
    I'm using Weblogic Server Manager 5.1.0 04/03/2000 17:13:23 #66825 (without
    any service pack) on a Red Hat Linux 6.2 Machine & jdk 1.2.2
    Thanks in advance
    Sergio Rios Mendoza
    Departamento de Sistemas
    Corporativo de Servicios Grupo Comercial Mexicana
    PS: this is the error:
    java.lang.UnsatisfiedLinkError: no jsafe in java.library.path
    at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1287)
    at java.lang.Runtime.loadLibrary0(Runtime.java:469)
    at java.lang.System.loadLibrary(System.java:774)
    at
    COM.rsa.jsafe.JSAFE_DeviceBuilderNative.buildObjects(JSAFE_DeviceBuilderNati
    ve.java)
    at
    COM.rsa.jsafe.JSAFE_AsymmetricCipher.getInstance(JSAFE_AsymmetricCipher.java
    at
    COM.rsa.jsafe.JSAFE_AsymmetricCipher.getInstance(JSAFE_AsymmetricCipher.java
    at weblogic.security.RSA.performOPJSafe(RSA.java:178)
    at weblogic.security.RSA.performOp(RSA.java:104)
    at weblogic.security.RSApkcs1.decrypt(RSApkcs1.java:153)
    at
    weblogic.security.SSL.ClientKeyExchange.input(ClientKeyExchange.java:132)
    at weblogic.security.SSL.Handshake.input(Handshake.java:109)
    at weblogic.security.SSL.SSLSocket.getHandshake(SSLSocket.java:928)
    at weblogic.security.SSL.SSLSocket.serverInit2(SSLSocket.java:655)
    at weblogic.security.SSL.SSLSocket.serverInit(SSLSocket.java:529)
    at weblogic.security.SSL.SSLSocket.initialize(SSLSocket.java:219)
    at
    weblogic.security.SSL.SSLSocket.performAcceptHandshake(SSLSocket.java:192)
    at
    weblogic.security.SSL.SSLSocket.getInputStream(SSLSocket.java:1001)
    at weblogic.socket.ResettableSocket.<init>(ResettableSocket.java:30)
    at
    weblogic.socket.JVMSocketManager.accept(JVMSocketManager.java:377)
    at
    weblogic.t3.srvr.ListenThread$RJVMListenRequest.execute(ListenThread.java:50
    6)
    at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:120)
    java.lang.UnsatisfiedLinkError: no jsafe in java.library.path
    at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1287)
    at java.lang.Runtime.loadLibrary0(Runtime.java:469)
    at java.lang.System.loadLibrary(System.java:774)
    at
    COM.rsa.jsafe.JSAFE_DeviceBuilderNative.buildObjects(JSAFE_DeviceBuilderNati
    ve.java)
    at
    COM.rsa.jsafe.JSAFE_AsymmetricCipher.getInstance(JSAFE_AsymmetricCipher.java
    at
    COM.rsa.jsafe.JSAFE_AsymmetricCipher.getInstance(JSAFE_AsymmetricCipher.java
    at weblogic.security.RSA.performOPJSafe(RSA.java:178)
    at weblogic.security.RSA.performOp(RSA.java:104)
    at weblogic.security.RSApkcs1.decrypt(RSApkcs1.java:153)
    at
    weblogic.security.SSL.ClientKeyExchange.input(ClientKeyExchange.java:132)
    at weblogic.security.SSL.Handshake.input(Handshake.java:109)
    at weblogic.security.SSL.SSLSocket.getHandshake(SSLSocket.java:928)
    at weblogic.security.SSL.SSLSocket.serverInit2(SSLSocket.java:655)
    at weblogic.security.SSL.SSLSocket.serverInit(SSLSocket.java:546)
    at weblogic.security.SSL.SSLSocket.initialize(SSLSocket.java:219)
    at
    weblogic.security.SSL.SSLSocket.performAcceptHandshake(SSLSocket.java:192)
    at
    weblogic.security.SSL.SSLSocket.getInputStream(SSLSocket.java:1001)
    at weblogic.socket.ResettableSocket.<init>(ResettableSocket.java:30)
    at
    weblogic.socket.JVMSocketManager.accept(JVMSocketManager.java:377)
    at
    weblogic.t3.srvr.ListenThread$RJVMListenRequest.execute(ListenThread.java:50
    6)
    at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:120)
    java.lang.UnsatisfiedLinkError: no jsafe in java.library.path
    at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1287)
    at java.lang.Runtime.loadLibrary0(Runtime.java:469)
    at java.lang.System.loadLibrary(System.java:774)
    at
    COM.rsa.jsafe.JSAFE_DeviceBuilderNative.buildObjects(JSAFE_DeviceBuilderNati
    ve.java)
    at
    COM.rsa.jsafe.JSAFE_AsymmetricCipher.getInstance(JSAFE_AsymmetricCipher.java
    at
    COM.rsa.jsafe.JSAFE_AsymmetricCipher.getInstance(JSAFE_AsymmetricCipher.java
    at weblogic.security.RSA.performOPJSafe(RSA.java:178)
    at weblogic.security.RSA.performOp(RSA.java:104)
    at weblogic.security.RSApkcs1.decrypt(RSApkcs1.java:153)
    at
    weblogic.security.SSL.ClientKeyExchange.input(ClientKeyExchange.java:132)
    at weblogic.security.SSL.Handshake.input(Handshake.java:109)
    at weblogic.security.SSL.SSLSocket.getHandshake(SSLSocket.java:928)
    at weblogic.security.SSL.SSLSocket.serverInit2(SSLSocket.java:655)
    at weblogic.security.SSL.SSLSocket.serverInit(SSLSocket.java:546)
    at weblogic.security.SSL.SSLSocket.initialize(SSLSocket.java:219)
    at
    weblogic.security.SSL.SSLSocket.performAcceptHandshake(SSLSocket.java:192)
    at
    weblogic.security.SSL.SSLSocket.getInputStream(SSLSocket.java:1001)
    at weblogic.socket.ResettableSocket.<init>(ResettableSocket.java:30)
    at
    weblogic.socket.JVMSocketManager.accept(JVMSocketManager.java:377)
    at
    weblogic.t3.srvr.ListenThread$RJVMListenRequest.execute(ListenThread.java:50
    6)
    at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:120)
    Tue Nov 14 15:31:51 CST 2000:<I> <ServletContext-General> AdminMain: init
    Tue Nov 14 15:31:54 CST 2000:<I> <ServletContext-General> servletimages:
    init
    java.lang.UnsatisfiedLinkError: no jsafe in java.library.path
    at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1287)
    at java.lang.Runtime.loadLibrary0(Runtime.java:469)
    at java.lang.System.loadLibrary(System.java:774)
    at
    COM.rsa.jsafe.JSAFE_DeviceBuilderNative.buildObjects(JSAFE_DeviceBuilderNati
    ve.java)
    at
    COM.rsa.jsafe.JSAFE_AsymmetricCipher.getInstance(JSAFE_AsymmetricCipher.java
    at
    COM.rsa.jsafe.JSAFE_AsymmetricCipher.getInstance(JSAFE_AsymmetricCipher.java
    at weblogic.security.RSA.performOPJSafe(RSA.java:178)
    at weblogic.security.RSA.performOp(RSA.java:104)
    at weblogic.security.RSApkcs1.decrypt(RSApkcs1.java:153)
    at
    weblogic.security.SSL.ClientKeyExchange.input(ClientKeyExchange.java:132)
    at weblogic.security.SSL.Handshake.input(Handshake.java:109)
    at weblogic.security.SSL.SSLSocket.getHandshake(SSLSocket.java:928)
    at weblogic.security.SSL.SSLSocket.serverInit2(SSLSocket.java:655)
    at weblogic.security.SSL.SSLSocket.serverInit(SSLSocket.java:546)
    at weblogic.security.SSL.SSLSocket.initialize(SSLSocket.java:219)
    at
    weblogic.security.SSL.SSLSocket.performAcceptHandshake(SSLSocket.java:192)
    at
    weblogic.security.SSL.SSLSocket.getInputStream(SSLSocket.java:1001)
    at weblogic.socket.ResettableSocket.<init>(ResettableSocket.java:30)
    at
    weblogic.socket.JVMSocketManager.accept(JVMSocketManager.java:377)
    at
    weblogic.t3.srvr.ListenThread$RJVMListenRequest.execute(ListenThread.java:50
    6)
    at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:120)

    That error about "no jsafe" occurs if you have not applied any service
    pack at all ( as you have said ). Get the latest SP ( SP6 ) and it
    should go away.
    John
    Sergio Rios Mendoza wrote:
    >
    When I try to stablish a secure connection (via
    https://localhost:7002/AdminMain) the console gives me this error (please
    see
    below), which is the same when I run . startWebLogic.sh to start it.
    Two questions:
    1.- What is this problem about?
    2.- Even with this error, I can see AdminMain in secure mode. Should I be
    worried about the
    error?
    I'm using Weblogic Server Manager 5.1.0 04/03/2000 17:13:23 #66825 (without
    any service pack) on a Red Hat Linux 6.2 Machine & jdk 1.2.2
    Thanks in advance
    Sergio Rios Mendoza
    Departamento de Sistemas
    Corporativo de Servicios Grupo Comercial Mexicana
    PS: this is the error:
    java.lang.UnsatisfiedLinkError: no jsafe in java.library.path
    at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1287)
    at java.lang.Runtime.loadLibrary0(Runtime.java:469)
    at java.lang.System.loadLibrary(System.java:774)
    at
    COM.rsa.jsafe.JSAFE_DeviceBuilderNative.buildObjects(JSAFE_DeviceBuilderNati
    ve.java)
    at
    COM.rsa.jsafe.JSAFE_AsymmetricCipher.getInstance(JSAFE_AsymmetricCipher.java
    at
    COM.rsa.jsafe.JSAFE_AsymmetricCipher.getInstance(JSAFE_AsymmetricCipher.java
    at weblogic.security.RSA.performOPJSafe(RSA.java:178)
    at weblogic.security.RSA.performOp(RSA.java:104)
    at weblogic.security.RSApkcs1.decrypt(RSApkcs1.java:153)
    at
    weblogic.security.SSL.ClientKeyExchange.input(ClientKeyExchange.java:132)
    at weblogic.security.SSL.Handshake.input(Handshake.java:109)
    at weblogic.security.SSL.SSLSocket.getHandshake(SSLSocket.java:928)
    at weblogic.security.SSL.SSLSocket.serverInit2(SSLSocket.java:655)
    at weblogic.security.SSL.SSLSocket.serverInit(SSLSocket.java:529)
    at weblogic.security.SSL.SSLSocket.initialize(SSLSocket.java:219)
    at
    weblogic.security.SSL.SSLSocket.performAcceptHandshake(SSLSocket.java:192)
    at
    weblogic.security.SSL.SSLSocket.getInputStream(SSLSocket.java:1001)
    at weblogic.socket.ResettableSocket.<init>(ResettableSocket.java:30)
    at
    weblogic.socket.JVMSocketManager.accept(JVMSocketManager.java:377)
    at
    weblogic.t3.srvr.ListenThread$RJVMListenRequest.execute(ListenThread.java:50
    6)
    at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:120)
    java.lang.UnsatisfiedLinkError: no jsafe in java.library.path
    at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1287)
    at java.lang.Runtime.loadLibrary0(Runtime.java:469)
    at java.lang.System.loadLibrary(System.java:774)
    at
    COM.rsa.jsafe.JSAFE_DeviceBuilderNative.buildObjects(JSAFE_DeviceBuilderNati
    ve.java)
    at
    COM.rsa.jsafe.JSAFE_AsymmetricCipher.getInstance(JSAFE_AsymmetricCipher.java
    at
    COM.rsa.jsafe.JSAFE_AsymmetricCipher.getInstance(JSAFE_AsymmetricCipher.java
    at weblogic.security.RSA.performOPJSafe(RSA.java:178)
    at weblogic.security.RSA.performOp(RSA.java:104)
    at weblogic.security.RSApkcs1.decrypt(RSApkcs1.java:153)
    at
    weblogic.security.SSL.ClientKeyExchange.input(ClientKeyExchange.java:132)
    at weblogic.security.SSL.Handshake.input(Handshake.java:109)
    at weblogic.security.SSL.SSLSocket.getHandshake(SSLSocket.java:928)
    at weblogic.security.SSL.SSLSocket.serverInit2(SSLSocket.java:655)
    at weblogic.security.SSL.SSLSocket.serverInit(SSLSocket.java:546)
    at weblogic.security.SSL.SSLSocket.initialize(SSLSocket.java:219)
    at
    weblogic.security.SSL.SSLSocket.performAcceptHandshake(SSLSocket.java:192)
    at
    weblogic.security.SSL.SSLSocket.getInputStream(SSLSocket.java:1001)
    at weblogic.socket.ResettableSocket.<init>(ResettableSocket.java:30)
    at
    weblogic.socket.JVMSocketManager.accept(JVMSocketManager.java:377)
    at
    weblogic.t3.srvr.ListenThread$RJVMListenRequest.execute(ListenThread.java:50
    6)
    at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:120)
    java.lang.UnsatisfiedLinkError: no jsafe in java.library.path
    at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1287)
    at java.lang.Runtime.loadLibrary0(Runtime.java:469)
    at java.lang.System.loadLibrary(System.java:774)
    at
    COM.rsa.jsafe.JSAFE_DeviceBuilderNative.buildObjects(JSAFE_DeviceBuilderNati
    ve.java)
    at
    COM.rsa.jsafe.JSAFE_AsymmetricCipher.getInstance(JSAFE_AsymmetricCipher.java
    at
    COM.rsa.jsafe.JSAFE_AsymmetricCipher.getInstance(JSAFE_AsymmetricCipher.java
    at weblogic.security.RSA.performOPJSafe(RSA.java:178)
    at weblogic.security.RSA.performOp(RSA.java:104)
    at weblogic.security.RSApkcs1.decrypt(RSApkcs1.java:153)
    at
    weblogic.security.SSL.ClientKeyExchange.input(ClientKeyExchange.java:132)
    at weblogic.security.SSL.Handshake.input(Handshake.java:109)
    at weblogic.security.SSL.SSLSocket.getHandshake(SSLSocket.java:928)
    at weblogic.security.SSL.SSLSocket.serverInit2(SSLSocket.java:655)
    at weblogic.security.SSL.SSLSocket.serverInit(SSLSocket.java:546)
    at weblogic.security.SSL.SSLSocket.initialize(SSLSocket.java:219)
    at
    weblogic.security.SSL.SSLSocket.performAcceptHandshake(SSLSocket.java:192)
    at
    weblogic.security.SSL.SSLSocket.getInputStream(SSLSocket.java:1001)
    at weblogic.socket.ResettableSocket.<init>(ResettableSocket.java:30)
    at
    weblogic.socket.JVMSocketManager.accept(JVMSocketManager.java:377)
    at
    weblogic.t3.srvr.ListenThread$RJVMListenRequest.execute(ListenThread.java:50
    6)
    at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:120)
    Tue Nov 14 15:31:51 CST 2000:<I> <ServletContext-General> AdminMain: init
    Tue Nov 14 15:31:54 CST 2000:<I> <ServletContext-General> servletimages:
    init
    java.lang.UnsatisfiedLinkError: no jsafe in java.library.path
    at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1287)
    at java.lang.Runtime.loadLibrary0(Runtime.java:469)
    at java.lang.System.loadLibrary(System.java:774)
    at
    COM.rsa.jsafe.JSAFE_DeviceBuilderNative.buildObjects(JSAFE_DeviceBuilderNati
    ve.java)
    at
    COM.rsa.jsafe.JSAFE_AsymmetricCipher.getInstance(JSAFE_AsymmetricCipher.java
    at
    COM.rsa.jsafe.JSAFE_AsymmetricCipher.getInstance(JSAFE_AsymmetricCipher.java
    at weblogic.security.RSA.performOPJSafe(RSA.java:178)
    at weblogic.security.RSA.performOp(RSA.java:104)
    at weblogic.security.RSApkcs1.decrypt(RSApkcs1.java:153)
    at
    weblogic.security.SSL.ClientKeyExchange.input(ClientKeyExchange.java:132)
    at weblogic.security.SSL.Handshake.input(Handshake.java:109)
    at weblogic.security.SSL.SSLSocket.getHandshake(SSLSocket.java:928)
    at weblogic.security.SSL.SSLSocket.serverInit2(SSLSocket.java:655)
    at weblogic.security.SSL.SSLSocket.serverInit(SSLSocket.java:546)
    at weblogic.security.SSL.SSLSocket.initialize(SSLSocket.java:219)
    at
    weblogic.security.SSL.SSLSocket.performAcceptHandshake(SSLSocket.java:192)
    at
    weblogic.security.SSL.SSLSocket.getInputStream(SSLSocket.java:1001)
    at weblogic.socket.ResettableSocket.<init>(ResettableSocket.java:30)
    at
    weblogic.socket.JVMSocketManager.accept(JVMSocketManager.java:377)
    at
    weblogic.t3.srvr.ListenThread$RJVMListenRequest.execute(ListenThread.java:50
    6)
    at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:120)

  • 2 questions about authorization filter...

    Hi guys,
    i need your help to solve my question..
    i'm developing a jsf application and i've created an authorization
    filter...
    My filter must checking for each page access if a registered user is
    stored in the session,if not redirect to login page. I've a bit
    experience on servlet and filter and i've solved this question with
    this filter.
    import java.io.IOException;
    import javax.servlet.*;
    import javax.servlet.http.*;
    public class AuthorizationFilter implements Filter {
             * @uml.property name="config"
             * @uml.associationEnd
            FilterConfig config = null;
             * @uml.property name="servletContext"
             * @uml.associationEnd
            ServletContext servletContext = null;
            public AuthorizationFilter() {
            public void init(FilterConfig filterConfig) throws ServletException {
                    config = filterConfig;
                    servletContext = config.getServletContext();
            public void doFilter(ServletRequest request, ServletResponse response,
                            FilterChain chain) throws IOException, ServletException {
                    Utils.log(servletContext, "Inside the filter");
                    HttpServletRequest httpRequest = (HttpServletRequest) request;
                    HttpServletResponse httpResponse = (HttpServletResponse) response;
                    HttpSession session = httpRequest.getSession();
                    String requestPath = httpRequest.getPathInfo();
                    Visit visit = (Visit) session.getAttribute("visit");
                    if (visit == null) {
                            System.out.println("Visit Nullo");
                            session.setAttribute("originalTreeId", httpRequest
                                            .getPathInfo());
                            Utils.log(servletContext, "redirecting to "
                                            + httpRequest.getContextPath() + "/faces/Login.jsp");
                            httpResponse.sendRedirect(httpRequest.getContextPath()
                                            + "/index.jsp");
                    else {
                            chain.doFilter(request, response);
                    Utils.log(servletContext, "Exiting the filter");
            public void destroy() {
    } in my authentication bean,after user has logged in i've
    loggedIn=true;
    User newUser = new User(loginName, password,teamName, role);
    Visit visit = new Visit();
    visit.setUser(newUser);
    visit.setAuthenticationBean(this);
    visit.setLoggedIn(loggedIn);
    setVisit(visit);
    getApplication().createValueBinding("#{sessionScope.visit}").setValue(faces�Context,visit); to store values into visit object.
    and this is my logout function
    FacesContext facesContext = getFacesContext();
                    Utils.log(facesContext, "Executing AuthenticationBean.logout()");
                    HttpSession session = (HttpSession) facesContext.getExternalContext()
                                    .getSession(false);
                    session.removeAttribute("sessionScope.visit");
                    if (session != null) {
                            session.invalidate();
                    } My 2 questions are:
    1) how can i redirect to login page a user that tries to log in with
    the same data of a user stored in the session?
    2) how can i handling browser closing?I need a listener?
    Please help me,i'm trying to learn about it and i need your help.
    Thanks

    hi,
    1. use the copy - paste functions in the drop down menu.
    2. same menu, save setting as........
    DR9.

  • What is the difference between IPortalComponentContext and ServletContext ?

    1) What is the difference between IPortalComponentContext and ServletContext  or PageContext?
    2) Both IPortalComponentContext and ServletContext are Same . If Both are Same Both Can be interchangeably Used?
    3) If Both IPortalComponentContext and ServletContext are not same ,what is the specific functionality of each. I mean when is the IPortalComponentContext used and when is ServletContext is used?
    4) can any please explain the difference and functionlity of each code snippet?
    Thanks and Regards
    Prasad.Y

    Hi Prasad,
    what both contexts have in common is, that the context gives access to some resources the container provides.
    Nothing else.
    The servlet context is rather an application context of any java webapp and exists once per vm, a PortalComponentContext exists for every component and represents a view of the context in which the runtime runs the component.
    To answer your questions shortly:
    1) http://java.sun.com/j2ee/1.4/docs/api/javax/servlet/ServletContext.html
    https://media.sdn.sap.com/javadocs/preNW04/SP2/60_sp2_javadocs/runtime/com/sapportals/portal/prt/component/IPortalComponentContext.html
    2) NO!
    3) see 1)
    4) ?
    Regards, Karsten

  • Is ServletContext.setAttribute() atomic?

    If my servlet make just a call to ServletContext.setAttribute() (or session.setAttribute() ), is it a must to synchronize this single call? Assuming any two threads could execute the setAttribute() call simultaneously.
    This question come into my mine because I realize that even setting primitive double type isn't guaranteed to be done atomically by the JVM spec. Therefore, if 2 threads are modifying the same double variable at the same time, problems could happen - one thread's data get PARTIALLY overwritten by other thread..
    Now, if 2 threads simultaneously calling setAttribute() on ServletContext, would changes of one thread overwrite PARTIALLY the changes made by the other? If the call only contain atomic write operations, then one operation can completely overwrite the other one and we got no problem. But if setAttribute() contains some non-atomic operations the partial update problem could happen.

    Atomic or thread-safe? I believe the former is true whereas the latter is probably false.
    - Saish

  • General feedback, comments and questions

    Background: Written many web applications over the years (Java [cocoon, struts, home-grown frameworks], ISAPI, cgi-bin), and also worked with RAD tools like Delphi doing client/server apps. Consequently, JSF looks very interesting to me, especially when you consider .NET and Web Forms. Here are my comments/questions:
    -     The name �Request Events� is confusing. Should be �UI State Change Events� or something.
    -     Why isn't there a subclass of FacesEvent for �Request Events�?
    -     Are there any standard events that all components respond to? (i.e page lifecycle events)
    -     Is there anyway to explicitly state that a component responds to specific types of events (like the way Validators tell you what types of attributes they respond to)? What I�d like to see is the ability to generate an Events tab in the development tool, like most modern RAD environments.
    -     In order to take advantage of a central dispatching mechanism (ApplicationHandler), it would make sense for all pages to flow through the FacesServlet. Is there a pass-through mechanism that doesn�t require a response tree, or would this just be some type of application event? In other words, how does FacesServlet process requests that aren�t mapped to a component tree?
    -     Can you give us an idea about how the model references will work, and what the standard way for the application handler (and its delegates) will get a handle to a model reference will be? (i.e. session parameter).
    -     Why use UIParameters instead of attributes?
    -     I understand that grid and table display functionality is handled by standard Renderers. I still think that JSF needs to have a more complete standard suite of components as well, including grid and table components that can be bound directly to collections and ResultSets. (I know this isn�t EJB-friendly, but in reality many servlet-based applications don�t use EJB). Just requiring a UIPanel alone and the appropriate Renderers isn�t enough. I think that in order for JSF to be successful, it must have at least the standard components that .NET does.
    -     This is a minor detail, but shouldn�t there be a simple addMessage(Message message) method on the FacesContext instead of requiring you to send in null?
    -     You should be able to declaratively associate an ApplicationHandler � you shouldn�t have to add a ServletContextListener to do this.
    -     You should be able to specify a RenderKit for an entire application declaratively. This brings up the question of whether or not an application-wide context is needed (or if the JSF implementation should just subclass ServletContext).
    -     You should also be able to specify the RenderKit for a given session as well as a specific Tree.
    -     Currently, I don�t see any support for modifying the render kit in the JSP implementation. Shouldn�t this be an attribute of the <faces:usefaces> tag?
    -     I�m worried about the performance implications of this design for more complex user interfaces with many controls on a given page. I�ve seen others raise this concern as well, especially when you consider the overhead of copying component values, and constantly traversing the component tree. I recognize that there are a lot of places where object pooling can be used (Renderers, the components themselves, LifeCycle objects, etc.), but does anyone have any specific comments on how this can be achieved with minimal overhead, especially when you consider that a given application may have filters and additional logic in the ApplicationHandler (that may in turn talk to the EIS tier).
    I�m glad to see that for events, encoding, and decoding, you can either handle it directly in the component or delegate it to the proper handler (either a RequestEventHandler or a Renderer). This addresses the fact that in-house controls will likely be bound to a specific client device (at least originally).
    In general, I think this is a great move forward, and it�s one thing that we�ve been lacking for a while (there have been many non-Sun efforts on this front for a while, but we really need a standard if Java is going to remain the preferred platform for rapidly building web apps).
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    Kito D. Mann
    [email protected]
    Virtua, Inc.

    In regards to my third point:
    - Is there anyway to explicitly state that a component responds to specific types of events (like the way Validators tell you what types of attributes they respond to)? What I�d like to see is the ability to generate an Events tab in the development tool, like most modern RAD environments.
    I just realized that this is handled implicitly by the fact that all UIComponents are JavaBeans. JavaBeans supports this via EventSetDescriptors. This is what happens when you haven't worked with any GUI tool kits (like Swing) for years :-). It'll be nice to see this functionality in the servlet world.
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    Kito D. Mann
    [email protected]
    Virtua, Inc.

Maybe you are looking for

  • Scroll ball only one way-down.

    My wireless mouse scroll ball only works down and is unresponsive up. This symptom occured before and seemed to cure itself. There was a time in the past when it was intermittent. I dropped the mouse earlier today. Could it have suffered brain damage

  • Macbook pro retina hates FCPX

    Hi Guys, I run FCPX on my 2.3 ghz - 8 gig ram - macbook pro retina display laptop. I mostly use hero 3 1080p footage when editing. I must say I am seriously disapointed with the laptops performance. Doing anything feels really, really, really, laggy.

  • BI modelling documents

    Hi, Can any one send me the documents related to BI 2004s MODELING. I have the documents which are available in SDN, Please don't send it again. Can you please send it to my mail id: [email protected] Thanks in advance, Malli.

  • Format Issue Ch 246 Blue Highways in Philadelphia area

    Ch 246 Blue Highways is shown in a reduced size, letter boxed on all four sides.  Looks like the 4:3 SD video image is enclosed in a 16:9 frame and then placed in the transmitted 4:3 image.  No other channel has this issue.  This problem has existed

  • Read ADC functions at 1000Hz? (7344)

    Is it possible to read data from the ADC's on the UMI(and store it) at 1000Hz. I read somewhere on the forum saying that high speed capture is only good up to a certain rate. Obviously reading in a loop with the waitms = 1ms would not work. Any sugge