Accessing a Servlet

Hi, I'm having trouble accessing an XML datasheet which is being constantly updated whenever a infrared sensor is being tripped. I was wondering if anyone could point me in the direction of a tutorial or otherwise that could help me
Thanks
OLI

Hi,
Could you please elaborate more on your requirements so that we can guide you towards the right tutorials.
Regards.
Creator Team.

Similar Messages

  • Accessing a servlet from another class

    Not to confuse anyone too much, but here's the scenario.
    I have a servlet that calles other Java classes which perform various functions. Now can I have one of these classes access the servlet directly, without setting up a socket based connection. What I mean is can I just simply call its methods and have access to the HttpServletResponse/HttpServletRequest objects?
    Usually the servlet gets accessed via an HTTP client where then servlet will call classes it needs to access, where here I have a class accessing the servlet directly.
    I do not have the capability of running servlets at the moment so I cannot just do a quick and dirty test to see how it would be done.
    Any input would be appreciated.

    If you have a servlet that contains methods that
    aren't related to the processing of a request (except
    for initialization) then those methods are in the
    wrong place. I don't know where they should be
    instead, that depends on your design. Perhaps you
    should post some details about what you are trying to
    do here.Currently I have not written code for what I am attempting.
    What I am attempting is quite an unorthodox approach of getting server information via a servlet. However unlike your standard servlet the servlet will be accessed via a java class, rather than being invoked from a URL.
    If I had to use psuedo-code I would put it like this:
    class A{
    public void accessHeaders(){
    // access servlet HttpRequest object.
    // use the object.
    // display header info...etc.
    // main prog.
    class Test {
    public static void main(String[] a){
    A a = new A();
    a.accessHeaders();
    The servlet will be a generic servlet which overrides a doGet().
    That's right an app accessing a servlet. I have done this but using the java.net package but I don't want to use that in this case. Can I implicitely call the servlet?
    Now the more I think about doing something like this the more I feel that it cannot be done this way.
    I am new to servlets so I don't know all the ways they can be used.

  • How to access  j2ee servlet directly?

    Hi All,
    I have a question about Doc 333862.1
    My customer wants to follow test case in the CAUSE section.
    He wants to call SimpleServlet with bellow URL.
    http://hostname:port/j2ee/servlet/SimpleServlet
    When I execute it in our test instance, I can't access j2ee servlet directly and faced bellow HTTP 403 Forbidden warning.
    "You don't have permission to access /j2ee on this server."
    How to access the SimpleServlet?
    If you have any solution or advice, please give me the feedback freely.
    Regards,

    <i>how to create a new project of type J2EE -> EJB Module Project.</i>
    First of all u need to have NWDS.
    There go to File -> New -> Project -> Select J2EE -> Select EJB Module Project
    <i>any prerequisites required to create this apart from the java gui</i>
    None. U may create the project here in NWDS and can deploy on XI server.
    <i>all in all i want to find how to access J2EE explorer.</i>
    J2EE Explorer can be seen under Windows -> Show View -> J2EE Explorer
    Regards,
    Prateek

  • How to access a servlet using a blackberry?

    hello guys
    I have an application that runs on a blackberry and is supposed to access a Servlet on a Tomcat web server. My question is: Should I configure first Tomcat to be able to handle WAP request? If "Yes", how can I do that?
    Or maybe I don't have to do nothing at all

    http://www.blackberry.com/developers/journal/nov_2003/calling_all_networks.shtml#wanauh
    HTH
    Phani Koka

  • Get the current count of the client accessing the servlet

    Any body can tell me how to know the information of every client that accessing my servlet after the client access the login interface.

    Thanks.
    But,
    My mean is not know each client information. I want to know all the current client count is accessing my web application and the client do not include that
    user has signed off the application nor the browser is closed by some reason. Sometime if you enter the forum, you maybe find how many people are in the forum current time? I just know all the users now accessing my web application

  • Accessing a servlet thru Proxy server

    I have a servlet and It has to be accessed by a Client Application. The Cleint cannot directly access this servlet. He has to come thru a proxyServer.
    Client application is opening a URL Connection to my Servlet by using the Proxy parameter in the URL.openConnection(Proxy).
    It fails "Authorization failure giving error 407"
    How do I authorize the proxyServer to connect to my Servlet?
    I tried putting an Authenticator class to return the userId and Password and installed the authenticator before opening the urlConnection.
    It doesn't call the Authenticator's getPasswordAuthentication() method at all.
    Any ideas on How to make an authenticated connection thru a ProxyServer.
    Thanks,

    Not sure what Tomcat you're running on or how you're accessing the servlet from the applet but here are some hints:
    http://www.netbeans.org/servlets/ReadMsg?msgId=364394&listName=nbusers
    http://www.netbeans.org/servlets/ReadMsg?msgId=495317&listName=nbusers
    HTH

  • How to connect to MS Access from servlet uploaded in TOMCAT server

    Hi,
    I want to access MS Access from servlet .I use TOMCAT server.I want to know what should i do.How to get drivers and how to set class path for them.
    Please help me in finding the solution
    thanks and Regards

    HI,
    try this
    <Code>
    response.setContentType(CONTENT_TYPE);
         PrintWriter out = response.getWriter();
         java.sql.DatabaseMetaData dm = null;
         java.sql.ResultSet rs = null;
         try
              Class.forName("sun,jdbc.odbc.JdbcOdbcDriver");
              Connection con = java.sql.DriverManager.getConnection("jdbc:odbc:dsnName","","");
              dm = con.getMetaData();
              out.println("<html>");
              out.println("<head><title>Servlet1</title></head>");
              out.println("<body bgcolor=\"lightblue\">");
              if(con!=null){
                   dm = con.getMetaData();
                   out.println("<B><br>Driver Information</B>");
                   out.println("\n\t<br><br>Driver Name: "+ dm.getDriverName());
                   out.println("\n\t<br>Driver Version: "+ dm.getDriverVersion ());
                   out.println("\n\t<br>Database Information ");
                   out.println("\n\t<br>Database Name: "+ dm.getDatabaseProductName());
                   out.println("\n\t<br>Database Version: "+ dm.getDatabaseProductVersion());
                   out.println("\n\t<br><br>Avalilable Catalogs ");
                   rs = dm.getCatalogs();
                   while(rs.next()){
                             out.println("<br>\tcatalog: "+ rs.getString(1));
                   out.println("\n\t<br><br>conURL =" + conURL);
                   out.println("\n\t<br><br>Title = Database");
                   rs.close();
                   rs = null;
                   con.close();
              }else {
                   out.println("Error: No active Connection");
         }catch(ClassNotFoundException e) {
              out.println("Coudn't laod the database driver: " + e.getMessage());
         } catch(SQLException e) {     
              out.println("SQLException caught: " + e.getMessage());
              try {
                   if (con != null)
                        con.close();
                   if (rs != null)
                        rs.close();
              catch (SQLException ignored) {}
              finally {
                   try {
                             if (con != null)
                                  con.close();
                             if (rs != null)
                                  rs.close();
                        catch (SQLException ignored) {}
    </Code>
    Sachin

  • How to authenticate user when accessing a servlet in WLS6.0

              In my current project , i need to authenticate user when accessing(executing) a
              servlet deployed in WLS6.0. I tried to add
              <auth-method>
              BASIC
              </auth-method>
              in the web.xml.
              Also in the default fileRealmProperties file, i set up the ACL for
              acl.execute.weblogic.Servlet.myServlet = the user
              also i have disabled guest access in my config.xml.
              after all these, the servlet can still be accessed freely.
              do i miss something ? what is the right way to set up it in wls6.0
              thanks a lot
              hyliu
              

    The steps required are documented at:
              http://e-docs.bea.com/wls/docs60/quickstart/quick_start.html
              mark
              narendra wrote:
              > hi all,
              > I had written a simple servlet. I would like to know the steps to
              > be followed to run the servlet.
              > What i did is i kept that servlet class file in the default directory
              > and added the servlet path in the web.XML.
              > but when i try to run the servlet its giing me 404 error.
              > Can any one help me out by giving the detailed steps to be followed as I
              > am new to Weblogic6.0
              >
              > Thanks in Advance,
              

  • How to access Current Servlet Context from a java webservice class?

    Hi,
    I' am developing a Java Web Service Class, and I want to access some application settings information stored in the application context,
    but I couldn't get access to the current ServletContext?
    Note:
    I added my settings to the web.xml file in the WEB-INF folder.
    Normally I' am using getInitParameter(key) to get the value.
    Can any one help me please?
    Message was edited by:
    MySecreen

    Hi,
    I' am developing a Java Web Service Class, and I want
    to access some application settings information
    stored in the application context,
    but I couldn't get access to the current
    ServletContext?
    Note:
    I added my settings to the web.xml file in the
    WEB-INF folder.
    Normally I' am using getInitParameter(key) to get the
    value.
    Can any one help me please?
    Message was edited by:
    MySecreenI was faced with a similar issue, here's what worked for me:
    Have your class implement the ServiceLifecycle Interface and use it as you normally would, here's a sample
    import javax.xml.rpc.ServiceException;
    import javax.xml.rpc.server.ServiceLifecycle;
    import javax.xml.rpc.server.ServletEndpointContext;
    import javax.servlet.ServletContext;
    public class SomeClass implements ServiceLifecycle {
         private ServletContext sc = null;
    ....// rest of class code......
    public void init(Object arg0) throws ServiceException {
              ServletEndpointContext ctx;
              ctx = (ServletEndpointContext) arg0;
              sc = (ServletContext) ctx.getServletContext();
    ...}

  • Problem with Accessing Deployed Servlets Please help, very urgent.

    Inspite of going through lots of Docs. I am not able to access the JSP which is deployed using JDeveloper 3.2 in the browser? What should be the URL and where should I place the JSP and the related files in the Apache Server (Specific directory)?
    Please help, this is very Urgent.
    Could I get some sites where I can get detailed description of how to deploy and access Servlets and JSPS using JDeveloper 3.2 for OAS 9i?
    Thanks in advance,
    Regards,
    Kavita.
    null

    Hi Kativa,
    In answer to your first question: In most apache installs, you want to place all your JSPs under the Apache/htdocs directory. This htdocs directory becomes the root directory of your HTTP request, so, for example, to access the file
    Apache/htdocs/mydir/myJSP.jsp
    you'd point your browser to
    server:port/mydir/myJSP.jsp]http://server:port/mydir/myJSP.jsp
    As to your second question: Do you mean Oracle 9iAS? If so, look at this HOWTO: http://technet.oracle.com:89/ubb/Forum2/HTML/006398.html
    JDeveloper 3.2 does not support deployment to OAS (the predecessor to iAS), but there was no OAS 9i.
    null

  • Frame access from servlet not working

    Dear all,
    I am running my servlets on Tomcat 5.5 and using JDK 1.6. I have a small program that uses codecs to access frames from a video file. PreAccessCodec implements Codec interface and PostAccessCodec extends PreAccessCodec. I set the two codecs into the processor's codec chain. The program is implemented as a thread and once started grabs frames and stores the images in a certain interval. The problem is this: whenever I start the thread from a main program, everything runs without a glitch. However, when I put the code in init() method of the servlet, I get the following error message:
    The input format is not compatible with the given codec plugin: com.mapper.utils.PostAccessCodec@69d02b
    Failed to realize: com.sun.media.ProcessEngine@1478a43
      Cannot build a flow graph with the customized options:
        Unable to add customed codecs:
          com.mapper.utils.PreAccessCodec@15356d5
          com.mapper.utils.PostAccessCodec@69d02b
    Error: Unable to realize com.sun.media.ProcessEngine@1478a43 I am using netbeans 5.5.1 to deploy my servlets. I doubt that the problem is with classpaths because the servlet doesn't complain when I am using JMF's classes like Processor.
    I would really appreciate any help.
    Thank you.
    Message was edited by:
    calculemus

    The GE.iH() method should return false for
    a ..head-full ..en-headed, not headless
    environment, and I expect (from what you
    reported above) that will return false for both
    your servlet and application, and is apparently
    not the problem.It returned false when I tried GE, and it was not the problem as you suggested. However, I now noticed in the logs:
    java.awt.HeadlessException
    I use Netbeans for the development, and I tried using -Dheadless=true and -Dheadless=false, it did not change anything...
    I think it is time to check that assumption
    more carefully.
    My impression is that PreAccessCodec and
    it's 'Post' equivalent are mentioned a lot in JMF
    example code, but are custom classes,
    built to suit the use at the time. Did you write the
    Pre/PostAccessCodecs for this app.?Yes I customized them from the JMF sample codes. They are in the classpaths and are correctly read by the servlet. I did some logging and I actually saw that the code inside Pre/PostAccess was logging when my servlet was run.
    >
    So, what I am thinking, is that while the JMF
    based Processor class may well be on the
    server's
    classpath, perhaps Pre/PostAccessCodec classes
    are not.
    oes a jar appear in the WEB-INF/lib directory,
    that contains the Pre/PostAccessCodec.class?
    Failing that, are the classes themselves in
    WEB-INF/classes/(sub-dir according to package name)/ ?Nevertheless, just to double check I checked WEB-INF directory and the classes appear correctly in their appropriate 'package-folders'.
    I figured out where exactly the thread was not running. In my PostAccessCodec class, I had overloaded getSupportedInputFormats() function to return RGB format.
    public Format [] getSupportedInputFormats() {
    Format [] fomats = {new RGBFormat()};
    return fomrats;
    When I changed it to return {VideoFormat()}, the codec initializes, but I get nothing when I want to access the frame.
    I guess I will have to start another thread.
    @moderators, please move the post if it is inappropriate to put it in this thread, my apologies.
    The problem is still there and I am not able to get the frame access not working from the servlet. :(
    Message was edited by:
    calculemus
    Message was edited by:
    calculemus

  • Accessing specific servlet in a cluster

    Hi
              I have a servlet that keeps information in a static variable. (This
              information is
              not user specific and kept in memory rather then data base for
              performance reasons).
              My problem is when i want to refresh that information. A specific call
              to the servlet
              containing a refresh command will suffice in the simple case but when i
              apply
              clustering only the servlets in one of the WL servers will get the
              command.
              Is there a way i can access a specific WL server in the cluster or
              another
              way i can send commands to the servlets in all the clusters.
              I am currently using WL 5.1sp5 but the idea is to allow it to work on
              other servlet engines
              so i prefer a non WL specific solution.
                thanks
                  OHAD
              

    WebLogic's.
              - Prasad
              Rich Johns wrote:
              > Is cacheTag a WebLogic invention, or is this part of the servlet spec?
              >
              > thanks
              >
              > Sam Pullara wrote:
              >
              > > The cluster functionality of the CacheTag included in Service Pack 5 is
              > > incomplete and I recommend you do not attempt to use it until the next
              > > release of the WebLogic Server. All of the other functionality in the tag
              > > library, including single server caching, is complete and supported.
              > >
              > > Sorry for the misunderstanding.
              > >
              > > Sam
              > >
              > > "Dimitri Rakitine" <[email protected]> wrote in message
              > > news:[email protected]...
              > > > Absolutely - that's why I mentioned database option first.
              > > >
              > > > Here is another option to consider - use CacheTag (it comes with service
              > > pack 5). You can
              > > > use it in your JSP to cache data and if you specify scope as 'cluster'
              > > your data will be
              > > > replicated across the cluster automagically. This I think will solve your
              > > problem.
              > > >
              > > > This solution is even platform independent, because if you deploy your JSP
              > > on platforms other
              > > > than Weblogic, you can reimplement this tag.
              > > >
              > > > Dimitri
              > > > http://dima.dhs.org
              > > >
              > > > In weblogic.developer.interest.clustering Prasad Peddada
              > > <[email protected]> wrote:
              > > > > If you use JNDI for this, you are can lose the information if the server
              > > that binded the
              > > > > information dies. If that's ok, you can use JNDI replication mechanism
              > > but remember, you
              > > > > are miss using JNDI replication.
              > > >
              > > > > - Prasad
              > > >
              > > > > Dimitri Rakitine wrote:
              > > >
              > > > >> Keeping it in the database will give you reliable and
              > > platform-independent solution.
              > > > >> If you do not want to use database you can bind that object to JNDI
              > > tree - it will be
              > > > >> replicated.
              > > > >>
              > > > >> > Hi
              > > > >>
              > > > >> > I have a servlet that keeps information in a static variable. (This
              > > > >> > information is
              > > > >> > not user specific and kept in memory rather then data base for
              > > > >> > performance reasons).
              > > > >>
              > > > >> > My problem is when i want to refresh that information. A specific
              > > call
              > > > >> > to the servlet
              > > > >> > containing a refresh command will suffice in the simple case but when
              > > i
              > > > >> > apply
              > > > >> > clustering only the servlets in one of the WL servers will get the
              > > > >> > command.
              > > > >>
              > > > >> > Is there a way i can access a specific WL server in the cluster or
              > > > >> > another
              > > > >> > way i can send commands to the servlets in all the clusters.
              > > > >>
              > > > >> > I am currently using WL 5.1sp5 but the idea is to allow it to work on
              > > > >> > other servlet engines
              > > > >> > so i prefer a non WL specific solution.
              > > >
              > > > > --
              > > > > Cheers
              > > >
              > > > > - Prasad
              

  • Restricting access for servlet

    Hi,
    I've two servlet urls:
    http://mymachine/servlet/f60servlet?config=One
    and
    http://mymachine/servlet/f60servlet?config=Two
    I want One to be open for internet and Two only open for intranet. With:
    <Location /servlet >
    order deny,allow
    deny from all
    allow from mynetwork
    </Location>
    in jserv.conf I can restrict access to my intranet but this restriction is applyied to both my applications.
    How can I restrict access for Two but not for One?
    I use iAS 1.0.2.2 on a Sun Solaris 8 machine and Forms6i patch 10.
    kind regards,
    Ivan

    Hi,
    I did open a tar with Oracle and the problem is solved by
    1) creating an alias for /servlet/f60servlet in zone.properties:
    servlet.f60listener.code=oracle.forms.servlet.ListenerServlet
    servlet.f60servlet.code=oracle.forms.servlet.FormsServlet
    servlet.f60servlet.initArgs=configFileName=/u01/app/oracle/product/8.0.6/forms60/server/formsweb.cfg
    servlet.f60listener1.code=oracle.forms.servlet.ListenerServlet
    servlet.f60servlet1.code=oracle.forms.servlet.FormsServlet
    servlet.f60servlet1.initArgs=configFileName=/u01/app/oracle/product/8.0.6/forms60/server/formsweb_internet.cfg
    In formsweb_internet.cfg is only the web-form app defined that should be open for internet
    2) in jserv.conf :
    <Location /servlet/f60servlet>
    order deny,allow
    deny from all
    allow from <mynetwork>
    </Location>
    <Location /servlet/f60servlet1>
    order deny,allow
    deny from all
    allow from all
    </Location>
    See also Doc ID: 180741.996 on metalink.
    Hi,
    I've two servlet urls:
    http://mymachine/servlet/f60servlet?config=One
    and
    http://mymachine/servlet/f60servlet?config=Two
    I want One to be open for internet and Two only open
    for intranet. With:
    <Location /servlet >
    order deny,allow
    deny from all
    allow from mynetwork
    </Location>
    in jserv.conf I can restrict access to my intranet
    but this restriction is applyied to both my
    applications.
    How can I restrict access for Two but not for One?
    I use iAS 1.0.2.2 on a Sun Solaris 8 machine and
    Forms6i patch 10.
    kind regards,
    Ivan

  • Use UWL API in a Servet and access the servlet via URL

    Hi All,
    Actually I want to write a servlet from which I will access the uwl items using UWL APIs. And then I will submit HTTP Request to this servlet via url and want to get the UWL items in response. Is it Possible. I know that it is possible to access uwl items from JSPDynpage but is it possible to use it via servlet. If possible please give me some idea. what are the prerequisite.
    Thanks and Regards
    Avijit

    Hello,
    I see your thread is still unanswered, were you able to resolve the problem yourself (if so can you share with others who may have the same problem)? If so can you add anymore details which may help someone else to find an answer?  Or is it ok to mark this post as assumed answered?
    Beth Maben
    EP - Senior Support Consultant II
    SAP Active Global Support
    Global Support Centre Ireland
    **SDN Forum Moderator:
    SAP Enterprise Portal: Application Integration
    **SDN Universal Worklist Wiki:
    http://wiki.sdn.sap.com/wiki/x/ehU

  • Problems with database access in Servlet Apllication (Duke's Bookstore)

    Hi! My name is Elena Veretilo! I am so newbie in JavaEE. So I really need you help and advice!!!
    I started to learn JavaEE with "The JavaEE5 tutorial for Sun Java Application Server 9.1" (http://java.sun.com/javaee/5/docs/tutorial/doc/) and this tutorial recommended the next examples: http://java.sun.com/javaee/5/docs/tutorial/information/download.html. I try to work in NetBeans 6.0 and NetBeans 6.5.
    First problem - I couldn't add Sun Java Application Server 9.1 to NetBeans' server list - it just doesn't see the installed Sun Java Application Server 9.1.
    Second problem - I couldn't run Duke's Bookstore example (from tutorial examples) - something wrong with working (maybe creating or accessing) database. The Database Server started, GlassFish Server also started, so I don't know where the problem could be.
    There is exception:
    Exception [TOPLINK-4002] (Oracle TopLink Essentials - 2006.8 (Build 060830)): oracle.toplink.essentials.exceptions.DatabaseException
    Internal Exception: org.apache.derby.client.am.SqlException: Table/View 'WEB_BOOKSTORE_BOOKS' does not exist.Error Code: -1
    Call:SELECT BOOKID, FIRSTNAME, SURNAME, ONSALE, INVENTORY, CALENDAR_YEAR, TITLE, PRICE, DESCRIPTION FROM WEB_BOOKSTORE_BOOKS WHERE (BOOKID = ?)
    bind => [203]
    Query:ReadObjectQuery(com.sun.bookstore.database.Book)
    If anybody had learned this tutorial and examples or just know what I need to do, please help me!!!!! If it's possible, tell me step by step, what I need to do!
    And one more question - do I really need Sun Java Application Server 9.1 to work with or GlassFish includes Sun Java Application Server 9.1?????

    [http://forums.sun.com/thread.jspa?threadID=5350426]
    Crossposting without notification is very rude. Please stick to one topic.

  • Database access using servlet MIDlet communication

    Hi all,
    Could anyone please help me?
    I have written a MIDlet connecting to the TOMCAT web server and invokes a Servlet. The Servlet then fetches data (list of names) from MS Sql Server and returns to the MIDlet. Then the MIDlet displays the names in a ChoiceGroup . And MIDlet invokes another servlet to update
    So far everything works well.
    The hard part with this solution is
    1. Servlet has to send the result as delimited strings (with :)
    2. The midlet has to parse the servlet data and extracts the values. this all done through the code only. no routines i used
    3. the url has to have %20 for space otherwise the Connector.open(url) method throws error.
    Can anyone suggest better solutions for this. perhaps easy?
    Regards,
    //Selva

    Ok, so this is the code i use in the MIDlet to post the two parameters, but i can't get them in the servlet. What's wrong?
    HttpConnection c=(HttpConnection)Connector.open(serverURL);
    System.out.println("Connecting");
    c.setRequestMethod(HttpConnection.POST);
    c.setRequestProperty("Content-Type", "application/x-www-form-urlencoded");
    dos=c.openDataOutputStream();
    dos.writeUTF("user=" + userName);
    dos.writeUTF("&password=" + password);
    dos.writeUTF("\r\n");
    dos.flush();

Maybe you are looking for