Doing an http request in servlet

What's the code to do an http request in a servlet? I mean I have my servlet printing out links, but if I want it to use those links instead and print out what is contained on the following pages, I would need to do some kind of request and parse the response myself correct?

What's the code to do an http request in a servlet?
I mean I have my servlet printing out links, but if I
want it to use those links instead and print out what
is contained on the following pages, I would need to
do some kind of request and parse the response myself
correct?Correct. Thought about something like this:
URL servletUrl = new URL("http://www.google.com/search?q=how+to+call+a+servlet+from+a+servlet");
InputStream in = servletUrl.getInputStream();Actual coding may vary.

Similar Messages

  • Cannot process an HTTP request to servlet [Faces Servlet] in [wcb] web application

    Hi All
    l am working on a Wcem 3.0 with Trex with ERP and WAS 7.3.
    When I logon to http://<host>:<port>/wcb/index.html url I am able to see wcbuilder_erp & wcbuilder_erp_ume application ids.
    But suddenly I am getting The website cannot display the page error message when I access the above mentioned URL.
    When I verify the developer log trace it showing as 500 Internal sever error issue.[EXCEPTION] java.lang.VerifyError: Bad return type
    In defaultTrace.trc file it is showing as Cannot process an HTTP request to servlet [Faces Servlet] in [wcb] web application exception.
    09 10 18:08:56:098#+0530#Error#com.sap.engine.services.servlets_jsp.server.HttpHandlerImpl#
    com.sap.ASJ.web.000137#WEC-APP-BF#sap.com/wec~comm~wcb~leanapp#C0000A229CA7094A0000000000001188#2392750000000004#sap.com/wec~comm~wcb~leanapp#com.sap.engine.services.servlets_jsp.server.HttpHandlerImpl#Guest#0##CFAFBF4C38E411E4B4750000002482AE#ffbcbcdd38e611e49d020000002482ae#ffbcbcdd38e611e49d020000002482ae#0#Thread[HTTP Worker [@455349581],5,Dedicated_Application_Thread]#Plain##
    Cannot process an HTTP request to servlet [Faces Servlet] in [wcb] web application.
    [EXCEPTION] java.lang.VerifyError: Bad return type
    Exception Details:
    Location: com/sap/wec/tc/core/runtime/jsf/resource/WecExternalContextFactory.getExternalContext(Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;)Ljavax/faces/context/ExternalContext; @17: areturn
    Reason: Type 'com/sap/wec/tc/core/runtime/jsf/resource/WecExternalContext' (current frame, stack[0]) is not assignable to 'javax/faces/context/ExternalContext' (from method signature)
    Current Frame:
        locals: { 'com/sap/wec/tc/core/runtime/jsf/resource/WecExternalContextFactory', 'java/lang/Object', 'java/lang/Object', 'java/lang/Object' }
        stack: { 'com/sap/wec/tc/core/runtime/jsf/resource/WecExternalContext' }
      Bytecode:
        0000000: bb00 0359 2ab6 0004 2b2c 2db6 0005 b700
        0000010: 06b0                                
        at java.lang.Class.getDeclaredConstructors0(Native Method)
        at java.lang.Class.privateGetDeclaredConstructors(Class.java:2446)
        at java.lang.Class.getConstructor0(Class.java:2756)
        at java.lang.Class.getConstructor(Class.java:1693)
    Any help?
    Regards
    Rami Reddy

    Hi Steffen,
    Thanks for promt response.
    But when I checked with Basis team as of now there are not yet configured TREX, only WCEM components has been configured in WAS 7.3. When they are configuring WCEM components HTTPS protocol not configured.
    But for past 2 weeks I am able to see the below screen using http://<host>:<port>/wcb/index.html url.
    But now I am getting The website cannot display the page error.
    Please clarify me if anything is wrong from my side. And also pl let us know which configurations I have to check for fixing the issue.
    Regards,
    Rami Reddy

  • Cannot process an HTTP request to servlet [DialogServlet] in [manufacturing] web application.

    Hi all,
    Now I can't open any new search help that use with the dialogservlet .
    And the log have the following error message :
    500 Internal Server Error is returned for HTTP request
    [http://xxxx:xxxxxx/manufacturing/com/sap/me/system/common/client/ErrorPage.jsp]:
      component [DialogServlet],
      web module [manufacturing],
    application [sap.com/me~ear],
      DC name [sap.com/me~ear],
      CSN
    component[],
      problem categorization [com.sap.ASJ.web.000137],
    internal categorization [254340799].
    [EXCEPTION]
    java.lang.NullPointerException: while trying to invoke
    the method java.lang.Throwable.printStackTrace(java.io.PrintWriter) of an object
    loaded from local variable 'e'
    at
    com.sap.me.frame.Utils.getStackTrace(Utils.java:764)
    at
    JEE_jsp_com_sap_me_system_common_client_ErrorPage_1410450_1404183172000_1404185122991._jspService(JEE_jsp_com_sap_me_system_common_client_ErrorPage_1410450_1404183172000_1404185122991.java:137)
    at
    com.sap.engine.services.servlets_jsp.lib.jspruntime.JspBase.service(JspBase.java:102)
    at
    com.sap.engine.services.servlets_jsp.server.Invokable.invoke(Invokable.java:152)
    at
    com.sap.engine.services.servlets_jsp.server.servlet.JSPServlet.service(JSPServlet.java:428)
    at
    com.sap.engine.services.servlets_jsp.server.servlet.JSPServlet.service(JSPServlet.java:147)
    at
    javax.servlet.http.HttpServlet.service(HttpServlet.java:847)
    at
    com.sap.engine.services.servlets_jsp.server.Invokable.invoke(Invokable.java:152)
    at
    com.sap.engine.services.servlets_jsp.server.runtime.RequestDispatcherImpl.doCached(RequestDispatcherImpl.java:655)
    at
    com.sap.engine.services.servlets_jsp.server.runtime.RequestDispatcherImpl.forward(RequestDispatcherImpl.java:488)
    at
    com.vatti.mes.common.web.BaseServlet.doError(BaseServlet.java:61)
    at
    com.vatti.mes.common.dialog.web.DialogServlet.doPost(DialogServlet.java:125)
    at
    com.vatti.mes.common.dialog.web.DialogServlet.doGet(DialogServlet.java:53)
    at
    javax.servlet.http.HttpServlet.service(HttpServlet.java:734)
    at
    javax.servlet.http.HttpServlet.service(HttpServlet.java:847)
    at
    com.sap.engine.services.servlets_jsp.server.Invokable.invoke(Invokable.java:152)
    at
    com.sap.engine.services.servlets_jsp.server.Invokable.invoke(Invokable.java:38)
    at
    com.sap.engine.services.servlets_jsp.server.HttpHandlerImpl.runServlet(HttpHandlerImpl.java:457)
    at
    com.sap.engine.services.servlets_jsp.server.HttpHandlerImpl.handleRequest(HttpHandlerImpl.java:210)
    at
    com.sap.engine.services.httpserver.server.RequestAnalizer.startServlet(RequestAnalizer.java:441)
    at
    com.sap.engine.services.httpserver.server.RequestAnalizer.startServlet(RequestAnalizer.java:430)
    at
    com.sap.engine.services.servlets_jsp.filters.DSRWebContainerFilter.process(DSRWebContainerFilter.java:38)
    at
    com.sap.engine.services.httpserver.chain.AbstractChain.process(AbstractChain.java:78)
    at
    com.sap.engine.services.servlets_jsp.filters.ServletSelector.process(ServletSelector.java:81)
    at
    com.sap.engine.services.httpserver.chain.AbstractChain.process(AbstractChain.java:78)
    at
    com.sap.engine.services.servlets_jsp.filters.ApplicationSelector.process(ApplicationSelector.java:276)
    at
    com.sap.engine.services.httpserver.chain.AbstractChain.process(AbstractChain.java:78)
    at
    com.sap.engine.services.httpserver.filters.WebContainerInvoker.process(WebContainerInvoker.java:81)
    at
    com.sap.engine.services.httpserver.chain.HostFilter.process(HostFilter.java:9)
    at
    com.sap.engine.services.httpserver.chain.AbstractChain.process(AbstractChain.java:78)
    at
    com.sap.engine.services.httpserver.filters.ResponseLogWriter.process(ResponseLogWriter.java:60)
    at
    com.sap.engine.services.httpserver.chain.HostFilter.process(HostFilter.java:9)
    at
    com.sap.engine.services.httpserver.chain.AbstractChain.process(AbstractChain.java:78)
    at
    com.sap.engine.services.httpserver.filters.DefineHostFilter.process(DefineHostFilter.java:27)
    at
    com.sap.engine.services.httpserver.chain.ServerFilter.process(ServerFilter.java:12)
    at
    com.sap.engine.services.httpserver.chain.AbstractChain.process(AbstractChain.java:78)
    at
    com.sap.engine.services.httpserver.filters.MonitoringFilter.process(MonitoringFilter.java:29)
    at
    com.sap.engine.services.httpserver.chain.ServerFilter.process(ServerFilter.java:12)
    at
    com.sap.engine.services.httpserver.chain.AbstractChain.process(AbstractChain.java:78)
    at
    com.sap.engine.services.httpserver.filters.SessionSizeFilter.process(SessionSizeFilter.java:26)
    at
    com.sap.engine.services.httpserver.chain.ServerFilter.process(ServerFilter.java:12)
    at
    com.sap.engine.services.httpserver.chain.AbstractChain.process(AbstractChain.java:78)
    at
    com.sap.engine.services.httpserver.filters.MemoryStatisticFilter.process(MemoryStatisticFilter.java:57)
    at
    com.sap.engine.services.httpserver.chain.ServerFilter.process(ServerFilter.java:12)
    at
    com.sap.engine.services.httpserver.chain.AbstractChain.process(AbstractChain.java:78)
    at
    com.sap.engine.services.httpserver.filters.DSRHttpFilter.process(DSRHttpFilter.java:43)
    at
    com.sap.engine.services.httpserver.chain.ServerFilter.process(ServerFilter.java:12)
    at
    com.sap.engine.services.httpserver.chain.AbstractChain.process(AbstractChain.java:78)
    at
    com.sap.engine.services.httpserver.server.Processor.chainedRequest(Processor.java:475)
    at
    com.sap.engine.services.httpserver.server.Processor$FCAProcessorThread.process(Processor.java:269)
    at
    com.sap.engine.services.httpserver.server.rcm.RequestProcessorThread.run(RequestProcessorThread.java:56)
    at
    com.sap.engine.core.thread.execution.Executable.run(Executable.java:122)
    at
    com.sap.engine.core.thread.execution.Executable.run(Executable.java:101)
    at
    com.sap.engine.core.thread.execution.CentralExecutor$SingleThread.run(CentralExecutor.java:328)

    Hi Ivan!
    The fact the this code worked fine yesterday or is working fine in Dev but not in another system proves nothing. On the contrary, the stack trace confirms that the problem stems from your custom code com.vatti.mes.common.web.BaseServlet.doError(BaseServlet.java:61). The obvious thing is that the method here is called "doError" that likely means you either face some error there or intentionally generate error message. After that the system tries to log the error message but it looks as if com.sap.me.frame.Utils.getStackTrace method gets null as an input parameter e. How does it get triggered and what is passed into - this is a question to your developers.
    Regards,
    Sergiy

  • How to send a HTTP request to servlet in java application

    I'm new in Java. I need to send a HTTP request with parameters to servlet in a java aplication. Here is my code. It can be compiled but always threw an exceptions when I ran it. Can anyone help?
    package coreservlets;
    import java.io.*;
    import java.net.*;
    public class PostHTTP
         public static void main(String args[])
              throws IOException, UnknownHostException {
              try
              // URL and servlet
                   URL myURL = new URL("http://pc076/servlet/coreservlets.OffHold");
                   URLConnection c = myURL.openConnection();
                   c.setUseCaches(false);
                   c.setDoOutput(true);
                   ByteArrayOutputStream byteStream = new ByteArrayOutputStream(512);
                   PrintWriter out = new PrintWriter(byteStream, true);
    //parameters
                   String postData = "REASON_CODE=3B&RSPCODE=JSmith&CASENUM=NA795401&REPLY=123&SOURCE=XYZ&REPLYLINK=http://pc076/servlet/coreservlets.ShowParameters";
                   out.print(postData);
                   out.flush();
                   String lengthString = String.valueOf(byteStream.size());
                   c.setRequestProperty("Content-Length", lengthString);
                   c.setRequestProperty("Content-Type", "application/x-www-form-urlencoded");
                   byteStream.writeTo(c.getOutputStream());
                   BufferedReader in =     new BufferedReader(new InputStreamReader
                                                 (c.getInputStream()));
                   String line;
                   //String linefeed = "\n";
                   //resultsArea.setText("");
                   while((line = in.readLine()) != null) {
                        System.out.println(line);
                        //resultsArea.append(linefeed);
              catch(IOException ioe) {
              // Print debug info in Java Console
              System.out.println("IOException: " + ioe);

    here are some updates to your code I haven't tested it running
    post again if you still have trouble
    URL myURL = new URL("http://pc076/servlet/coreservlets.OffHold");
    HttpURLConnection c = (HttpURLConnection)myURL.openConnection();
    c.setDoInput(true);
    c.setDoOutput(true);
    ByteArrayOutputStream byteStream = new ByteArrayOutputStream(512);
    String lengthString = String.valueOf(byteStream.size());
    c.setRequestProperty("Content-Length", lengthString);
    c.setRequestProperty("Content-Type", "application/x-www-form-urlencoded");
    PrintWriter out = new PrintWriter(byteStream, true);
    //parameters
    String postData = "REASON_CODE=3B&RSPCODE=JSmith&CASENUM=NA795401&REPLY=123&SOURCE=XYZ&REPLYLINK=http://pc076/servlet/coreservlets.ShowParameters";
    out.print(postData);
    out.flush();
    byteStream.writeTo(c.getOutputStream());
    // connect
    c.connect();
    BufferedReader in = new BufferedReader(new InputStreamReader
    (c.getInputStream()));
    String line;
    while((line = in.readLine()) != null)
        System.out.println(line);

  • Portal 7.0  " Processing HTTP request to servlet [jsp] finished with error."

    Hi
    I just did a system copy for portal 7.0 from my production to quality system.
    The import finished successfully and java instance is up and running
    We were earlier using jdk 1.4.2 , but moved to JVM 6.1 during the import of the java stack and now the java application is using JVM 6.1 instead of JDK 1.4.2
    I m getting the attached error when i m trying to connect with main page of the portal
    Plz let me know why is this happenning?
    Thanks and Regards
    Tushar

    Hi
    Have you tried in any other browser ?
    Check  the detailed error log in defaultTrace file   under /usr/sap/SID/<INSTANCE>/j2ee/cluser/server0/log.
    Open the page again and  check  defaulttrace in above directory 
    Regards,

  • Cannot process an HTTP request to servlet [DTRServlet]

    Hi NWDI experts,
    I just installed a completely new NWDI 7.4 SR1 (SP05) on Windows 2012 R2 and Oracle 11.2.0.4.
    When I try to access DTR I receive error "500 Internal Server Error". In defaultTrace the system reports problems with initialization of DTR. Multiple entries exists in the various log-files and traces, which concerns the problem. I've therefore attached logs and traces to this discussion. After downloading the file rename it to .zip instead of .txt.
    The error seems to be caused by a NullPointerException in oracle.jdbc.driver.OracleStatement.m_batchItems.
    I've searched extensively on SCN, Notes and Google, but have not been able to find any answers to what the problem is. Also I've looked at note 774339 - Internal Server Error in DTR, but have not been able to find a useful solution.
    Has anyone experienced the same error and how where you able to solve it?
    Best regards,
    Jacob

    Good morning Ervin,
    Thank you very much for your answer. I had a suspicion that the error was deeper in the belly of the system and not caused by DTR.
    In the note you mention, it says that a new version of Oracle Client software will be delivered, which should fix the error, but do you have an idea on when it will be available for SAP customers to download?
    Just as a temporary workaround I've replaced the ojdbc6.jar for 11.2.0.4 with the one from 11.2.0.3 and I'm now able to access and browse the DTR.
    Best regards,
    Jacob

  • DTRServlet - 500 Internal Server Error is returned for HTTP request

    Hi everybody,
    I've got a Problem with my DTR.
    Recently we've set up the new CE 7.2 System.
    The DTR has run until about 3 hours ago.
    I don't know what I've done that this error occurs, but I'm nearly shure that I haven't done anything that depends on the dtr.
    I went through the set up wizzard of "Connect Design Time for Visual Composer with NWDI" again, but nothing changed.
    Can you please help me with this issue?!
    Thank you and best regards
    julian
    This is the text from the application log:
    #2.0 #2010 08 20 15:02:47:398#+0200#Info#/Applications/DTR/Lifecycle#
    lifecycle.startApplicationInitialisation#BC-CTS-DTR-SRV#sap.com/tcdtrenterpriseapp#005056BA56AE050000000000000010D8#1694250000000004#sap.com/tcdtrenter
    priseapp#com.tssap.dtr.server.servlet.WebdavServlet#Guest#0##F30581C3AC5A11DFCAED00000019DA2A#f30581c3ac5
    a11dfcaed00000019da2a#f30581c3ac5a11dfcaed00000019da2a#0#Thread[HTTP Worker [@1902689675],5,Dedicated_Application_Thread]#Plain#com.tssap.dtr.server.deltav.resources.log_messages#
    Starting initialisation of DTR application.#
    #2.0 #2010 08 20 15:02:47:405#+0200#Fatal#/Applications/DTR/Lifecycle#
    com.sap.DI.dtr.090009#BC-CTS-DTR-SRV#sap.com/tcdtrenterpriseapp#005056BA56AE050000000001000010D8#1694250000000004#sap.com/tcdtrente
    rpriseapp#com.tssap.dtr.server.servlet.WebdavServlet#Guest#0##F30581C3AC5A11DFCAED00000019DA2A#f30581c3ac5
    a11dfcaed00000019da2a#f30581c3ac5a11dfcaed00000019da2a#0#Thread[HTTP Worker [@1902689675],5,Dedicated_Application_Thread]#Plain#com.tssap.dtr.server.deltav.resources.log_messages#
    Initialisation of DTR application failed. Please refer to SAP note 774339 for more details on how to analyze the error condition.#
    And this is the message from the Default Trace: (not all, that didn't fit in this thread)
    #2.0 #2010 08 20 15:13:49:744#+0200#Error#com.sap.engine.services.servlets_jsp.server.HttpHandlerImpl#
    com.sap.ASJ.web.000137#BC-CTS-DTR-SRV#sap.com/tcdtrenterpriseapp#005056BA56AE05D600000002000010D8#1694250000000004#sap.com/tcdtrent
    erpriseapp#com.sap.engine.services.servlets_jsp.server.HttpHandlerImpl#Guest#0##7F3F3C0AAC5A11DF869E00000019D
    A2A#7db05704ac5c11dfa28500000019da2a#7db05704ac5c11dfa28500000019da2a#0#Thread[HTTP Worker [@236433360],5,Dedicated_Application_Thread]#Plain##
    Cannot process an HTTP request to servlet [DTRServlet] in [dtr] web application.
    [EXCEPTION]
    javax.servlet.ServletException: WebdavServlet.init() failed : com.tssap.dtr.pvc.basics.cluster.TaskFailedException: Connection is invalid.
         at com.tssap.dtr.server.servlet.WebdavServlet.init(WebdavServlet.java:471)
         at javax.servlet.GenericServlet.init(GenericServlet.java:270)
         at com.sap.engine.services.servlets_jsp.server.application.WebComponents.getServlet(WebComponents.java:864)
         at com.sap.engine.services.servlets_jsp.server.HttpHandlerImpl.runServlet(HttpHandlerImpl.java:326)
         at com.sap.engine.services.servlets_jsp.server.HttpHandlerImpl.handleRequest(HttpHandlerImpl.java:203)
         at com.sap.engine.services.httpserver.server.RequestAnalizer.startServlet(RequestAnalizer.java:438)
         at com.sap.engine.services.httpserver.server.RequestAnalizer.startServlet(RequestAnalizer.java:427)
         at com.sap.engine.services.servlets_jsp.filters.DSRWebContainerFilter.process(DSRWebContainerFilter.java:38)
         at com.sap.engine.services.httpserver.server.Processor.chainedRequest(Processor.java:447)
         at com.sap.engine.services.httpserver.server.Processor$FCAProcessorThread.process(Processor.java:264)
         at com.sap.engine.services.httpserver.server.rcm.RequestProcessorThread.run(RequestProcessorThread.java:56)
         at com.sap.engine.core.thread.execution.Executable.run(Executable.java:122)
         at com.sap.engine.core.thread.execution.Executable.run(Executable.java:101)
         at com.sap.engine.core.thread.execution.CentralExecutor$SingleThread.run(CentralExecutor.java:328)
    Caused by: com.tssap.dtr.pvc.basics.cluster.TaskFailedException: Connection is invalid.
         at com.tssap.dtr.pvc.basics.cluster.ClusterExclusiveTaskRunner.start(ClusterExclusiveTaskRunner.java:54)
         at com.tssap.dtr.server.deltav.impl.Repository.initialize(Repository.java:643)
         at com.tssap.dtr.server.deltav.impl.Repository.initialize(Repository.java:613)
         at com.tssap.dtr.server.servlet.WebdavServlet.initializeDeltaV(WebdavServlet.java:556)
         at com.tssap.dtr.server.servlet.WebdavServlet.init(WebdavServlet.java:462)
         ... 36 more
    Caused by: com.tssap.dtr.pvc.util.sql.SQLRuntimeException: Connection is invalid.
         at com.tssap.dtr.pvc.util.sql.GenericStatementProvider.prepareStatement(GenericStatementProvider.java:75)
         at com.tssap.dtr.pvc.util.sql.GenericStatementProvider._getPreparedStatement(GenericStatementProvider.java:62)
         at com.tssap.dtr.pvc.util.sql.GenericStatementProvider.getPreparedStatement(GenericStatementProvider.java:44)
         at com.tssap.dtr.pvc.basics.persistence.PersistentClass.getPreparedStatement(PersistentClass.java:148)
         at com.tssap.dtr.pvc.repository.TaggedValuePersistentClass.loadTaggedValue(TaggedValuePersistentClass.java:113)
         at com.tssap.dtr.pvc.repository.TaggedValueTransientClass.loadTaggedValue(TaggedValueTransientClass.java:51)
         at com.tssap.dtr.pvc.repository.RepositoryManager._checkDbInitialization(RepositoryManager.java:288)
         at com.tssap.dtr.pvc.repository.RepositoryManager.isDbInitialized(RepositoryManager.java:1128)
         at com.tssap.dtr.server.deltav.impl.Repository.initializeDeltaV(Repository.java:558)
         at com.tssap.dtr.server.deltav.impl.Repository$1.run(Repository.java:645)
         at com.tssap.dtr.pvc.basics.cluster.ClusterExclusiveTaskRunner.startTask(ClusterExclusiveTaskRunner.java:65)
         at com.tssap.dtr.pvc.basics.cluster.ClusterExclusiveTaskRunner.start(ClusterExclusiveTaskRunner.java:51)
         ... 40 more
    Caused by: com.sap.engine.services.dbpool.exceptions.BaseSQLException: Connection is invalid.
         at com.sap.engine.services.dbpool.cci.ConnectionHandle.checkIfInvalid(ConnectionHandle.java:652)
         at com.sap.engine.services.dbpool.cci.ConnectionHandle.checkIfValid(ConnectionHandle.java:639)
         at com.sap.engine.services.dbpool.cci.ConnectionHandle.prepareStatement(ConnectionHandle.java:113)
         at com.tssap.dtr.pvc.basics.transaction.SharedConnection.prepareStatement(SharedConnection.java:131)
         at com.tssap.dtr.pvc.util.sql.GenericStatementProvider.prepareStatement(GenericStatementProvider.java:73)
         ... 51 more

    Hello Julian
    This is a known problem.
    Cause
    - A user may have been added to a group in another ldap tree with a name, that is already existing.
    - When DTR retrieves the group from UME, we get 2 similar group names, but the groups may be different.
    - DTR cannot handle this and throws "Internal Server error"
    Resolution
    If you change parameter "ume.ldap.unigue_grup_attribute" to 'uid', DTR doesn't use the groupname,
    but the group-uid, therefore the group is unique.
    1. open Visual Administrator
    2. choose Services
    3. choose UME Provider
    4. Reset "ume.ldap.unigue_grup_attribute" with 'uid'
    5. restart the system
    Thanks
    Kenny.

  • How to transfer the http request from applet to servlet/jsp

    I use the JTree component to create a navigation of a website,but i don't
    know how to connect the tree's nodes with the jsp/servlet.
    I mean how to transfer the http request from the applet to a jsp.
    I use the "<frameset>" mark which will divide the web browse into 2 blocks.
    The left side is Applet,and the right side is the linked jsp page.
    what I say is as the weblogic console layout.
    who can help me!!!
    Thank You!

    I use the JTree component to create a navigation of a website,but i don't
    know how to connect the tree's nodes with the jsp/servlet.
    I mean how to transfer the http request from the applet to a jsp.
    I use the "<frameset>" mark which will divide the web browse into 2 blocks.
    The left side is Applet,and the right side is the linked jsp page.
    what I say is as the weblogic console layout.
    who can help me!!!
    Thank You!

  • Package javax.servlet does not exist, package javax.servlet.http does not

    Dear All,
    I am a newbie to JAVA.
    I installed JDK1.6.0_04, then NetBeans IDE 6.0
    I tried compiling an example servlet, but got this error message:
    package javax.servlet does not exist, package javax.servlet.http does not exist
    I tried locating these packages, but in vain. I also tried setting the CLASSPATH to many values, still it did not work.
    Can anyone, please, help me with this.
    Should I be able to see/locate these packages, do I have to download them?
    Thank you very much.

    davidgoodman wrote:
    Dear All,
    I am a newbie to JAVA.
    I installed JDK1.6.0_04, then NetBeans IDE 6.0
    I tried compiling an example servlet, but got this error message:
    package javax.servlet does not exist, package javax.servlet.http does not exist
    What servlet/JSP engine do you plan to deploy to? Tomcat, perhaps?I think it's Tomcat (C:\Program Files\Apache Software Foundation\Apache Tomcat 6.0.14). Are there other engines that come with NetBeans IDE 6.0 (when I downloaded NetBeans, I chose ALL)
    >
    If so, you'll need to put the servlet JAR in your CLASSPATH. (servlet-api.jar for Tomcat 5.5 and earlier, servlet.jar for 6.0 >and later.)
    I tried locating these packages, but in vain.
    You won't find them until you realize that you have to deploy that servlet someplace.How to deploy?
    I also tried setting the CLASSPATH to many values, still it did not work.
    See above. What were you planning to set CLASSPATH to?First I set to:
    C:\Program Files\Apache Software Foundation\Apache Tomcat 6.0.14\lib (because I found jar named servlet-api.jar in this folder)
    Later I added this:
    C:\Program Files\Java\jdk1.6.0_04\lib (out of trial-and-fail)
    Finally I added some paths that lead to a library such as
    C:\Program Files\glassfish-v2\lib
    C:\Program Files\glassfish-v2\lib\ant\lib
    Can anyone, please, help me with this.
    Should I be able to see/locate these packages, do I have to download them?
    You have to get a servlet/JSP engine. Step 1.Thank you for your help

  • Re: Servlet making HTTP requests

    Hi,
              We are using an application that uses a servlet to perform some JDBC calls
              (which take about 30 minutes) and then make some HTTP requests (which takes
              about 5 to 10 minutes) to another application.
              Once the client has made the request to initiate this process it waits for
              the complete process (40 minutes) to complete. I know this is not ideal but
              its what we've got to live with.
              After a minute or so after the servlet has started making the HTTP requests
              the browser stops responding and has a blank frame displayed instead of the
              response data. We have assumed that after the servlet makes the HTTP
              requests the other application it is not interacting with the HTTP session
              on the server the client is connected to and a timeout occurrs. This
              termintes the request and is why we see a blank frame. Is this correct ? The
              HTTP requests complete successfully in the background.
              Any advice would be greatly appreciated.
              Kev
              

              Your application is really tough and interesting. Web browser usually has timeout
              limit. Proxy server also has timeout limit (usually 30 seconds). If no communication
              after such kind of timeout limit, your browser will stop.
              When your code calls getWriter() or getOutputStream(), your servlet will flush
              all HTTP response header data to your browser and your browser then will get the
              response from your servlet. Beyond that, if you don't send any data from your
              servlet to your browser before proxy or browser timeout, you can only get a blank
              screen.
              If you want to monitor how your servlet works, try to BUILD INTERCATION. At least,
              send data from your servlet to your browser for each time interval which will
              not be longer than browser/proxy timeout. You can send out any information you
              like, if your browser understand it. NOTE YOU SHOULD EXPLICITLY CALL FLUSH() of
              your OutputStream() or Writer() to flush() your data following each write(). This
              way, you can keep the connection alive.
              On the other hand, you can also try set content-length field of response to some
              predefined number, and set Connection field as Keep-Alive, before you call getWriter()
              or getOutputStream(). Then send some data to your browser, for example, one byte
              at a time, until you have sent the number of bytes as specified.
              "Kev" <[email protected]> wrote:
              >Hi,
              >
              >We are using an application that uses a servlet to perform some JDBC
              >calls
              >(which take about 30 minutes) and then make some HTTP requests (which
              >takes
              >about 5 to 10 minutes) to another application.
              >
              >Once the client has made the request to initiate this process it waits
              >for
              >the complete process (40 minutes) to complete. I know this is not ideal
              >but
              >its what we've got to live with.
              >
              >After a minute or so after the servlet has started making the HTTP requests
              >the browser stops responding and has a blank frame displayed instead
              >of the
              >response data. We have assumed that after the servlet makes the HTTP
              >requests the other application it is not interacting with the HTTP session
              >on the server the client is connected to and a timeout occurrs. This
              >termintes the request and is why we see a blank frame. Is this correct
              >? The
              >HTTP requests complete successfully in the background.
              >
              >Any advice would be greatly appreciated.
              >
              >Kev
              >
              >
              

  • Package javax.servlet.http does not exist & package javax.servlet does not

    Hello!
    I am trying to compile this file:
    /* serv2.java 29 Sep 04 */
    import java.util.*;
    import java.io.*;
    import javax.servlet.*;
    import javax.servlet.http.*;
    public class serv2 extends HttpServlet
         protected void doPost(HttpServletRequest req, HttpServletResponse res)
                                  throws ServletException, IOException
              res.setContentType("text/html");
              PrintWriter out = res.getWriter();
              out.println("<HTML><HEAD><TITLE>Sample Servlet</TITLE></HEAD>"+'\n'+
                                  "<BODY BGCOLOR='lightgreen'>"+'\n'+
                                  "<H1 ALIGN=CENTER>Heading</H1>" + '\n' +
                                  "<P><H2 ALIGN=CENTER>Message</H2");
              out.println("</BODY></HTML>");
    }And I am getting this error message:
    C:\Program Files\Apache Tomcat 4.0\webapps\ROOT\WEB-INF\classes\serv2.java:4: package javax.servlet does not exist
    import javax.servlet.*;
    ^
    C:\Program Files\Apache Tomcat 4.0\webapps\ROOT\WEB-INF\classes\serv2.java:5: package javax.servlet.http does not exist
    import javax.servlet.http.*;
    ^
    C:\Program Files\Apache Tomcat 4.0\webapps\ROOT\WEB-INF\classes\serv2.java:7: cannot resolve symbol
    symbol : class HttpServlet
    location: class serv2
    public class serv2 extends HttpServlet
    ^
    C:\Program Files\Apache Tomcat 4.0\webapps\ROOT\WEB-INF\classes\serv2.java:9: cannot resolve symbol
    symbol : class HttpServletRequest
    location: class serv2
         protected void doPost(HttpServletRequest req, HttpServletResponse res)
    ^
    C:\Program Files\Apache Tomcat 4.0\webapps\ROOT\WEB-INF\classes\serv2.java:9: cannot resolve symbol
    symbol : class HttpServletResponse
    location: class serv2
         protected void doPost(HttpServletRequest req, HttpServletResponse res)
    ^
    C:\Program Files\Apache Tomcat 4.0\webapps\ROOT\WEB-INF\classes\serv2.java:10: cannot resolve symbol
    symbol : class ServletException
    location: class serv2
                                  throws ServletException, IOException
    ^
    6 errors
    Tool completed with exit code 1
    I have tried setting CLASSPATH lib/servlet.jar but it still will not work.
    Please help me!!!

    Please check this page,
    http://java.sun.com/j2se/1.4.2/docs/tooldocs/windows/classpath.html
    and also
    serv2 -> set it to Serv2
    another nice to read :-)
    http://java.sun.com/docs/codeconv/html/CodeConventions.doc8.html
    +"Class names should be nouns, in mixed case with the first letter of each internal word capitalized"+
    Another thing,
    Put your class in a package, thanks =)
    regards and goodluck,
    jie

  • Can a servlet handle other than HTTP request..?

    I was asked this question in a interview. Can anyone clear me this.
    Can a servlet handle other than HTTP request..?
    If yes, please give me a working example.

    Can anyone guide me to achieve this.?
    Note: If anyone worked with servlet responding ftp request, please send me the code.
    Yes, a servlet can handle requests in other protocols
    like FTP.
    To achieve this, your Servlet ought to inherit from
    javax.servlet.GenericServlet or implement the
    javax.servlet.Servlet interface. To code the Servlet,
    you should have a working knowledge of ftp protocol.
    When your servlet extends
    javax.servlet.http.HttpServlet, it can process http
    requests only.
    Cheers,
    ram.

  • How does Flash send outgoing HTTP request to server?

    Hello everyone,
    I would like to know how Flash sends outgoing HTTP requests.
    I would like to know when from the inside of a Flash SWF file
    request for another SWF or FLV file is made; how the Flash sends
    this request to server.
    Thank you very much and have a great day,
    Khoramdin

    Hello everyone,
    I would like to know how Flash sends outgoing HTTP requests.
    I would like to know when from the inside of a Flash SWF file
    request for another SWF or FLV file is made; how the Flash sends
    this request to server.
    Thank you very much and have a great day,
    Khoramdin

  • How to construct a faces request from a http request?

    I wonder how FacesServlet.service determines whether it should be calling LifecycleImpl.execute in oppose to calling LifecycleImpl.render?
    Basically, I'm trying to construct a http request that would go through the decode method of my UIComponent. However, it seems that my request has always been treated as a non-faces request, where it goes to the render face directly.
    Does anyone know how do I need to construct my http request so that it'll be recgonized as a faces request?
    Anyone knows where i can download the source code for FacesServlet?
    thanks!

    Sorry, are you saying that FacesServlet ALWAYS call execute before render even if it's the first request?
    What I experienced is that for the first request, execute isn't called, and it goes directly to render.
    And if I use the html form submit on the 2nd request, it does go to execute, then render.
    However, if i construct another http request, it'll act like a first request, where it doesn't go through the execute, but striaght to render.
    This is what I set in web.xml:
    <servlet>
    <servlet-name>Faces Servlet</servlet-name>
    <servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
    <load-on-startup> 1 </load-on-startup>
    </servlet>
    <!-- Faces Servlet Mapping -->
    <servlet-mapping>
    <servlet-name>Faces Servlet</servlet-name>
    <url-pattern>/faces/*</url-pattern>
    </servlet-mapping>
    I call my jsp using http://server:8080/faces/my.jsp, and I'm using tomcat 5. Any help would be appreciated.

  • Problems by getting info out of XML file with a HTTP request

    Hi,
    I have a litte question. I'm working on an application that works together with google maps. In my java code, I get general information about address out of one database table, and I want to add some geographic information like coordinates that I want to retrieve from Google Maps through HTTP:
    Right now my code is like:
    while (resultSet.next())
                             title = resultSet.getString("title").replaceAll("'","''").toUpperCase();
                             author = resultSet.getString("author").replaceAll("'","''").toUpperCase();
                             location = resultSet.getString("location").replaceAll("'","''").toUpperCase();
                             straatnaam = resultSet.getString("straatnaam").replaceAll("'","''").toUpperCase();
                             nummer = resultSet.getString("nummer");
                             landcode = resultSet.getString("landcode").replaceAll("'","''").toUpperCase();
                             address = straatnaam + " " + nummer + " , " + location + " " + landcode;
                             url = "http://maps.google.com/maps/geo?q=" + address + "&output=xml&key=+key+";
                             String query = "INSERT INTO data2 VALUES ('" + i + "','" + title + "','" + author + "','" + resultSet.getString("date1") + "','" + resultSet.getString("date2") + "','" + location + "','" + resultSet.getString("postcode") + "','" + straatnaam + "','" + resultSet.getString("nummer") + "','" + landcode + "','+something like url.getCoordX+','something like url.getCoordY')";
                             success = sql2.executeUpdate(query);
                             i++;
    Now I don't know how I can handle that. Is it possible to do an HTTP request in Java without using Java Script of servlets? I just want to get the X and Y coordinates out of the XML file.
    The XML file will be something like:
    <kml xmlns="http://earth.google.com/kml/2.0">
    <Response>
    <name>1600 amphitheatre mountain view ca</name>
    <Status>
    <code>200</code>
    <request>geocode</request>
    </Status>
    <Placemark>
    <address>
    1600 Amphitheatre Pkwy, Mountain View, CA 94043, USA
    </address>
    <AddressDetails Accuracy="8">
    <Country>
    <CountryNameCode>US</CountryNameCode>
    <AdministrativeArea>
    <AdministrativeAreaName>CA</AdministrativeAreaName>
    <SubAdministrativeArea>
    <SubAdministrativeAreaName>Santa Clara</SubAdministrativeAreaName>
    <Locality>
    <LocalityName>Mountain View</LocalityName>
    <Thoroughfare>
    <ThoroughfareName>1600 Amphitheatre Pkwy</ThoroughfareName>
    </Thoroughfare>
    <PostalCode>
    <PostalCodeNumber>94043</PostalCodeNumber>
    </PostalCode>
    </Locality>
    </SubAdministrativeArea>
    </AdministrativeArea>
    </Country>
    </AddressDetails>
    <Point>
    <coordinates>-122.083739,37.423021,0</coordinates>
    </Point>
    </Placemark>
    </Response>
    </kml>
    many greetings and thanks in advance
    Mathias

    Hi, sorry for being not so clear. My question was actually if it is possible to do a HTTP request in Java without using servlets or being in Java Script. Actually my question was more specific for Google maps, because it didn't seem to work. It was my mistake, and already solved, to forget to make the webservice-call "URL-encoded". Because of that, I always received a HTTP 400 error, and that's why I thought it wouldn't be possible.
    But now I have another, perhaps for you guys stupid question. The result I get from the webservice URL is of the form:
    <?xml version="1.0" encoding="UTF-8"?>
    <kml xmlns="http://earth.google.com/kml/2.0">
    <Response>
         <name>nieuwelaan 38, Hamme</name>
         <Status>
              <code>200</code>
              <request>geocode</request>
         </Status>
         <Placemark id="p1">
              <address>Nieuwelaan 38, 9220 Hamme, Hamme, Belgium</address>
              <AddressDetails Accuracy="8" xmlns="urn:oasis:names:tc:ciq:xsdschema:xAL:2.0">
              <Country>
                   <CountryNameCode>BE</CountryNameCode>
                   <AdministrativeArea>
                        <AdministrativeAreaName>Vlaams Gewest</AdministrativeAreaName>
                        <SubAdministrativeArea>
                             <SubAdministrativeAreaName>Oost-Vlaanderen</SubAdministrativeAreaName>
                             <Locality>
                                  <LocalityName>Hamme</LocalityName>
                                  <DependentLocality>
                                       <DependentLocalityName>Hamme</DependentLocalityName>
                                       <Thoroughfare>
                                            <ThoroughfareName>Nieuwelaan 38</ThoroughfareName>
                                       </Thoroughfare>
                                       <PostalCode>
                                            <PostalCodeNumber>9220</PostalCodeNumber>
                                      </PostalCode>
                                 </DependentLocality>
                            </Locality>
                        </SubAdministrativeArea>
                   </AdministrativeArea>
             </Country>
             </AddressDetails>
             <Point>
                   <coordinates>4.126295,51.097724,0</coordinates>
             </Point>
         </Placemark>
    </Response>
    </kml> Now I want to get the value of the coordinates field.
    This is my code:
    address = URLEncoder.encode(address, "UTF-8");
    urlString = "http://maps.google.com/maps/geo?q=" + address + "&output=xml&key=ABQIAAAA9fEXNK-q6vKpPU0JCmPPkxQjbVBpjtblJJYkDfbMo0e51afwehRmujfvBtJqx1Qehg6e6QgCRY8poA";
    url = new URL(urlString);
    XPath xPath = XPathFactory.newInstance().newXPath();
    Document domDoc = processData(url);
    path = "/kml/Response/Placemark/Point/coordinates";
    coord = xPath.evaluate(path, domDoc);
    System.out.println("coord : " + coord);Now, in the last line, by writing out the value of coord to my screen, I get the value "1", instead of "4.126295,51.097724,0" I would expect, anyone knows what I'm doing wrong?
    greetings
    Mathias

Maybe you are looking for

  • Creating a Linked Report in SC 2012 - Operations Manager fails with Error

    Hello everyone, I was trying to create a linked report based on an availability report recently. I found Emre Guclu's scom linked report creation guide here: http://blogs.technet.com/b/emreguclu/archive/2011/10/13/using-linked-reports-in-scom-to-crea

  • My Mac only works on the mains

    Hello, i have a problem my macbook only works when it's connected to the mains. when i click on the battery icon it says battery is not charging and when i push the button on the battery i get five green lights. in the system profiler it says: Charge

  • Smart cover not working properly after upgrade to iOS7

    Since I upgraded my Ipad mini to iOS7 the smart cover stopped working as it was working before. Usually, when I closed the cover the ipad went to sleep and when I opened it the ipad woke up. Is it another problem of iOS7 ? Is there any solution?

  • Magic mouse problems with windows 7

    I connect the magic mouse to the computer, I can right click and left click. but it's not doing other stuff!!!!!!! Hopes help

  • How to find Custom_tops

    Hi, Can any one help to find cutoms tops. Thanks in Adavance Veeraiah.