HTTP Servlet

How to use the function httpSession.setAttribute() with an array. I want to trnasfer an array between servlets. If i run my programm i get only a reference of the object, which was set by setAttribute("name",Array).
It works with a String.
THX
tobi

You just cast the object to the array type you had. For example if it was a String array:
String[] array = (String[])getAttribute("name");

Similar Messages

  • How can i send xml file with a http servlet request

    Hi
    Please tell me how can I send a xml file into http servlet request.
    I have a servlet(action) java file.From this servlet I have generate a xml file. Now I need to send that xml file to another servlet with http servlet request object.
    Dave.

    When you say you have generated an XML file what do you mean?
    Is it a file stored on disk? Then pass the file path as a string to the servlet.
    Is it stored in memory as an object? The pass a reference to the object to the servlet.
    Or are you asking how to communicate between servlets?
    Look in the JavaDocs for the RequestDispatcher class. You can use this class to forward the request to another servlet. Data can be passes using the RequestDispatcher by storing it as attributes using the request getAttribute and setAttribute methods. Also described in the JavaDOcs.
    http://java.sun.com/j2ee/1.4/docs/api/javax/servlet/RequestDispatcher.html

  • HTTP Servlet call

    Hi all,
    I have a BPM scenario where i have several conditional branches, and in one of the branch i have to make a HTTP Servlet call via HTTP adapter and pass some values from the incoming message in the HTTP post.
    Is this just like a normal HTTP adapter call or HTTP servlet is something diffrent from a normal adapter call?
    anybody has done similar HTTP servlet calls ? aplease share your thoughts.
    Thanks

    Hi,
    Its same to the normal HTTP Call but at the BPM you meight need to give conditions as you indicated...you give conditions in the Control step of BPM
    Amaresh

  • Non-HTTP servlet

              I need to support concurrent access from multiple clients using a non-HTTP protocol
              over socket connection. One way is to write my socket server and create a new
              thread for each request. But WLS forbids user-created threads from calling into
              WLS components such as EJB. So I would like to write a non-HTTP servlet so that
              the WLS servlet container will create a new thread calling into the servlet and
              have the servlet calling EJBs on this WLS created thread. But is there a way to
              plug a subclass of GenericServelt into WLS?
              Thanks,
              T Tse
              

    I don't think there is a way to use non-HTTP servlet's, but still you can use WLS
              execute queue and execute threads, for example:
              ServerSocket serverSocket = new ServerSocket(...);
              for(;;) {
              new MyThread(new RequestHandler(serverSocket.accept())).start();
              class RequestHandler implements Runnable {
              Socket socket;
              public RequestHandler(Socket socket) {
              this.socket = socket;
              public void run() {
              // to see if this is executing on a WebLogic execute thread
              new Exception().printStackTrace();
              try {
              socket.close();
              } catch(Throwable whatever) {}
              class MyThread implements Schedulable, Triggerable {
              boolean done = false;
              Runnable runnable = null;
              Object sync = new Object();
              ScheduledTriggerDef std;
              public void join() throws InterruptedException {
              synchronized(sync) {
              if(!done) {
              sync.wait();
              public void run() {
                   if(runnable != null) {
                   runnable.run();
              public MyThread() {
              public MyThread(Runnable runnable) {
                   this.runnable = runnable;
              public boolean start() {
                   boolean ok = false;
                   try {
                   T3ServicesDef t3 = (T3ServicesDef)(new InitialContext()).lookup("weblogic.common.T3Services");
                   std = t3.time().getScheduledTrigger(this, this);
                   std.schedule();
                   ok = true;
                   } catch(NamingException ne) {
                   System.out.println(ne.getMessage());
                   } catch(TimeTriggerException tte) {
                   System.out.println(tte.getMessage());
                   return ok;
              public void trigger(Schedulable sched) {
                   try {
                   run();
                   } catch(Throwable t) {
                   System.out.println(t);
              synchronized(sync) {
              done = true;
              sync.notify();
              public long schedule(long time) {
                   return done ? 0 : 1;
              ttse <[email protected]> wrote:
              > I need to support concurrent access from multiple clients using a non-HTTP protocol
              > over socket connection. One way is to write my socket server and create a new
              > thread for each request. But WLS forbids user-created threads from calling into
              > WLS components such as EJB. So I would like to write a non-HTTP servlet so that
              > the WLS servlet container will create a new thread calling into the servlet and
              > have the servlet calling EJBs on this WLS created thread. But is there a way to
              > plug a subclass of GenericServelt into WLS?
              > Thanks,
              > T Tse
              Dimitri
              

  • HTTPS Servlet requests

              After installing service pack 9 from WL5.1, HTTPS servlet requests result in the
              browser returning a server error. Issue 41888 of sp9 seems to address this. We
              were previously running service pack 6 and didn't experience this problem. Any
              ideas?
              

    Have you installed SP9 properly?
              I just tried accessing example servlets on Https protocol and i don't see any
              errors.
              Could you tell us what problems you are facing? Any test case?
              Kumar
              Darren Collins wrote:
              > After installing service pack 9 from WL5.1, HTTPS servlet requests result in the
              > browser returning a server error. Issue 41888 of sp9 seems to address this. We
              > were previously running service pack 6 and didn't experience this problem. Any
              > ideas?
              

  • Non-http servlet engine?

    Hi, I'm new to servlet development and I'm not sure this question has been answered here before. So I apologize if it has.
    Basically I want to have an integrated server that can accept both http and non-http requests. So my initial thought was to write an HttpServlet and a GenericServlet. Then I googled for clues on how to implement that and found from the JavaRanch website http://faq.javaranch.com/java/ServletsFaq#otherProtocols that this task could be a daunting one because that'd imply that I have to write a new servlet engine.
    So my question is, is this true in your expert opinion? And, if the custom non-http protocol has a similar syntax as http (e.g. RTSP), is it possible to just extend the http servlet engine to support it? And would that be doable without much effort?
    Thanks,
    Liang.

    Would you actually need the entire servlet system for the new protocol? For your typical simple request/reply protocol you'd normally:
    Create a server socket.
    When a connection arrives, start a thread to service it.
    In the service thread, read and parse request.
    Send reply.
    Close socket, exit thread.
    A servlet system adds a bunch of stuff to that: a layer that allows you to configure pluggable request handlers; methdod-specific functions (POST -> doPost()); a ServletRequest object; etc. Are those things relevant to the new protocol? Do you have requests with URL-like things in the header, allowing routing requests to different servlets? Do you plan to have lots of servlets for the protocol (one servlet -> no much point in XML-configurable request routing)?
    I'd hope that I wouldn't need to implement a configurable request routing infrastructure. It's a lot of work if it's not really needed. Just write a socket server. If you have an associated web server (e.g. HTML pages from which the user starts RTSP requests) you can even run the socket server inside the servlet container if that helps.

  • QaaWS HTTP Servlet

    Hi All,
    Iam created a universe and qaaws query on the universe . Every thing is fine but while retrieving the QAAWS url into Xcelsius it showing unable to load URL . When iam paste URL on my Browser it is showing QaaWS HTTP Servlet(Input/Output exception occurred : 'C:\Program Files\Business Objects\Tomcat55\webapps\dswsbobje\WEB-INF\classes\qaawsWsdl.zip (The system cannot find the file specified)' )
    Thanks
    Praveen Yagnamurthy.

    Hi Chand,
    Check once WEbi server as well tomcat server in CMC ? Every thing is fine ask the basis guy weather he applied any patches in BO . If he applied the patches   just re produce the QAAws URl s i mean just choose your Created qaaws query Next >next>finish .DO the same for your QAAWS queries  it means that it will upgrade URLS to your Lower version to higher Version .

  • Doubt in Generic Servlet and Http Servlet

    Hi,
    I studied Genaric Servlet does not support state and session mengement and where as Http Servlet supports state and session mengement.
    Why Genaric Servlet does not support state and session mengement ?
    Can any one plz tell me reasons.

    GenericServlet is pretty much the most basic Java application that you can run server-side. It doesn't support much of anything except for the basic life cycle management and a couple other things. Go to Dictionary.com and lookup the word Generic. It's used a lot in software development. Go to http://java.sun.com/j2ee/1.4/docs/api/index.html to read more on the GenericServlet class.
    BalusC, because a thread hasn't been active in awhile doesn't mean it's dead. If it were dead it would not be editable. Moreover, the question was never answered (adequately).
    Edited by: wpafbuser1 on Jan 3, 2008 3:33 PM

  • Error while using LiveCycle java APIs with Http servlets:"Remote EJBObject lookup failed for ejb/Inv

    Hi all,
    When i try to run more than one servelt of the Quick Start samples that using Livecycle Java APIs and i get an error of "Remote EJBObject lookup failed for ejb/Invocation provider" from any servelt i run.
    I try some Quick samples which is not servelts (java class) and it works fine, which makes me sure that my connection properties is true.
    Environment:
    The LiveCycle is based on "Websphere v6.1", and i use "Eclipse Platform
    Version: 3.4.1".
    i install "tomcat 5.5.17" to test the servelts in developing time through Eclipse.(only for test in developing time not for deploy on )
    The Jars i added in the classpath:
    adobe-forms-client.jar
    adobe-livecycle-client.jar
    adobe-usermanager-client.jar
    adobe-utilities.jar
    ejb.jar
    j2ee.jar
    ecutlis.jar
    com.ibm.ws.admin.client_6.1.0.jar
    com.ibm.ws.webservices.thinclient_6.1.0.jar
    server.jar
    utlis.jar
    wsexception.jar
    My code is :
    Properties ConnectionProps = new Properties();
    ConnectionProps.setProperty(ServiceClientFactoryProperties.DSC_DEFAULT_EJB_ENDPOINT, "iiop://localhost:2809");
    ConnectionProps.setProperty ServiceClientFactoryProperties.DSC_TRANSPORT_PROTOCOL,ServiceClientFactoryProperties.DSC_ EJB_PROTOCOL);
    ConnectionProps.setProperty(ServiceClientFactoryProperties.DSC_SERVER_TYPE,ServiceClientFa ctoryProperties.DSC_WEBSPHERE_SERVER_TYPE);
    ConnectionProps.setProperty(ServiceClientFactoryProperties.DSC_CREDENTIAL_USERNAME, "Administrator");
    ConnectionProps.setProperty(ServiceClientFactoryProperties.DSC_CREDENTIAL_PASSWORD, "password");
    ConnectionProps.setProperty("java.naming.factory.initial", "com.ibm.ws.naming.util.WsnInitCtxFactory");
    //Create a ServiceClientFactory object
    ServiceClientFactory myFactory = ServiceClientFactory.createInstance(ConnectionProps);
    //Create a FormsServiceClient object
    FormsServiceClient formsClient = new FormsServiceClient(myFactory);
    //Get Form data to pass to the processFormSubmission method
    Document formData = new Document(req.getInputStream());
    //Set run-time options
    RenderOptionsSpec processSpec = new RenderOptionsSpec();
    processSpec.setLocale("en_US");
    //Invoke the processFormSubmission method
    FormsResult formOut = formsClient.processFormSubmission(formData,"CONTENT_TYPE=application/pdf&CONTENT_TYPE=app lication/vnd.adobe.xdp+xml&CONTENT_TYPE=text/xml", "",processSpec);
    List fileAttachments = formOut.getAttachments();
    Iterator iter = fileAttachments.iterator();
    int i = 0 ;
    while (iter.hasNext()) {
    Document file = (Document)iter.next();
    file.copyToFile(new File("C:\\Adobe\\tempFile"+i+".jp i++;
    short processState = formOut.getAction();
    ...... (To the end of the sample)
    My Error was:
    com.adobe.livecycle.formsservice.exception.ProcessFormSubmissionException: ALC-DSC-031-000: com.adobe.idp.dsc.net.DSCNamingException: Remote EJBObject lookup failed for ejb/Invocation provider
    at com.adobe.livecycle.formsservice.client.FormsServiceClient.processFormSubmission(FormsSer viceClient.java:416)
    at HandleData.doPost(HandleData.java:62)
    at HandleData.doGet(HandleData.java:31)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:689)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.j ava:252)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
    a

    I assume here that your application is deployed on a different physical machine of where LCES is deployed and running.
    Do the following test:
    - Say that LCES is deployed on machine1 and your application is deployed on machine2. Ping machine1 from machine2 and note the ip address.
    - Ping machine1 from machine1 and note the ip address.
    The two pings should match.
    - Ping machine2 from machine1 and note the ip address.
    - Ping machine2 from machine2 and note the ip address.
    The two pings should match.
    Usually this kind of error would happen if your servers have internal and external ip addresses.

  • Java Stored Procedure calling HTTP Servlet in Weblogic

    I am currently working on an e-commerce application for a brick-n-mortar electronics store. The store currently has an Oracle database that contains all of the products the store sells. The e-commerce site will have a separate Oracle database. Both database are Oracle 9i release 2 databases. The e-commerce site will be using BEA's Weblogic as its application server. I need to move data from the store db into the e-commerce db. The actual moving of the data is not the issue. The issue comes from needing to call several methods on a Stateless Session EJB, loaded on the Weblogic server, to perform backend processing. I wanted to make a JNDI call from a Java Stored Procedure but with Release 2, this option is no longer supported. The release notes (http://otn.oracle.com/tech/java/htdocs/9idb2_java.html) indicated that the JVM now supports calling out to Servlets using HTTP Client from a Java Stored Procedure.
    Has anyone done this? Is there any sample code available?
    Thanks for any help.

    I am currently working on an e-commerce application for a brick-n-mortar electronics store. The store currently has an Oracle database that contains all of the products the store sells. The e-commerce site will have a separate Oracle database. Both database are Oracle 9i release 2 databases. The e-commerce site will be using BEA's Weblogic as its application server. I need to move data from the store db into the e-commerce db. The actual moving of the data is not the issue. The issue comes from needing to call several methods on a Stateless Session EJB, loaded on the Weblogic server, to perform backend processing. I wanted to make a JNDI call from a Java Stored Procedure but with Release 2, this option is no longer supported. The release notes (http://otn.oracle.com/tech/java/htdocs/9idb2_java.html) indicated that the JVM now supports calling out to Servlets using HTTP Client from a Java Stored Procedure.
    Has anyone done this? Is there any sample code available?
    Thanks for any help. Hi,
    sorry we have not yet formally documented this but here is a code snippet
    Kuassi
    /* HttpCallout - simple test to callout to static pages from Java Stored
    Procedures */
    import java.io.IOException;
    import java.io.InputStream;
    import HTTPClient.HTTPConnection;
    import HTTPClient.HTTPResponse;
    import HTTPClient.AuthorizationInfo;
    public class HttpCallout {
    public static void main(String[] argv) throws InterruptedException {
    HttpCallout t = new HttpCallout(argv);
    t.run();
    private String[] argv ;
    HttpCallout(String[] argv) {
    this.argv = argv;
    void initSSL() {
    public void run() {
    try {
    if ( argv.length == 0 ) {
    System.out.println("HttpCallout " +
    "protocol " +
    "host " +
    "port " +
    "page ");
    return;
    // process arguments
    int argc = 0;
    String protocol = argv[argc++];
    String host = argv[argc++];
    int port = Integer.parseInt(argv[argc++]);
    String page = argv[argc++];
    // Debugging - don't set for now
    // System.setProperty("HTTPClient.log.mask", "3");
    // noop
    initSSL();
    // Grab HTTPConnection
    HTTPConnection con = new HTTPConnection(protocol, host, port);
    con.setTimeout(20000);
    con.setAllowUserInteraction(false);
    // Grab Response
    HTTPResponse rsp = con.Get(page);
    byte[] data = rsp.getData();
    if ( data == null ) {
    System.out.println("no data");
    } else {
    System.out.println("data length " + data.length);
    System.out.println(new String(data));
    catch ( Throwable ex ) {
    ex.printStackTrace();

  • HTTP/Servlet problem

    Hi,
    This question may sound a little bit stupid but i 'm new with HTML and servlets...
    I am trying to do the following:
    I have a FORM: <FORM NAME=\"form\">
    in which there is a button:
    <INPUT TYPE="BUTTON" NAME="searchSession" VALUE="Search" onClick="openWindow('searchSession');">
    openWindow is a java script in which a new window is created:
    newWindow = window.open('http://"+hostName+":8080/servlet/be.abis.presentation.EnrolmentServlet', 'Select Session', 'menubar,scrollbars,resizable,width=628,height=333');
    in the servlet (EnrolementServlet) the request will be forwarded to a specific servlet. This happens through the following code:
    if(request.getParameter("searchSession") != null){
              requestDispatcher = getServletConfig().getServletContext().getRequestDispatcher("http://"+hostName+":8080/servlet/be.abis.presentation.SearchSessionServlet");
         }else if(request.getParameter("ok") != null){
              enrolmentBean.saveEnrolment();
         }else{
              createForm(request, response);
         if(requestDispatcher != null){
              requestDispatcher.forward(request, response);
    what i do not understand is why the request is never forwarded to: http://"+hostName+":8080/servlet/be.abis.presentation.SearchSessionServlet
    I 'll rally be thankful if someone could help me out of heren
    thnx
    PS: Session here has nothing to do with HTTPSession

    I am doing the same thing and it do work.
    my Javascript looks like following
    function OpenNewWindow(url,title)
    window.open(url, title, "width=650,height=400,status=yes,resizable=yes,toolbar=yes,status=yes,scrollbars=yes,location=yes,screenX=0,left=0,screenY=0,top=0");
    Make sure your host name is right.
    Hope this help!!

  • Non-http servlet without headers

    I would like to create a servlet that does not respond to web requests, but to invocations by client sockets (on port 80).
    It all goes well, but even if I use a simple Servlet implementation, the web server wraps the response into a http response, and adds headers, which is unnecessary at all times. How can I avoid this?
    I use JBoss/Tomcat for container.

    Hi,
              import java.io.*;
              import javax.servlet.*;
              public class Helloservlet extends GenericServlet {
              public void service(ServletRequest req,ServletResponse res) throws
              ServletException,IOException {
              res.SetcontentType("text/html");
              PrintWriter pw = new PrintWriter();
              pw.println("<b>HelloWorld"); pw.close();
              The above example code for GenericServlet that is not specific to the http.
              Regards
              Anilkumar kari

  • Streaming XML file content to a HTTPS servlet..

    Hi,
    I want to stream the contents of a XML file , which I have generated through XDK for PL/SQL, to a HTTPS address for a servlet.
    This HTTPS connections uses certifcates for user authentication. I have the certifcate on my local machine. Is there anyway of doing this through PL/SQL? Are there any packages available in Oracle 8.1.6 for this purpose? Can somebody tell me if there is a better way of doing this?
    Any help will be greatly appreciated.
    Thanks.

    After some additional trials I found a solution by calling the stored procedure in this way
    DBSetAttributeDefault (hdbc, ATTR_DB_COMMAND_TYPE, DB_COMMAND_STORED_PROC);
    DBPrepareSQL (hdbc, "usp_InsertReport");
    DBCreateParamInt (hstmt, "", DB_PARAM_RETURN_VALUE, -1);
    DBCreateParamChar (hstmt, "XMLCONTENT", DB_PARAM_INPUT, sz_Buffer, (int) strlen(sz_Buffer) + 1 );
    DBExecutePreparedSQL (hstmt);
    DBClosePreparedSQL (hstmt);
    DBGetParamInt (hstmt, 1, &s32_TestId);
    where sz_Buffer is my xml file content and s32_TestID the return value of the stored procdure (usp_InsertReport(@XMLCONTENT XML))
    Now I face the problem, that DBCreateParamChar limits the buffer size to 8000 Bytes.
    Any idea to by-pass this shortage??

  • Http servlet error

    Hi all,
    Could u please help me how to solve the error
    D:\>javac myservlet.java
    myservlet.java:1: package javax.servlet does not exist
    import javax.servlet.*;
    ^
    myservlet.java:2: package javax.servlet.http does not exist
    import javax.servlet.http.*;
    ^
    2 errors
    I've installed J2ee 1.5
    and the servlet programme is
    import javax.servlet.*;
    import javax.servlet.http.*;
    public class myservlet
    Thank you with regards,
    Mukesh Kumar

    Hi tolmank,
    Thanks you for assisting me. but I'm still getting the same error. Any way following is my system set-up
    J2ee is installed in "D:\Sun\AppServer"
    so j2ee.jar is residing at
    "D:\Sun\AppServer\lib\j2ee.jar"
    also my system's Environment variable's =>> System Variables Path is
    "%SystemRoot%\system32;%SystemRoot%;%SystemRoot%\System32\Wbem;D:\Sun\AppServer\jdk\bin;D:\Sun\AppServer\lib\j2ee.jar;"
    my myservlet.java file is residing at "d:\myservlet.java"
    this file contains
    import javax.servlet.*;
    import javax.servlet.http.*;
    public class myservlet
    when I'm running the javac it is giving the following error
    Microsoft Windows 2000 [Version 5.00.2195]
    (C) Copyright 1985-1999 Microsoft Corp.
    D:\>javac myservlet.java
    myservlet.java:1: package javax.servlet does not exist
    import javax.servlet.*;
    ^
    myservlet.java:2: package javax.servlet.http does not exist
    import javax.servlet.http.*;
    ^
    2 errors
    D:\>
    Please advice me.
    Thank you

  • Need iFS http-client/http-servlet architectural advice.

    I need to design a custom client to connect to an iFS http protocol server in order to allow users of my client to drop document objects (files) on iFS and modify properties (metadata) of those document objects.
    In other words, my client connects to iFS via http, and lets the user upload "files" to iFS, but more importantly, also lets the user enter values for custom properties associated with the class objects corresponding to the iFS document objects being uploaded.
    Fo a while, WebDAV looked like a good solution. But I just discovered WebDAV does not allow me to access custom properties for an iFS object.
    It looks to me now that my only alternative is to also write a custom servlet and have my custom client connect to that servlet. This is not desireable from a product viewpoint since it requires special installation at the server.
    My custom client is to be integrated in an already existing application that manages files, so I really need to write my own special client. I cannot use the WebUI.
    Any idea, tips, or advice from the iFS gurus would be greatly appreciated.
    Is there any way to avoid the custom servlet approach. For instance, is there some existing agent or servlet that I can just send XML requests to ?

    What version are you running?
    If 9iFS v9.0.2 or prior you may be able to achieve what you are after by use of XML files that would update metadata of an existing 9iFS object.
    CM SDK v9.0.3 and later only supports parsing of XML from the CUP protocol - so you would be out of luck here.
    Your best bet it to write the custom servlet unfortunately.
    There is an enhancement filed for the CM SDK WebDAV servlet to allow hooks that will enable you to do your own processing throughout the transaction.
    Matt.

  • Problem whit http servlet!!

    How I can start my bundle from browser?
    I have installed ans started jes
    I have installed ans started all bundle whit command line in MS-DOS window , but I do not Know
    what I have to type in the bar-address of my browser to start the service.
    I Know only
    http://localhost:8080/ ....and than??...
    Help me!

    I'm also newbie of servlet.
    1st: what do you have installed? You need a server to run servlet as Tomcat (you can get it for free from http://jakarta.apache.org) and J2SE installed in your PC
    2nd: after you have installed the package above, just open your browser and write this url http://localhost:8080. If everything work right, you will see tomcat welcome page.

Maybe you are looking for