How to -only- invoke a Servlet/JSP

Hi,
I would like to invoke a Servlet or JSP inside a standalone application WITHOUT opening a stream. When I use url.openConnection() or con.connect() the servlet/JSP is not executed, I must also do "ObjectInputStream o = new ObjectInputStream(con.getInputStream());" in order to get the servlet/jsp executed.
I just want to invoke the servlet/JSP, because I use the returned data for nothing.
Thanks

If you openConnection, you might also have to get the output stream from the servlet to make it work properly. (Otherwise, the server, or proxies in-between, might consider that the client has decided it doesn't want the page after all, and may stop requesting it.)
A cheap way to request a page but get less data back would be..
conn.setRequestMethod("HEAD");HEAD is exactly like GET, except it doesn't return the body (just the headers, hence the name.) Not entirely sure if it works on Java.
Failing that, you should be able to just open the input stream, and close it again straight away.

Similar Messages

  • How to invoke a servlet/JSP in WebLogic 6.1 after change without restarting

              Hi, all:
              Does anyone know how to have your servlet/JSP pick up the class changed without
              restarting the weblogic 6.1 server?
              Thank you so much for your help.
              - Charles
              

    Use exploded deployment format, touch REDPLOY file.
              Peace,
              Cameron Purdy
              Tangosol Inc.
              Tangosol Coherence: Clustered Coherent Cache for J2EE
              Information at http://www.tangosol.com/
              "Charles Li" <[email protected]> wrote in message
              news:3c3b9161$[email protected]..
              >
              > Hi, all:
              >
              > Does anyone know how to have your servlet/JSP pick up the class changed
              without
              > restarting the weblogic 6.1 server?
              >
              > Thank you so much for your help.
              >
              > - Charles
              

  • How can I invoke a servlet without mapping it first?

    Hi all!
              I'm evaluating WLS 6.1 and in trying some examples of mine. I came across
              following problem: I have some .war in which the the servlets are invoked
              without mapping -> e.g. calling wepappname/servlet/ServletClass. I hadn't
              any success doing that on WLS 6.1.
              If I use the servlet mapping in web.xml instead it works. but i have to
              rewrite all my .wars...
              So is there a possibility to invoke a servlet in WLS6.1 without servlet
              mapping?
              Thanks for your precious help!
              -Paolo
              

    ok, thank you :-)
              -paolo
              "Dimitri Rakitine" <[email protected]> schrieb im Newsbeitrag
              news:[email protected]...
              > Maybe there is one, but I do not know about it - what I described is
              > the only way I know ;-(
              >
              > Paolo Vedovato <pvedovato@nospam_hotmail.com> wrote:
              > > Thank you Dimitri for your reply and help :-)
              > > I see now what I can do to achieve what I want.
              >
              > > But one questions remains: So there's no 'build-in' way to invoke a
              servlet
              > > in WLS6.1 without having to add the servlet-mapping tag in the web.xml,
              as
              > > it can be done in several servlet engines (e.g. Tomcat 4.0)?
              >
              > > -Paolo
              >
              > > "Dimitri Rakitine" <[email protected]> schrieb im Newsbeitrag
              > > news:[email protected]...
              > >> Sure. In your web.xml add the following:
              > >>
              > >> <web-app>
              > >> ...
              > >> <servlet>
              > >> <servlet-name>ServletServlet</servlet-name>
              > >> <servlet-class>weblogic.servlet.ServletServlet</servlet-class>
              > >> </servlet>
              > >> ...
              > >> <servlet-mapping>
              > >> <servlet-name>ServletServlet</servlet-name>
              > >> <url-pattern>/servlets/*</url-pattern>
              > >> </servlet-mapping>
              > >> ...
              > >> </web-app>
              > >>
              > >> and, if your servlet is in war classpath, and it's classname is
              > > test.TestServlet,
              > >> you can invoke it as:
              > >>
              > >> http://localhost:7001/yourapp/servlets/test/TestServlet
              > >>
              > >> (for example - add these lines to the examplesWebApp/WEB-INF/web.xml,
              > > redeploy, and you
              > >> can run HelloWorld servlet as:
              > >>
              > >
              http://localhost:7001/examplesWebApp/servlets/examples/servlets/HelloWorldSe
              > > rvlet
              > >> )
              > >>
              > >> Paolo Vedovato <pvedovato@nospam_hotmail.com> wrote:
              > >> > Hi all!
              > >>
              > >> > I'm evaluating WLS 6.1 and in trying some examples of mine. I came
              > > across
              > >> > following problem: I have some .war in which the the servlets are
              > > invoked
              > >> > without mapping -> e.g. calling wepappname/servlet/ServletClass. I
              > > hadn't
              > >> > any success doing that on WLS 6.1.
              > >>
              > >> > If I use the servlet mapping in web.xml instead it works. but i have
              to
              > >> > rewrite all my .wars...
              > >>
              > >> > So is there a possibility to invoke a servlet in WLS6.1 without
              servlet
              > >> > mapping?
              > >>
              > >> > Thanks for your precious help!
              > >>
              > >> > -Paolo
              > >>
              > >>
              > >>
              > >> --
              > >> Dimitri
              >
              >
              >
              > --
              > Dimitri
              

  • How do you invoke a simple jsp

    hi,
    i have a very simple jsp that displays the current time. it works on my tomcat server (installed on my computer). i purchased a domain from yahoo, say, www.beginer.com and uploaded the jsp file to the yahoo server. but when i referenced it with the url www.beginer.com/MyJSP.jsp, a download dialog popped up.
    so, how do you get the browser to display the dynamic contents of the jsp file?
    thanks.

    Did you ask Yahoo whether their server supports servlets and JSPs? Or did you just assume that? I would expect that it doesn't.

  • How to use a custom servlet in iFS?

    Hi,
    I'm creating a custom servlet to download files from iFS to local drive. My question is where should I put the servlet class file, and how do I invoke this servlet from a ifs jsp file?
    I'm running iFS 1.1.9, with JWS web server.
    Thanx.
    [email protected]

    Howdy:
    In the iFS Online Resources HTML whitepaper,
    there are several examples for creating and
    deploying servlets. See the section "Creating a Simple Content Management Application." Please check out: http://technet.oracle.com/products/ifs/htdocs/resources/index.htm
    Hope this helps,
    Dennis Dawson

  • How to invke the XSQL Servlet directly

    What I am really trying to achieve is the ability to forward an xml document to the XSQL servlet for further processing.
    How can I invoke the servlet rather than go via an xsql page and what parameters do I need to pass in order for it to work.
    I'm wondering out loud if the new filter capabilities of servlet 2.3 will achieve the desired effect.
    Any ideas?

    You can get the RequestDispatcher and call forward() on it
    to forward to an XSQL page. From another one of your posts
    it seems you might have already figured this out. :-)

  • Want to run servlets, jsp and ejb

    Hi there, I have just installed Oracle9iAS on my PC and want to check how to use OAS with servlets, JSPs and ejbs, so can any one tell me where can I find some worked examples and step by step deployment process, any help would be appreciated, regards, Shabbier

    If you have installed Oracle9iAS, you should be able to get to the welcome page at
    http://<machine_name>:7778/
    You can see J2EE demos off that page.
    Also, you can find info about oracle9iAS and documentation
    at http://otn.oracle.com/products/ias/content.html
    OC4J info can be found at
    http://otn.oracle.com/tech/java/oc4j
    -Prasad

  • How to display RTF File in Browser Using Servlets/JSPs

    Hi All,
    I have some RTF Files, which contains some data.
    The data needs to be displayed in the frame of jsp page .
    How i can display the RTF File Content using either servlets/jsps
    Can any body have idea on this.
    Help me out on this.
    With Regards
    Hari

    If you only need to display it, consider your HttpServletRequest just as byte stream. :) Just read from ServletInputStream and write it back into ServletOutputStream of HttpServletResponse.
    If you want to process incoming XML, please give some details first, what exactly you want to do. :)

  • How to invoke a Servlet method from application

    please help me.the scenario is as follows
    1)a servlet is placed on the server and application has invoked servlet with URL and URL Connection class
    but how do i call a certain method of servlet on the server from the application.Let suppose the servlet's method to be invoked is print(String s).How it can be done from application.

    As GrayMan suggested, Servlets are intended to be used for HTTP communication.
    If you want to open common logic to multiple clients, use EJBs, CORBA or some type of Web Service (SOAP, XML-RPC).
    When you send a request to a servlet, the doPost or doGet method will be invoked. Products such as STRUTS allow you do 'map' to other classes. I suggest avoiding this.
    Personally, I avoid STRUTS like a bad disease. Using STRUTS instead of just learning Servlets/JSP adds a lot of overhead. I prefer performance over development time. A good example of this is that ANY request that comes in over the WEB has ALL variables from the calling page (text boxes, radio buttons and such) made avaialable through the HttpServletRequest.getParameter(String parameterName) method. STRUTS requires you to build a subclass of it's ActionForm classes that is nothing more than a JavaBean with fields that match that of the web page. STRUTS will look at all the parameters in the request and all the fields in the Bean and assign any matches from the request to the Bean. The Bean is instanciated and the matching logic performed just to give you access to objects you already have access to.
    Just my 2 cents, avoid STRUTS like an STD.

  • How to invoke a Servlet on onClick event of CheckBox ?

    Hi,
    Can anybody provide me with the code - how to invoke a Servlet & then pass all form variables to the Servlet on onClick Event of CheckBox in a JSP Page.
    I guess it is possible with Javascript but i need the code...
    Pls Help !
    Thanx.

    <html>
    <head>
    <script language="JavaScript">
    <!--
    function submitMyForm(){      
    document.myform.submit();
    //-->
    </script>
    </head>
    <body>
    <form name="myform" method="POST" action="http://mywebserver/servlet/myServlet" target=_top>
    <input type="checkbox" name="mycheckbox" OnClick = "javascript:submitMyForm()">
    </form>
    </body>
    </html>
    Hope this helps...

  • How to invoke the servlet

    how to invoke a servlet using jsp
    containing JSF components
    how can we do this using creator ?
    having sucessfully executed the examples
    still dont know how to do it
    and also jsp source is quite different than normal jsp
    it doesnt allow jsp tags such as
    <%= "asdf"%>any help is great to me
    thanks in advance !
    cheers,
    shekar

    and also jsp source is quite different than normal
    jsp
    it doesnt allow jsp tags such as
    <%= "asdf"%>
    This is jsp syntax -- JSC uses jsf...:-(
    Regards,
    - D.t.O

  • (Servlet/JSP based): How to secure calling of one apps from another

    I am having two different web application(Servlet/JSP based) on two different servers. For example,
    AppsA is on '*http://IP1:PORT1:AppsA*' and AppsB is on '*http://IP2:PORT2:AppsB*'
    I am sending a request from AppsA to AppsB for the PDF (ONLY THIS, No more interaction). Which is working fine. But the URL of AppsB i.e. 'http://IP2:PORT2:AppsB' appears in the browser.
    But i don't want to show the interaction of AppsB. I have tried to FORWARD the request to AppsB but it only allows relative path.
    So how can i make it secured..?
    Thanks.

    Now it's secured...
    Thanks BalusC
    --Kunal Dav                                                                                                                                                                                                                   

  • Re: How do I invoke Servlets...continued

    Hi Howard,
              Could you show us web.xml?
              Regards,
              Slava Imeshev
              "Howard Hyde" <[email protected]> wrote in message
              news:3ccedf8a$[email protected]..
              > My posting appears to have been truncated, so here is the remainder:
              > (continued)
              > 'Pilot' is a servlet defined and mapped in my web.xml file. But when I
              attempt
              > to invoke the servlet in the app with any of the following:
              > http://localhost:7001/pilots/Pilot
              > http://localhost:7001/pilots/pilot
              > http://localhost:7001/pilots/servlet/Pilot
              > http://localhost:7001/pilots/servlet/pilot
              >
              > ... I get a 404 error.
              >
              > However, the following JSP, which is part of the same web application
              component
              > of the Enterprise app, works:
              > http://localhost:7001/pilots/Rating.jsp
              >
              > So the question of the day once again, is:
              >
              > How do I invoke servlets in an enterprise application?
              >
              > Best regards,
              >
              > Howard
              > 818-366-2686
              

    and to add to matt's post:
              in the servlet init() method trace out some debug to ensure that new
              versions of your servlet are actually being deployed:
              ..init() {
              System.out.println( getServletName() + " was deployed at " + " new
              Date(System.currentTimeMillis()) );
              "Matt Krevs" <[email protected]> wrote in message
              news:[email protected]...
              > 1. What stack trace do you receive, if any, when your call to your servlet
              > doesnt work
              >
              > 2. Is your servlet in a package? If it is then you need to specify the
              > package in the servlet-class element
              >
              > 3. Is it possible that your servlet-name and/or servlet-class elements in
              > web.xml have some spaces in them? Maybe you should remove the line feeds
              > etc. and specify your servlet elements as you have your servlet-mapping
              > elements
              >
              > eg like this
              >
              > <servlet>
              > <servlet-name>Pilot</servlet-name>
              > <servlet-class>FrmPilot2</servlet-class>
              > <load-on-startup>0</load-on-startup>
              > </servlet>
              >
              > 4. Do you get any deployment errors when weblogic starts up?
              >
              > 5. Try setting the load-on-startup parameter to a positive number. You may
              > receive a helpful? stacktrace when weblogic starts up
              >
              >
              > "Howard Hyde" <[email protected]> wrote in message
              > news:[email protected]...
              > > The following are EXCERPTS from the web.xml file:
              > >
              > > <web-app>
              > > <servlet>
              > > <servlet-name>
              > > Pilot
              > > </servlet-name>
              > > <servlet-class>
              > > FrmPilot2
              > > </servlet-class>
              > > <load-on-startup>
              > > 0
              > > </load-on-startup>
              > > </servlet>
              > > <servlet-mapping>
              > > <servlet-name>Pilot</servlet-name>
              > > <url-pattern>/Pilot</url-pattern>
              > > </servlet-mapping>
              > >
              > > </web-app>
              > >
              > >
              >
              >
              

  • How do I invoke Servlets...continued

    My posting appears to have been truncated, so here is the remainder:
              (continued)
              'Pilot' is a servlet defined and mapped in my web.xml file. But when I attempt
              to invoke the servlet in the app with any of the following:
              http://localhost:7001/pilots/Pilot
              http://localhost:7001/pilots/pilot
              http://localhost:7001/pilots/servlet/Pilot
              http://localhost:7001/pilots/servlet/pilot
              ... I get a 404 error.
              However, the following JSP, which is part of the same web application component
              of the Enterprise app, works:
              http://localhost:7001/pilots/Rating.jsp
              So the question of the day once again, is:
              How do I invoke servlets in an enterprise application?
              Best regards,
              Howard
              818-366-2686
              

    My posting appears to have been truncated, so here is the remainder:
              (continued)
              'Pilot' is a servlet defined and mapped in my web.xml file. But when I attempt
              to invoke the servlet in the app with any of the following:
              http://localhost:7001/pilots/Pilot
              http://localhost:7001/pilots/pilot
              http://localhost:7001/pilots/servlet/Pilot
              http://localhost:7001/pilots/servlet/pilot
              ... I get a 404 error.
              However, the following JSP, which is part of the same web application component
              of the Enterprise app, works:
              http://localhost:7001/pilots/Rating.jsp
              So the question of the day once again, is:
              How do I invoke servlets in an enterprise application?
              Best regards,
              Howard
              818-366-2686
              

  • Urgent....How can i redirect to my jsp page from servlet in init() method..

    How can i redirect to my jsp page from servlet in init() method..Becoz that servlet is calling while server startsup..so im writing some piece of code in init() method..after that i want to redirect to some jsp page ...is it possible?
    using RequestDispatcher..its not possible..becoz
    RequestDispatcher rd = sc.getRequestDispatcher("goto.jsp");
    rd.foward(req,res);
    Here the request and response are null objects..
    So mi question can frame as how can i get request/response in servlet's init method()..

    Hi guys
    did any one get a solution for this issue. calling a jsp in the startup of the servlet, i mean in the startup servlet. I do have a same req like i need to call a JSP which does some data reterival and calculations and i am putting the results in the cache. so in the jsp there in no output of HTML. when i use the URLConnection i am getting a error as below.
    java.net.SocketException: Unexpected end of file from server
    at sun.net.www.http.HttpClient.parseHTTPHeader(HttpClient.java:707)
    at sun.net.www.http.HttpClient.parseHTTP(HttpClient.java:612)
    at sun.net.www.http.HttpClient.parseHTTPHeader(HttpClient.java:705)
    at sun.net.www.http.HttpClient.parseHTTP(HttpClient.java:612)
    at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLCon
    nection.java:519)
    at com.toysrus.fns.alphablox.Startup.callJSP(Unknown Source)
    at com.toysrus.fns.alphablox.Startup.init(Unknown Source)
    at org.apache.tomcat.core.ServletWrapper.doInit(ServletWrapper.java:317)
    so plz do let me know how to call a jsp in the start up of a servlet.
    Thanks
    Vidya

Maybe you are looking for

  • How to restore backed up files off DVD onto my PC?

    This mornign my PC wouldn't switch on. said it had to repair itself. Finally said it couldn't. So I backed up using the HP backup program. I now have 7 DVDs of my backed-up, zipped files. I have restored my PC to factory settings and now want to relo

  • Hyperlinks in Crystal reports  - SAP BW BI environment

    Hi Gurus, I am working on SAP BI BO integration environment on Cystal reports 2008 and WebI reports. Source for both of them are BEx queries. 1. I need to create a hyperlink on one crystal report column which opens another Crystal report. The target

  • WRT54G connection error!!!!

    Hi, When i plug the network cable into my computer thru the wireless router the error says "no connectivity or limited connection" then i cannot go to the main setup. Plus the power light indicator keeps on blinking is it normal? can you plus help me

  • Link local file with browse file dialog

    Hey guys, I'm looking for a solution to hyperlink to a local file (i.e. C:/test.txt). I want that the user clicks on a "browse file" button like the file browse item. after the user selected a file or just a folder the path should be shown in a displ

  • Problem with starting tomcat

    Hi, I am getting the following error mesage while try to run the tomcat on my machine. " 'java' is not recognized as an internal or external command, program or batch file. 'java' is not recognized as an internal or external command, operable program