Servlet 3.0 server specifications

Hi, i'm italian and sorry for my bad english.
I'm trying new servlet features expecially the "pluggability".(8.1.4 @WebListener)
In tutorial i can see this example:
@WebListener
public class MyListener implements ServletContextListener{
public void contextInitialized(ServletContextEvent sce) {
ServletContext sc = sce.getServletContext();
sc.addServlet("myServlet", "Sample servlet",
"foo.bar.MyServlet", null, -1);
sc.addServletMapping("myServlet", new String[] {
"/urlpattern/*" });
}however searching in API, function "addServlet" has two param instead four and "addServletMapping" daesn't exist.
I tryed with addServlet's right parameters and as I imagined, web.xml result corrupted when addServletMapping is called
how solve this problems?

solved, i found the right code
import javax.servlet.ServletContext;
import javax.servlet.ServletContextEvent;
import javax.servlet.ServletContextListener;
import javax.servlet.ServletRegistration;
import javax.servlet.annotation.WebListener;
@WebListener
public class WebXmlManager implements ServletContextListener {
     public void contextInitialized(ServletContextEvent arg0) {
          ServletContext context = arg0.getServletContext();
          ServletRegistration.Dynamic dynamic = context.addServlet("test","core.Test");
          dynamic.addMapping("/Test");
}however there isn't any way to run the Programmatic definition of component for each request? i receive this exception : "Servlets can not be added to context /app as the context has been initialised"
Edited by: Jstar on 29-ago-2011 6.55
Edited by: Jstar on 29-ago-2011 6.56

Similar Messages

  • Ignoring Http basic authentication header in wls 7.0.sp2 web service servlet (weblogic.webservice.server.servlet.WebServiceServlet)

    Hi!
    We need to implement authentication using our own methods, and the authentication
    information is provided to the web service implementation in a basic authentication
    header. The problem is, that the servlet
    weblogic.webservice.server.servlet.WebServiceServlet, which handles web services
    in
    wls 7.0.sp2, always attempts to perform authentication, if the header is present.
    Is there any way to circumvent this, because we want to implement authentication
    on our own?
    I already know two workarounds:
    The best would of course be to implement a custom security realm for our own
    authentication system. This is not an option, implementing an own security
    realm is overkill for this specific web service.
    The other way would be to route the requests by way of a custom servlet, which
    would
    remove the basic authentication header, and put the authentication info in custom
    headers, such as x-auth: <user:password>, or smthng similar, and after successful
    authentication, make a call to bea's servlet weblogic.webservice.server.servlet.WebServiceServlet.
    But still, I'd like to know if there is any way to tell bea's servlet to ignore
    the basic
    authentication header?
    Oh yeah, by the way, this is URGENT, as always. (really!! ;)
    Toni Nykanen

    Currently there is no option to turn off security check.
    I think you can use a servlet filter mapped to the URL
    of your service, instead of a proxy servlet?
    Regards,
    -manoj
    http://manojc.com
    "Toni Nykanen" <[email protected]> wrote in message
    news:3ef1577b$[email protected]..
    >
    Hi!
    We need to implement authentication using our own methods, and theauthentication
    information is provided to the web service implementation in a basicauthentication
    header. The problem is, that the servlet
    weblogic.webservice.server.servlet.WebServiceServlet, which handles webservices
    in
    wls 7.0.sp2, always attempts to perform authentication, if the header ispresent.
    Is there any way to circumvent this, because we want to implementauthentication
    on our own?
    I already know two workarounds:
    The best would of course be to implement a custom security realm for ourown
    authentication system. This is not an option, implementing an own security
    realm is overkill for this specific web service.
    The other way would be to route the requests by way of a custom servlet,which
    would
    remove the basic authentication header, and put the authentication info incustom
    headers, such as x-auth: <user:password>, or smthng similar, and aftersuccessful
    authentication, make a call to bea's servletweblogic.webservice.server.servlet.WebServiceServlet.
    >
    But still, I'd like to know if there is any way to tell bea's servlet toignore
    the basic
    authentication header?
    Oh yeah, by the way, this is URGENT, as always. (really!! ;)
    Toni Nykanen

  • Using JDO in a Servlet container/app server

    Hi,
    I was just wondering what Solarmetric recommends when using Kodo in a
    servlet container/app server. Specifically the following:
    1. Should each user session maintain a PersistenceManager or should the
    PM be created per request? I am thinking it might be expensive to
    maintain PMs across requests since you may have idle sessions and the
    PMs may hold database resources? But since PMs aren't pooled in Kodo is
    creating/closing a PM per request expensive or is it offset by Kodo's
    connection pooling?
    2. Is it advisable to store data to be displayed on a JSP by storing the
    JDO instances themselves or serializable proxies (simple data beans) of
    these objects in a user's session?
    3. If you can store the JDO instances in the session, do you need to
    make them transient instances using makeTransient() and call close() the
    PersistenceManager?
    Thanks in advance,
    Khamsouk

    These are all very good questions. There really is no one right answer to any
    of them, so I'll just try to educate you on the issues involved and you can
    make your own decision. Hopefully other people who are actually using Kodo
    in a servlet/JSP environment will chime in too.
    1. Should each user session maintain a PersistenceManager or should the
    PM be created per request? I am thinking it might be expensive to
    maintain PMs across requests since you may have idle sessions and the
    PMs may hold database resources? But since PMs aren't pooled in Kodo is
    creating/closing a PM per request expensive or is it offset by Kodo's
    connection pooling?As long as you are outside of a datastore transaction, a PM does not maintain
    any database resources. The only significant state it maintains is a soft
    cache of persistent objects that have already been instantiated. If you are
    using Kodo 2.3 RC1 and have no set the
    com.solarmetric.kodo.DefaultFetchThreshold property to -1, then some
    large collections you obtain from query results or relation traversals may be
    scrollable result sets on the back-end, in which case they obviously maintain
    some database resources.
    2. Is it advisable to store data to be displayed on a JSP by storing the
    JDO instances themselves or serializable proxies (simple data beans) of
    these objects in a user's session?
    3. If you can store the JDO instances in the session, do you need to
    make them transient instances using makeTransient() and call close() the
    PersistenceManager?I'll address these together. JDO fully supports serialization, and in fact
    I think you'll find it does so in exactly the way that you want. If you choose
    to store serialized persistent objects in the session, then during
    serialization the objects will transparently pull in all of their persistent
    state and relations, so the entire object graph is serialized. When you
    deserialize, the objects will no longer be attached to their persistence
    manager -- they will be transient.
    Another options is to store the object IDs in the session, and re-retrieve
    the persistent objects for each web request.
    One design pattern that can probably net very good performance is to maintain
    a global read-only persistence manager that you use to dereference these IDs.
    Of course, if you ever want to change an object, you'll have to re-fetch it
    in a new persistence manager, and evict it from the global manager's cache.
    I hope this helps.

  • Override web.xml With Server Specific Values

    Not sure if here or the OC4J/J2EE forum is most appropriate place for this question:
    We're currently working on migrating from the old jserv setup to 9.0.4 app server with OC4J. We have the infrastructure installed and are managing the application through Enterprise Manager. In my web.xml file I provide initialization parameters to one of my servlets using something similar to the following:
    <servlet>
    <servlet-name>util.GlobalPropertyManager</servlet-name>
    <servlet-class>util.GlobalPropertyManager</servlet-class>
    <init-param>
    <param-name>mhris.batch.outputdir</param-name>
    <param-value>d:/dev/java/mhris/defaultroot/batch/</param-value>
    </init-param>
    </servlet>
    Now, this directory path I've provided is only good on my local workstation. When I deploy to my UNIX production servers, I need to override this with a valid path depending on the server being deployed to (no, they don't all have the same directory setup, yeah it's a pain). These servers include our production boxes, development server, test, training, etc.
    Currently under JSERV, I provide server specific values in the Global Init Parameters section of my property file (don't remember why we didn't use the Servlet Init Parameters property instead). This works very well since this file is not touched when we land updates, so the values are set once for each server.
    Under OC4J, I understand that I can override the values in web.xml by using an orion-web.xml file BUT it appears that this file resides in the WAR I deploy, so each server will get the same orion-web.xml rather than maintaining its own set of values.
    Is there another .xml file I can use to provide these initalization parameters? global-web-applications.xml looked promising but I wasn't completely sure I could put values for my application in it or where exactly they should go (ie. inside the existing <web-app> section or if I should create a second one specifically for my app).
    Any ideas or will I have to reploy a different orion-web.xml file to each of my servers?
    Appreciate the assistance,
    Michael

    Michael,
    First, I would just modify the web.xml during each deployment.
    Second, I would recommend using the same relative path with the web-app context. Then, you can use the Servlet API to retrive the real path of the web-app context.
    I don't think it is necessary to use orion-web.xml or other properties files.

  • How to redirect request to a servlet on another server/context

    Hi
    I want to redirect a request came to a servlet to another servlet on another server or atlest different context on same server.
    Thanks in advance,
    --Nagesh                                                                                                                                                                                                                                                                                                                               

    Thanks but, now after rediriceting the request I am
    not getting any ServletInputStream. Getting rintime
    error as NoClassDefinitionFoundError :
    ServletInputStream.That's indicative of a problem with your classpath settings.
    DO I have to do anything the JSP
    (which submitted the request to first servlet) after
    redirecting?Nops, you shouldnt do anything after sendredirect(). The response is committed after using this method.
    ram.

  • Running a servlet in J2EE server

    Hi there! I'm sorry if I have placed the query in a wrong place, can anybody help me where can I get some step by step process of deploying a servlet in J2EE server, please help me, and your kind help will be appreciated, regards, shabeer

    hi thanks for your response Mr meadandale, well the server is Sun's J2EE1.4 server. regards

  • Cisco Prime Server Specifications

    Would anyone happen to know a good server build would be to run Cisco Prime Infrastructure for 5k in network devices.  I can only find VM information and not physcial hardware specifications in regards to this.

    Kindly check the following link (Data sheet for PI)
              http://www.cisco.com/en/US/prod/collateral/netmgtsw/ps6504/ps6528/ps12239/data_sheet_c78-729088.html
    and you can check the server specification from cisco and follow cisco recommended as best practice

  • Best Practices for Packaging and Deploying Server-Specific Configurations

    We have some server-specific properties that vary for each server. We'd
    like to have these properties collected together in their own properties
    file (either .properties or .xml is fine).
    What is the best-practices way to package and deploy an application (as an
    ear file), where each server needs some specific properties?
    We'd kind of like to have the server-specific properties file be stored
    external to the ear on the server itself, so that the production folks can
    configure each server's properties at the server. But it appears that an
    application can't access a file external to the ear, or at least we can't
    figure out the magic to do it. If there is a way to do this, please let me
    know how.
    Or do we have to build a unique ear for each server? This is possible, of
    course, but we'd prefer to build one deployment package (ear), and then
    ship that off to each server that is already configured for its specific
    environment. We have some audit requirements where we need to ensure that
    an ear that has been tested by QA is the very same ear that has been
    deployed, but if we have to build one for each server, this is not
    possible.
    Any help or pointers would be most appreciated. If this is an old issue,
    my apologies, would you please point me to any previous material to read?
    I didn't see anything after searching through this group's archives.
    Thanks much in advance,
    Paul
    Paul Hodgetts -- Principal Consultant
    Agile Logic -- www.agilelogic.com
    Consulting, Coaching, Training -- On-Site & Out-Sourced Development
    Java, J2EE, C++, OOA/D -- Agile Methods/XP/Scrum, Use Cases, UI/IA

    The one draw back to this is you have to go all the way back to ant and the
    build system to make changes. You really want these env variables to be
    late binding.
    cheers
    mbg
    "Sai S Prasad" <[email protected]> wrote in message
    news:[email protected]...
    >
    Paul,
    I have a similar situation in our project and I don't create ear filesspecific
    to the environment. I do the following:
    1) Create .properties file for every environment with the same attributename
    but different values in it. For example, I have phoneix.properties.NT,phoenix.properties.DEV,
    phoenix.properties.QA, phoenix.properties.PROD.
    2) Use Ant to compile, package and deploy the ear file
    I have a .bat file in NT and .sh for Solaris that in turn calls theant.bat or
    ant.sh respectively. For the wrapper batch file or shell script, you canpass
    the name of the environment. The wrapper batch file will copy theappropriate
    properties file to "phonenix.properties". In the ant build.xml, I alwaysrefer
    to phonenix.properties which is available all the time depending on theenvironment.
    >
    It works great and I can't think of any other flexible way. Hope thathelps.
    >
    Paul Hodgetts <[email protected]> wrote:
    We have some server-specific properties that vary for each server. We'd
    like to have these properties collected together in their own properties
    file (either .properties or .xml is fine).
    What is the best-practices way to package and deploy an application (as
    an
    ear file), where each server needs some specific properties?
    We'd kind of like to have the server-specific properties file be stored
    external to the ear on the server itself, so that the production folks
    can
    configure each server's properties at the server. But it appears that
    an
    application can't access a file external to the ear, or at least we can't
    figure out the magic to do it. If there is a way to do this, please
    let me
    know how.
    Or do we have to build a unique ear for each server? This is possible,
    of
    course, but we'd prefer to build one deployment package (ear), and then
    ship that off to each server that is already configured for its specific
    environment. We have some audit requirements where we need to ensure
    that
    an ear that has been tested by QA is the very same ear that has been
    deployed, but if we have to build one for each server, this is not
    possible.
    Any help or pointers would be most appreciated. If this is an old issue,
    my apologies, would you please point me to any previous material to read?
    I didn't see anything after searching through this group's archives.
    Thanks much in advance,
    Paul
    Paul Hodgetts -- Principal Consultant
    Agile Logic -- www.agilelogic.com
    Consulting, Coaching, Training -- On-Site & Out-Sourced Development
    Java, J2EE, C++, OOA/D -- Agile Methods/XP/Scrum, Use Cases, UI/IA

  • [svn:bz-trunk] 8910: Bug: LCDS-936 - Should have better error message in servlet log if server in services-config .xml is configured to use wrong class.

    Revision: 8910
    Author:   [email protected]
    Date:     2009-07-29 14:22:26 -0700 (Wed, 29 Jul 2009)
    Log Message:
    Bug: LCDS-936 - Should have better error message in servlet log if server in services-config.xml is configured to use wrong class.
    QA: Yes
    Doc: No
    Checkintests: Pass
    Ticket Links:
        http://bugs.adobe.com/jira/browse/LCDS-936
    Modified Paths:
        blazeds/trunk/modules/core/src/flex/messaging/MessageBrokerServlet.java

    After many hard working days.i finally found the error cause,i needed to make weblogic datasource also ADF doesnt work on internet explorer browser,it works on safary.hope it helps somebody

  • A sample server specification for Oracle RAC environment

    Hi,
        Our project has decided to change the single instance database to a RAC environment. Can any one provide a sample server specification to be analysed based on our project.
    For example minimum processor/RAM....
    Thanks

    This is the simplest installation you can get, but if you want to do a fast response file based installation, there it is.

  • Servlet in WebLogic Server 6.0

              I am trying to run a servlet from WebLogic Server 6.0
              Copied servlet class file into the following directory:
              config/mydomain/applications/
              DefaultWebApp_myserver/
              WEB-INF/classes
              Modified the web.xml file located in the config/mydomain/applications/
              DefaultWebApp_myserver/
              WEB-INF/ directory
              <web-app>
              <servlet>
              <servlet-name>
              CustLogin
              </servlet-name>
              <servlet-class>
              lawson.servlet.CustLogin
              </servlet-class>
              <init-param>
              <param-name>url</param-name>
              <param-value> http:/localhost:7001/CustLogin/custaddr.html</param-value>
              </init-param>
              </servlet>
              <servlet-mapping>
              <servlet-name>
              CustLogin
              </servlet-name>
              <url-pattern>
              /CustLogin/*
              </url-pattern>
              </servlet-mapping>
              </web-app>
              Run servlet from a Web browser with URL:
              http://localhost:7001/CustLogin
              Servlet Exception
              <<Error> <HTTP> <saluki2> <myserver> <ExecuteThread-11> <> <> <101018>
              <[WebAppServletContext(944251,DefaultWebApp_myserver)] Servlet
              failed with ServletException>
              javax.servlet.ServletException: Servlet class: 'lawson.servlet.CustLogin'
              could not be resolved - a class upon which this class depends wasn't
              found
              

    Deepak,
              Are all the classes used by CustLogin in System Classpath or under
              web-inf\classes directory?
              Kumar.
              Deepak wrote:
              > I am trying to run a servlet from WebLogic Server 6.0
              >
              > Copied servlet class file into the following directory:
              > config/mydomain/applications/
              > DefaultWebApp_myserver/
              > WEB-INF/classes
              >
              > Modified the web.xml file located in the config/mydomain/applications/
              >
              > DefaultWebApp_myserver/
              > WEB-INF/ directory
              >
              > <web-app>
              >
              > <servlet>
              > <servlet-name>
              > CustLogin
              > </servlet-name>
              > <servlet-class>
              > lawson.servlet.CustLogin
              > </servlet-class>
              > <init-param>
              > <param-name>url</param-name>
              > <param-value> http:/localhost:7001/CustLogin/custaddr.html</param-value>
              >
              > </init-param>
              > </servlet>
              >
              > <servlet-mapping>
              > <servlet-name>
              > CustLogin
              > </servlet-name>
              > <url-pattern>
              > /CustLogin/*
              > </url-pattern>
              > </servlet-mapping>
              > </web-app>
              >
              > Run servlet from a Web browser with URL:
              > http://localhost:7001/CustLogin
              >
              > Servlet Exception
              >
              > <<Error> <HTTP> <saluki2> <myserver> <ExecuteThread-11> <> <> <101018>
              > <[WebAppServletContext(944251,DefaultWebApp_myserver)] Servlet
              > failed with ServletException>
              > javax.servlet.ServletException: Servlet class: 'lawson.servlet.CustLogin'
              > could not be resolved - a class upon which this class depends wasn't
              > found
              >
              

  • How to execute servlets in j2ee server

    please help me out in running servlets in j2ee server.
    i dont know where to put my servlets class files.

    please help me out in running servlets in j2ee
    server.
    i dont know where to put my servlets class files.In your j2ee server, look for your virtual host directory (webapps, deploys...information may be found in a \conf\ directory )
    Your application have to respect the hierarchy :
    /WEB-INF/web.xml --> The Web Application Deployment Descriptor
    /WEB-INF/classes/ --> put any java class (servlet or non-servlet)
    /WEB-INF/lib/ --> put jar file (external ressource)
    *.jsp;*.html ...
    /subdir/*.jsp;*.html...
    put this hierarchy in your web apps directory
    note : You can packed the hierarchy in a WAR file(Web ARchive)
    a web.xml example :
    <web-app>
    <servlet>
    <servlet-name>
    myservlet
    </servlet-name>
    <servlet-class>
    MyFirstServlet <!-- (your servlet's class)-->
    </servlet-class>
    <servlet-mapping>
    <servlet-name>
    myservlet
    </servlet-name>
    <url-pattern>
    /myservleturl <!--(URL to call servlet) -->
    </url-pattern>
    </servlet-mapping>
    </web-app>

  • Minimum server specification

    Can someone point me to the minimum server specification for iPlanet metadirectory ver 5.1. I am running this on a Blade 100 and Netra T1 server, and need to know the specs if this is supported?

    The minimum system configuration is mostly governed by the no. and size of entries it is suppose to flow. Pls. check the Hardware Sizing section of Sun ONE Directory Server Installation and Tuning Guide.
    Kirit.

  • Can i deploy servlet to iis server..?

    Can i deploy servlet to iis server..?
    if yes.. how..?

    to deploy servlets into IIS you need to use some connector which connects IIS to tomcat. Still you have to use servlet contrainer from tomcat only (as IIS serves you only web server functionality but not servlet contrainer ). use JK Connector for this bride.

  • [svn:bz-trunk] 7643: Add app server specific excludes for jboss5 and websphere7.

    Revision: 7643
    Author:   [email protected]
    Date:     2009-06-08 13:32:14 -0700 (Mon, 08 Jun 2009)
    Log Message:
    Add app server specific excludes for jboss5 and websphere7.
    Modified Paths:
        blazeds/trunk/qa/features/excludes.properties

Maybe you are looking for

  • How to always open in full screen mode

    is there a way to always open a session in full screen mode? should i press "the full screen icon" every time???

  • Java Install error 1603 on Java 8u45

    I am having issues getting Java to Install on a Windows 7 Pro PC in a stand alone environment.  Error Code 1603.  Java is needed on this PC to be able to print shipping labels from FEDEX.com. I am trying to install using the administrator account. I

  • EJB newbie: Why getters and setters when I don't use them?

    I'd like to know why I have to write getters and setters in my bean implementaion class when I don't use them. I have SQL statements in my entity bean class that does querying and updates and I don't need to get or set individual fields of my databse

  • What dev tools are included in media kit

    Hi I am a java developer who wants to play with Solaris + java dev env for a moment I found out that JDS3 for Solaris 10 has Java Studio Creator,Java Studio Enterprise trials with it along with JES Does they all come bundled with the OS if i order a

  • Security issues with password retrieval

    Anyone who comes in physical contact with a mac can open and edit as desired, theadmin users that already exist on the machine. I wonder if there is someone who hasa proposed security measures around this problem? For example, if a company wants to u