How to modify a servlet response?

Hi all,
I want to modify the servlet response string returned by the portal irj servlet.
For this I created a filter.
Now my requirement is to do something like this in the doFilter method:
doFilter(ServletRequest req, ServletResponse res, FilterChain chain) {
PrinterWriter pq = res.getWriter();
Reader reader = new StringReader(printWriter.toString());
BufferedReader bufferedReader = new BufferedReader(reader);
String line;
while ((line = bufferedReader.readLine()) != null) {
line.replaceAll("Welcome", "Welcome to XXXX");
What I am trying to do is in the response stream replace the letter welcome with "Welcome to XXXX".
I know I cant accomplish this by the code given above.
Any body has a code snippet of how to get this working?
Thanks

Hi,
You are already in the right way, things missing are:
1. Forgot the do the filter chain     
      filterChain.doFilter(request, wrapper);
2. Write back the modified stream to response
// write the response stream           
      response.setContentLength(responseStr.length());
      response.getWriter().write(responseStr);      
You can use the HttpServletResponseWrapper to manipulate the response too, check the examples at this link:
http://www.jsp-develop.de/faq/show/47/
Greetings,
Praveen Gudapati
[Points are always welcome for helpful answers]

Similar Messages

  • JTextField: How to modify keybinding / keyboard response?

    Hello Experts,
    For a certain programming purpose, is there a way to modify keyboard response?
    I have created a JTextField txtSample. When it gets the focus, I want it to behave as following:
    1. When user presses '+' key, instead of printing '+' in the text field, I want to do some actions and the '+' is not printed.
    2. When user presses 'a' key, instead of printing 'a' in the text field, I want 'o' to be printed.
    I have done the following for the first purpose, but it doesn't work:
    Action addTrans = new AbstractAction() {
         public void actionPerformed(ActionEvent e){
              System.out.println("User has pressed + keypad");
    txtSample.getInputMap().put(KeyStroke.getKeyStroke(KeyEvent.VK_PLUS, 0), "addTrans");
    txtSample.getActionMap().put("addTrans", addTrans);Any advice would be greatly appreciated.
    Patrick

    camickr,
    First amazing thing, the first time I clicked on the link
    Works fine is this example:
    http://forums.sun.com/thread.jspa?forumID=57&threadID=622030 it gave an error message.
    Second amazing thing, I checked on the API of KeyStroke
    getKeyStroke
    public static KeyStroke getKeyStroke(char keyChar)
        Returns a shared instance of a KeyStroke that represents a KEY_TYPED event for the specified character.
        Parameters:
            keyChar - the character value for a keyboard key
        Returns:
            a KeyStroke object for that key
    getKeyStroke
    public static KeyStroke getKeyStroke(int keyCode,
                                         int modifiers)
        Returns a shared instance of a KeyStroke, given a numeric key code and a set of modifiers. The returned KeyStroke will correspond to a key press.
        The "virtual key" constants defined in java.awt.event.KeyEvent can be used to specify the key code. For example:
            * java.awt.event.KeyEvent.VK_ENTER
            * java.awt.event.KeyEvent.VK_TAB
            * java.awt.event.KeyEvent.VK_SPACE
        The modifiers consist of any combination of:
            * java.awt.event.InputEvent.SHIFT_DOWN_MASK
            * java.awt.event.InputEvent.CTRL_DOWN_MASK
            * java.awt.event.InputEvent.META_DOWN_MASK
            * java.awt.event.InputEvent.ALT_DOWN_MASK
            * java.awt.event.InputEvent.ALT_GRAPH_DOWN_MASK
        The old modifiers
            * java.awt.event.InputEvent.SHIFT_MASK
            * java.awt.event.InputEvent.CTRL_MASK
            * java.awt.event.InputEvent.META_MASK
            * java.awt.event.InputEvent.ALT_MASK
            * java.awt.event.InputEvent.ALT_GRAPH_MASK
        also can be used, but they are mapped to _DOWN_ modifiers. Since these numbers are all different powers of two, any combination of them is an integer in which each bit represents a different modifier key. Use 0 to specify no modifiers.
        Parameters:
            keyCode - an int specifying the numeric code for a keyboard key
            modifiers - a bitwise-ored combination of any modifiers
        Returns:
            a KeyStroke object for that key
        See Also:
            KeyEvent, InputEventThere is no indication that one method consume the keystroke, while the other does not. Now, I understand that keybinding can prevent the key from reaching the model.
    And last, yes, you are right. It would be better to use DocumentFilter to serve
    When user presses 'a' key, instead of printing 'a' in the text field, I want 'o' to be printed.Thanks for all your effort to guide me and sorry for the misunderstanding,
    Patrick

  • How to modify user responsibility

    Hi,
    Please suggest me how to modify the user responsibility in oracle apps 11i.
    I have a user, he has system Administration role, however he wants System Administrator. Let me know how to change it.
    Thanks,
    -vinod

    Please suggest me how to modify the user responsibility in oracle apps 11i.
    I have a user, he has system Administration role, however he wants System Administrator. Let me know how to change it.You can assign responsibilities from (System Administrator responsibility > Security > User > Define). If you want to end-date the other responsibility/role then you can do from the same screen or from User Management responsibility.
    Thanks
    Hussein

  • Modify Servlet response using filter

    This is the code wht i am using, this is an example give in the oronserver.com and some other sites too..
    import javax.servlet.*;
    public class GenericFilter implements javax.servlet.Filter {
    public FilterConfig filterConfig;
    public void doFilter(final ServletRequest request,
    final ServletResponse response,
    FilterChain chain)
    throws java.io.IOException, javax.servlet.ServletException {
    chain.doFilter(request,response);
    public void init(final FilterConfig filterConfig) {     this.filterConfig = filterConfig;
    public void destroy() {                                             
    =============================================================
    import javax.servlet.*;
    import javax.servlet.http.*;
    import java.io.*;
    public class FilterServletOutputStream extends ServletOutputStream {
    private DataOutputStream stream;
    public FilterServletOutputStream(OutputStream output) {
    stream = new DataOutputStream(output);
    public void write(int b) throws IOException {
    stream.write(b);
    public void write(byte[] b) throws IOException {
    stream.write(b);
    public void write(byte[] b, int off, int len) throws IOException {
    stream.write(b,off,len);
    ===================================================
    import javax.servlet.*;
    import javax.servlet.http.*;
    import java.io.*;
    public class GenericResponseWrapper extends HttpServletResponseWrapper {
    private ByteArrayOutputStream output;
    private int contentLength;
    private String contentType;
    public GenericResponseWrapper(HttpServletResponse response) {
    super(response);
    output=new ByteArrayOutputStream();
    public byte[] getData() {
    return output.toByteArray();
    public ServletOutputStream getOutputStream() {
    return new FilterServletOutputStream(output);
    public PrintWriter getWriter() {
    return new PrintWriter(getOutputStream(),true);
    public void setContentLength(int length) {
    this.contentLength = length;
    super.setContentLength(length);
    public int getContentLength() {
    return contentLength;
    public void setContentType(String type) {
    this.contentType = type;
    super.setContentType(type);
    public String getContentType() {
    return contentType;
    ===========================================================
    import javax.servlet.*;
    import javax.servlet.http.*;
    import java.io.*;
    public class PrePostFilter extends GenericFilter {
    public void doFilter(final ServletRequest request,
    final ServletResponse response,
    FilterChain chain)
    throws IOException, ServletException {
    OutputStream out = response.getOutputStream();
    out.write("<HR>PRE<HR>".getBytes());
    GenericResponseWrapper wrapper = new
    GenericResponseWrapper((HttpServletResponse) response);
    chain.doFilter(request,wrapper);
    out.write(wrapper.getData());
    out.write("<HR>POST<HR>".getBytes());
    out.close();
    ===========================================================
    filter3.jsp
    <HTML>
    <HEAD>
    <TITLE>Filter Example 3</TITLE>
    </HEAD>
    <BODY>
    This is a testpage. You should see<br>
    this text when you invoke filter3.jsp, <br>
    as well as the additional material added<br>
    by the PrePostFilter.
    <br>
    </BODY>
    </HTML
    When i run the above code i am not getting data which is there in the jsp page, i am getting data which i am writing it in the prepostFilter.
    the output is
    PRE
    Post
    Is the above is overwriting the actual response ?
    If so can anyone tell me how to modify the response of the servlet instead of overwriting.............i will so thankful to you.

    i run your codes and get the following:
    PRE
    This is a testpage. You should see
    this text when you invoke filter3.jsp,
    as well as the additional material added
    by the PrePostFilter.
    POST
    my testing environment is
    sun j2ee ri 1.3.1
    and i deploy filter3.jsp and set the filter Mapping as the following
    Filter Name: PrePostFilter
    Target Type: Url Pattern
    Target : /*

  • Jsp waiting for servlet response how to make

    Hi All,
    i have some doubts about making servlet response for jsp request
    Am watched some online reservation sites it search some hotel names untill the hotel names display (between that time)
    the image processing shows how can i make like that via jsp and servlet plz expalin with example code plz.
    how to make jsp wait to servlet response like that plz reply
    Thanks

    It's a client side thing. Learn Javascript (and CSS) and if necessary also learn Ajax afterwards. There are nice tutorials at w3schools.com. This issue is not really related to JSP/Servlets.
    Displaying the progress image isn't that hard. Just show some <div> element with an image during the onclick.

  • Error 500--Internal Server Error:How to modify req.setReportAbsolutePath

    I test a servlet but I get following errors. I use OBIEE 11g and Jdeveloper 11.1.1.3
    How to modify the source code and the req.setReportAbsolutePath?
    ===============error====================
    http://127.0.0.1:7101/Application4-Project4-context-root/bipservlettest
    Error 500--Internal Server Error
    java.lang.NullPointerException
         at java.io.OutputStream.write(OutputStream.java:58)
         at mywebcenter.BipServletTest.doGet(BipServletTest.java:75)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:707)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:820)
         at weblogic.servlet.internal.StubSecurityHelper$ServletServiceAction.run(StubSecurityHelper.java:227)
         at weblogic.servlet.internal.StubSecurityHelper.invokeServlet(StubSecurityHelper.java:125)
         at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:300)
         at weblogic.servlet.internal.TailFilter.doFilter(TailFilter.java:26)
         at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
         at oracle.dms.wls.DMSServletFilter.doFilter(DMSServletFilter.java:330)
         at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
         at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.doIt(WebAppServletContext.java:3684)
         at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(WebAppServletContext.java:3650)
         at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321)
         at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:121)
         at weblogic.servlet.internal.WebAppServletContext.securedExecute(WebAppServletContext.java:2268)
         at weblogic.servlet.internal.WebAppServletContext.execute(WebAppServletContext.java:2174)
         at weblogic.servlet.internal.ServletRequestImpl.run(ServletRequestImpl.java:1446)
         at weblogic.work.ExecuteThread.execute(ExecuteThread.java:201)
         at weblogic.work.ExecuteThread.run(ExecuteThread.java:173)
    ========source code============
    package mywebcenter;
    import java.io.IOException;
    import java.io.PrintWriter;
    import javax.servlet.*;
    import javax.servlet.http.*;
    import com.oracle.xmlns.oxp.service.publicreportservice.AccessDeniedException;
    import com.oracle.xmlns.oxp.service.publicreportservice.AccessDeniedException_Exception;
    import com.oracle.xmlns.oxp.service.publicreportservice.DeliveryRequest;
    import com.oracle.xmlns.oxp.service.publicreportservice.InvalidParametersException;
    import com.oracle.xmlns.oxp.service.publicreportservice.InvalidParametersException_Exception;
    import com.oracle.xmlns.oxp.service.publicreportservice.LocalDeliveryOption;
    import com.oracle.xmlns.oxp.service.publicreportservice.OperationFailedException;
    import com.oracle.xmlns.oxp.service.publicreportservice.OperationFailedException_Exception;
    import com.oracle.xmlns.oxp.service.publicreportservice.PublicReportService;
    import com.oracle.xmlns.oxp.service.publicreportservice.PublicReportServiceClient;
    import com.oracle.xmlns.oxp.service.publicreportservice.PublicReportServiceService;
    import com.oracle.xmlns.oxp.service.publicreportservice.ReportRequest;
    import com.oracle.xmlns.oxp.service.publicreportservice.ReportResponse;
    import com.oracle.xmlns.oxp.service.publicreportservice.ScheduleRequest;
    import java.io.IOException;
    import java.io.OutputStream;
    import java.io.PrintWriter;
    import java.net.URL;
    import javax.servlet.*;
    import javax.servlet.http.*;
    import javax.xml.namespace.QName;
    public class BipServletTest extends HttpServlet {
    private static final String CONTENT_TYPE =
    "text/html; charset=windows-1252";
    private static PublicReportServiceService publicReportServiceService;
    public void init(ServletConfig config) throws ServletException {
    super.init(config);
    public void doGet(HttpServletRequest request,
    HttpServletResponse response) throws ServletException,
    IOException {
    response.setContentType(CONTENT_TYPE);
    OutputStream os = response.getOutputStream();
    //PrintWriter out = response.getWriter();
    String sid = "";
    System.out.println("===57===");
    publicReportServiceService = new PublicReportServiceService(new URL("http://localhost:9704/xmlpserver/services/PublicReportService"),
    new QName("http://xmlns.oracle.com/oxp/service/PublicReportService",
    "PublicReportServiceService"));
    PublicReportService publicReportService =
    publicReportServiceService.getPublicReportService();
    //To get a session id
    System.out.println("===64===");
    try {
    sid = this.getSessionID("weblogic", "welcome1", publicReportService);
    } catch (AccessDeniedException_Exception e) {
    System.out.println("invalid user");
    //To generate a report and display it
    System.out.println("===72===");
    ReportResponse res = this.getReportInSession(publicReportService, sid);
    byte[] binaryBytes = res.getReportBytes();
    os.write(binaryBytes);
    response.setContentType(res.getReportContentType());
    public String getSessionID(String username, String password, PublicReportService publicReportService) throws AccessDeniedException_Exception {
    String sid = publicReportService.login(username, password);
    return sid;
    public ReportResponse getReportInSession(PublicReportService publicReportService,
    String sid) {
    ReportRequest req = new ReportRequest();
    ReportResponse res = new ReportResponse();
    System.out.println("===89===");
    req.setAttributeFormat("pdf");
    req.setAttributeLocale("en-US");
    req.setAttributeTemplate("Simple");
    req.setReportAbsolutePath("E:\\OracleBI_win2008_32_20101206\\user_projects\\domains\\bifoundation_domain\\config\\bipublisher\\repository\\Reports\\Samples\\11g Overview\\W2 2010.xdo");
    //req. setSizeOfDataChunkDownload (-1); //download all
    try {
    System.out.println("99");
    res = publicReportService.runReportInSession(req, sid);
    System.out.println("101");
    System.out.println("===100==="+res.getReportContentType());
    } catch (Exception e) {
    System.out.println(e);
    System.out.println("===107===");
    return res;
    ============Jdeveloper console==================
    [Another instance of the application is running on the server.  JDeveloper redeploy the application.]
    [Application Application4 stopped but not undeployed from Server Instance IntegratedWebLogicServer]
    [Running application Application4 on Server Instance IntegratedWebLogicServer...]
    [12:45:14 PM] ---- Deployment started. ----
    [12:45:14 PM] Target platform is (Weblogic 10.3).
    [12:45:14 PM] Retrieving existing application information
    [12:45:14 PM] Running dependency analysis...
    [12:45:14 PM] Deploying 2 profiles...
    [12:45:15 PM] Wrote Web Application Module to C:\Users\Administrator\AppData\Roaming\JDeveloper\system11.1.1.3.37.56.60\o.j2ee\drs\Application4\Project4WebApp.war
    [12:45:15 PM] WARNING: Connection ApplicationDB has no password. ApplicationDB-jdbc.xml file not generated for connection ApplicationDB.
    [12:45:15 PM] Wrote Enterprise Application Module to C:\Users\Administrator\AppData\Roaming\JDeveloper\system11.1.1.3.37.56.60\o.j2ee\drs\Application4
    [12:45:15 PM] Redeploying Application...
    [12:45:17 PM] Application Redeployed Successfully.
    [12:45:17 PM] The following URL context root(s) were defined and can be used as a starting point to test your application:
    [12:45:17 PM] http://192.168.1.17:7101/Application4-Project4-context-root
    [12:45:17 PM] Elapsed time for deployment: 4 seconds
    [12:45:17 PM] ---- Deployment finished. ----
    Run startup time: 3547 ms.
    [Application Application4 deployed to Server Instance IntegratedWebLogicServer]
    Target URL -- http://127.0.0.1:7101/Application4-Project4-context-root/bipservlettest
    ===57===
    ===64===
    ===72===
    ===89===
    99
    javax.xml.ws.soap.SOAPFaultException: oracle.xdo.webservice.exception.OperationFailedException: PublicReportService::generateReport failed: due to oracle.xdo.servlet.CreateException: Report definition not found:E:\OracleBI_win2008_32_20101206\user_projects\domains\bifoundation_domain\config\bipublisher\repository\Reports\Samples\11g Overview\W2 2010.xdo
    ===107===
    <Dec 8, 2010 12:45:24 PM PST> <Error> <HTTP> <BEA-101020> <[ServletContext@26496369[app:Application4 module:Application4-Project4-context-root path:/Application4-Project4-context-root spec-version:2.5]] Servlet failed with Exception
    java.lang.NullPointerException
         at java.io.OutputStream.write(OutputStream.java:58)
         at mywebcenter.BipServletTest.doGet(BipServletTest.java:75)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:707)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:820)
         at weblogic.servlet.internal.StubSecurityHelper$ServletServiceAction.run(StubSecurityHelper.java:227)
         Truncated. see log file for complete stacktrace
    >
    <Dec 8, 2010 12:45:24 PM PST> <Notice> <Diagnostics> <BEA-320068> <Watch 'UncheckedException' with severity 'Notice' on server 'DefaultServer' has triggered at Dec 8, 2010 12:45:24 PM PST. Notification details:
    WatchRuleType: Log
    WatchRule: (SEVERITY = 'Error') AND ((MSGID = 'BEA-101020') OR (MSGID = 'BEA-101017') OR (MSGID = 'BEA-000802'))
    WatchData: DATE = Dec 8, 2010 12:45:24 PM PST SERVER = DefaultServer MESSAGE = [ServletContext@26496369[app:Application4 module:Application4-Project4-context-root path:/Application4-Project4-context-root spec-version:2.5]] Servlet failed with Exception
    java.lang.NullPointerException
         at java.io.OutputStream.write(OutputStream.java:58)
         at mywebcenter.BipServletTest.doGet(BipServletTest.java:75)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:707)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:820)
         at weblogic.servlet.internal.StubSecurityHelper$ServletServiceAction.run(StubSecurityHelper.java:227)
         at weblogic.servlet.internal.StubSecurityHelper.invokeServlet(StubSecurityHelper.java:125)
         at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:300)
         at weblogic.servlet.internal.TailFilter.doFilter(TailFilter.java:26)
         at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
         at oracle.dms.wls.DMSServletFilter.doFilter(DMSServletFilter.java:330)
         at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
         at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.doIt(WebAppServletContext.java:3684)
         at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(WebAppServletContext.java:3650)
         at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321)
         at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:121)
         at weblogic.servlet.internal.WebAppServletContext.securedExecute(WebAppServletContext.java:2268)
         at weblogic.servlet.internal.WebAppServletContext.execute(WebAppServletContext.java:2174)
         at weblogic.servlet.internal.ServletRequestImpl.run(ServletRequestImpl.java:1446)
         at weblogic.work.ExecuteThread.execute(ExecuteThread.java:201)
         at weblogic.work.ExecuteThread.run(ExecuteThread.java:173)
    SUBSYSTEM = HTTP USERID = <WLS Kernel> SEVERITY = Error THREAD = [ACTIVE] ExecuteThread: '1' for queue: 'weblogic.kernel.Default (self-tuning)' MSGID = BEA-101020 MACHINE = WIN-IT8WDLG81KH TXID = CONTEXTID = 55211ca27b9d1dfd:bd42a62:12cc7606a10:-8000-000000000000009c TIMESTAMP = 1291841124147
    WatchAlarmType: AutomaticReset
    WatchAlarmResetPeriod: 30000
    >
    <Dec 8, 2010 12:45:34 PM PST> <Alert> <Diagnostics> <BEA-320016> <Creating diagnostic image in c:\users\administrator\appdata\roaming\jdeveloper\system11.1.1.3.37.56.60\defaultdomain\servers\defaultserver\adr\diag\ofm\defaultdomain\defaultserver\incident\incdir_12 with a lockout minute period of 1.>

    am able to login
    http://192.168.75.140:7001/console/login/LoginForm.jsp
    from this environment-> servers-> all servers(adminserver,soa_server1, oim_server1, oam_server1) status is running,and health is ok.
    I have started these servers from command line <base_domain/bin/sh startManagedWebLogic.sh oim_server1
    result is <server started in running mode>
    now I shutdown the oam_server1 and oim_server1
    again I started the oim_server1 as above
    command line result is < <May 30, 2013 7:54:47 PM IST> <Notice> <WebLogicServer> <BEA-000360> <Server started in RUNNING mode>
    but in (http://localhost:7001/console) window oim_server1 status is unknown...

  • How to do Applet/Servlet permanent interactive connection

    Hi, I'm modifying an Instant Messaging Application originally implemented under the Applet client/standalone-server scheme that I'm implementing now under the Applet/Servlet scheme using HTTP Tunneling with Object Serialization. But this yet don't work correctly because the connection's flows are closed ever after a Servlet's response to a client request (in this moment are close the connection's flows). I'm using flows of type ObjectInputStream and ObjectOutputStream using Object Serialization with HTTP Tunneling.
    this is part of the connection code in the servlet side:
    public void doGet (HttpServletRequest request, HttpServletResponse response) throws
    ServletException, IOException{
    doPost( request, response);
    public void doPost(HttpServletRequest request, HttpServletResponse response) throws
    ServletException, IOException{
    is = new ObjectInputStream(
    new BufferedInputStream(request.getInputStream()));
    try{  
    response.setStatus(HttpServletResponse.SC_OK);
    out = new ObjectOutputStream (
    new BufferedOutputStream (response.getOutputStream ()));
    out.writeObject("OK");
    out.flush();
    // Send the input and output flows to the Thread the Handle the client Connection
    newUser(is, out);
    } catch(Exception ex){
    System.err.println("Exc1: "+ex.toString());
    ex.printStackTrace();
    Run Method to read client request:
    public void run() {
    SocketData sd;
    while ((sd = readObject()) != null) {                               
    sd.performAction(this);
    close();
    After a servlet response in the readObject() method the input flow is closed in the reader request of clients and the connection between the applet (client) and servlet is lost.
    How to can implement a smarter HTTP Tunneling with permanent interactive connection beetween the Applet and Servlet such as in the Applet /server Standalone connection using TCP/IP Socket connection.
    Is possible the use of TCP/IP Sockets in the implementation of HTTP Tunneling with Object Serialization in the Applet/Servlet permanent interactive communication scheme?
    some links or code samples?
    Please show me the ligth.
    Thanks greatly a smarter help.

    I'm not sure that I fully understand your problem, but HTTP is a stateless protocol. That means request-response pairs are completely separated from each other.
    You should ask yourself if you really need to use HTTP and a servlet or if a raw TCP/IP communication would be a better approach to your problem.

  • How to modify a column name & How to modify a constraint name

    How to modify a column name?
    How to modify a primary key constraint name if the pk has been referenced by another foreign key?
    Thanks.

    Hi,
    What version of oracle are you using? If it is 9i,
    then you can the command
    alter table <table_name> rename column <column_name> to <new_column>;
    if it is 8i or earlier, you can create a view with the required names.
    hth
    Always post the oracle version and the platform you are using to get better response.

  • HTTP Header in Servlet-Response

    Hi,
    I have to add a header line to a Servlet-Response: 'msgid: 1234'.
    Have no idea how to do that, can anybody help?
    Thanks in advance
    Karsten

    Hi Karsten,
    http://java.sun.com/products/servlet/2.2/javadoc/javax/servlet/http/HttpServletResponse.html#setHeader(java.lang.String,%20java.lang.String)
    Hope it helps
    Detlev

  • Concurrent processing of POST requests and automatic flushing of the servlet response buffer in WLS6.1.

              Hi all,
              I encountered the following 2 servlet problems in WLS 6.0/ 6.1:
              1. Processing concurrent POST requests
              WLS seems to disallow concurrent executions of any servlet's doPost servlet method.
              When two clients attempt to send a request to a servlet using POST, the socond
              one
              is blocked until the first customer is served. In essence, the servlet ends up
              operating in
              1-user mode. I just learned from Jervis Liu that the problem is solved in WLS6.0
              if you disable http-keepalive.
              For WLS 6.1 a partial workaround is to make the servlet work in a single-thread
              mode (by implementing the javax.servlet.SingleThreadModel interface). In this
              case,
              WLS dispatches concurrent requests to different instances of the servlet.
              This doesn't completely eliminate the problem - still only one customer can be
              connected at a time. The improvement is that once the first customer is disconnects,
              the second can be served even if the doPost method for the first has not finished
              yet.
              2. Flushing the response buffer in WLS 6.1
              The servlet response buffer is not flushed automatically until doPost ends, unless
              you
              explicitly call response.flushBuffer(). Closing the output stream doesn't flush
              the
              buffer as per the documentation.
              I see that other people are experiencing the same problems.
              Has anyone found any solutions/workarounds or at least an explanation.
              Any input would be highly appreciated.
              Thanks in advance.
              Samuel Kounev
              

    Thanks for replying. Here my answers:
              > Did you mark your doPost as synchronized?
              No.
              > Also, try testing w/ native i/o vs not ... is there a difference?
              With native I/O turned off I get a little lower performance, but the
              difference is not too big.
              Best,
              Samuel Kounev
              > Peace,
              >
              > --
              > Cameron Purdy
              > Tangosol Inc.
              > << Tangosol Server: How Weblogic applications are customized >>
              > << Download now from http://www.tangosol.com/download.jsp >>
              >
              > "Samuel Kounev" <[email protected]> wrote in message
              > news:[email protected]...
              > >
              > > Hi all,
              > >
              > > I encountered the following 2 servlet problems in WLS 6.0/ 6.1:
              > >
              > > 1. Processing concurrent POST requests
              > >
              > > WLS seems to disallow concurrent executions of any servlet's doPost
              > servlet method.
              > >
              > > When two clients attempt to send a request to a servlet using POST, the
              > socond
              > > one
              > > is blocked until the first customer is served. In essence, the servlet
              > ends up
              > > operating in
              > > 1-user mode. I just learned from Jervis Liu that the problem is solved in
              > WLS6.0
              > >
              > > if you disable http-keepalive.
              > >
              > > For WLS 6.1 a partial workaround is to make the servlet work in a
              > single-thread
              > >
              > > mode (by implementing the javax.servlet.SingleThreadModel interface). In
              > this
              > > case,
              > > WLS dispatches concurrent requests to different instances of the servlet.
              > > This doesn't completely eliminate the problem - still only one customer
              > can be
              > >
              > > connected at a time. The improvement is that once the first customer is
              > disconnects,
              > > the second can be served even if the doPost method for the first has not
              > finished
              > > yet.
              > >
              > > 2. Flushing the response buffer in WLS 6.1
              > > The servlet response buffer is not flushed automatically until doPost
              > ends, unless
              > > you
              > > explicitly call response.flushBuffer(). Closing the output stream doesn't
              > flush
              > > the
              > > buffer as per the documentation.
              > >
              > > I see that other people are experiencing the same problems.
              > >
              > > Has anyone found any solutions/workarounds or at least an explanation.
              > > Any input would be highly appreciated.
              > >
              > > Thanks in advance.
              > >
              > > Samuel Kounev
              =====================================================
              Samuel D. Kounev
              Darmstadt University of Technology
              Department of Computer Science
              DVS1 - Databases & Distributed Systems Group
              Tel: +49 (6151) 16-6231
              Fax: +49 (6151) 16-6229
              E-mail: mailto:[email protected]
              http://www.dvs1.informatik.tu-darmstadt.de
              http://skounev.cjb.net
              =====================================================
              [att1.html]
              

  • How to create the servlet as acontroller  and how to use it

    how to create the servlet as acontroller and how to use it

    >
    John
    Please update your forum profile with a real handle instead of "914824".
    When you have a problem you'll get a faster, more effective response by including as much relevant information as possible upfront. This should include:
    <li>Full APEX version
    <li>Full DB/version/edition/host OS
    <li>Web server architecture (EPG, OHS or APEX listener/host OS)
    <li>Browser(s) and version(s) used
    <li>Theme
    <li>Template(s)
    <li>Region/item type(s)
    With APEX we're also fortunate to have a great resource in apex.oracle.com where we can reproduce and share problems. Reproducing things there is the best way to troubleshoot most issues, especially those relating to layout and visual formatting. If you expect a detailed answer then it's appropriate for you to take on a significant part of the effort by getting as far as possible with an example of the problem on apex.oracle.com before asking for assistance with specific issues, which we can then see at first hand.
    I am going to have over 50 buttons in a page, Why? This would be a most unusual UI paradigm. I've never seen such a page, which suggests that whatever you want to do is normally done another way. Please explain the requirement in more detail.
    just wanted to know if its possible to do something like this in java.
    Java is not used in programming APEX UI behaviour. Java and JavaScript may share initial syllables, but they are not closely related.
    It's possible to achieve a great deal in JavaScript, but a clear definition of the requirements is necessary. Do you mean the buttons should be dynamically generated? If so, yes, this is possible in JavaScript. What would drive the process?
    Also, i would like to have dynamic action on it, for example, when the button is pressed, fill a string of text into other items(text field) within the page. Without more detail its not possible to make any specific suggestions. For example, I certainly would not want to create 50+ individual dynamic actions relating to different buttons.

  • How to add HTTP Header Response X-Frame-Options:SAMEORIGIN from OWA published via Forefront TMG 2010 to stop Clickjacking

    How to add HTTP Header Response X-Frame-Options:SAMEORIGIN from OWA published via Forefront TMG 2010 to stop Clickjacking. I have put the IIS setting X-Frame-Options:SAMEORIGIN  on my Internal CAS Server. However as the OWA page is published through
    Forefront TMG 2010, the iFrame tag is not blocked when the page is first opened. Only when you login with your credentials to the OWA page inside the frame and the page reaches IIS on the Internal CAS it gets blocked. I want to block it in the first
    instance when it is opened from TMG.

    Hi,
    Thank you for the post.
    To modify the http header, please refer to this blog:
    http://tmgblog.richardhicks.com/2009/03/27/using-the-isa-http-filter-to-modify-via-headers-and-prevent-information-disclosure/
    Regards,
    Nick Gu - MSFT

  • How to Compali this SERVLET????

    This is how my servlet class looks like. Any body can give me some hints on how to compile this servlet class.
    import java.io.*;
    import java.util.*;
    import javax.servlet.*;
    import javax.servlet.http.*;
    public class Form extends HttpServlet {
         public void doGet(HttpServletRequest request, HttpServletResponse response)
         throws ServletException, IOException {
         response.setContentType("text/html");
         PrintWriter out = response.getWriter();
         String title = "Investment Form";
         out.println(ServletUtilities.headWithTitle(title) +
              "<BODY BGCOLOR=\"#FDF5E6\">\n" +
              "<H1 ALIGN=CENTER>" + title + "</H1>\n" +
              "<UL>\n" +
              " <LI><B>MEMBER</B>: "
              + request.getParameter("MEMBER") + "\n" +
              " <LI><B>Name</B>: "
              + request.getParameter("Name") + "\n" +
              " <LI><B>SSN</B>: "
              + request.getParameter("SSN ") + "-"
              + request.getParameter("SSNn ") + "-"
              + request.getParameter("mem_ssn") +
              " <LI><B>Account</B>: "
              + request.getParameter("Account") + "\n" +
              " <LI><B>Address1</B>: "
              + request.getParameter("Address1") + "\n" +
              " <LI><B>Address2</B>: "
              + request.getParameter("Address2") + "\n" +
              " <LI><B>City</B>: "
              + request.getParameter("City") + "\n" +
              " <LI><B>State</B>: "
              + request.getParameter("State") + "\n" +
              " <LI><B>ZIP</B>: "
              + request.getParameter("ZIP") + "\n" +
              " <LI><B>WorkPhone</B>: "
              + request.getParameter("WorkPhone") + "\n" +
              " <LI><B>HomePhone</B>: "
              + request.getParameter("HomePhone") + "\n" +
              " <LI><B>Email</B>: "
              + request.getParameter("Email") + "\n" +
              " <LI><B>Amount</B>: "
              + request.getParameter("Amount") + "\n" +
              "</UL>\n" +
              "</BODY></HTML>");
              

    You can compile your servlet as you do for ordinary classes.
    like
    javac servletfile.java
    but do check before you compile that, your servlet.jar or j2ee.jar is there in class path or not.
    after compilation put your servlet class in the classes dierectory of your Webserver.

  • IOException - WEB8001 - when writing to servlet response outputstream

    I am attempting to port a Java servlet application from iws 6.0 to 6.1, sp2, but am encountering IOExceptions during load testing.
    The servlet composes its response in a character array, and then calls the following method to write the characters to the servlet response object:
    static void writeResponse( HttpServletResponse response, char[] chars, String charset ) throws IOException {
        OutputStreamWriter writer =
            new OutputStreamWriter( response.getOutputStream(), charset );
        char[] buffer = new char[8192];
        CharArrayReader reader = new CharArrayReader( chars );
        int read = 0;
        while(( read = reader.read( buffer, 0, 8192 )) > -1 )
           writer.write( buffer, 0, read );
        writer.close();
    }Under moderate load (2-4 simultaneous connections), an IOException will sometimes be thrown. The stack dump is:
    java.io.IOException: WEB8001: Write failed
         at com.iplanet.ias.web.connector.nsapi.NSAPIConnector.write(NSAPIConnector.java:750)
         at com.iplanet.ias.web.connector.nsapi.NSAPIResponseStream.write(NSAPIResponseStream.java:74)
         at org.apache.catalina.connector.ResponseBase.flushBuffer(ResponseBase.java:765)
         at org.apache.catalina.connector.HttpResponseBase.flushBuffer(HttpResponseBase.java:779)
         at com.iplanet.ias.web.connector.nsapi.NSAPIResponse.flushBuffer(NSAPIResponse.java:127)
         at org.apache.catalina.connector.ResponseBase.write(ResponseBase.java:738)
         at org.apache.catalina.connector.ResponseStream.write(ResponseStream.java:325)
         at sun.nio.cs.StreamEncoder$CharsetSE.writeBytes(StreamEncoder.java:336)
         at sun.nio.cs.StreamEncoder$CharsetSE.implWrite(StreamEncoder.java:395)
         at sun.nio.cs.StreamEncoder.write(StreamEncoder.java:136)
         at java.io.OutputStreamWriter.write(OutputStreamWriter.java:191)
         at eng.pubs.servlet.DocServlet.writeResponse(DocServlet.java:1034)The exception is not thrown consistently for any given URL, but appears to be random. When run under iws 6.0, the exceptions do not occur at all. Most of the time, the method will have written 32K
    of data when the exception is thrown.
    Any clues about how I might debug this?

    What are you using as your test client?The test client is WebStone 1.0. WebStone always downloads the whole response, and reports the size of the response in bytes. From this I can see that when the IO exception occurs, webstone is unable to read the whole response, as it reports a smaller size.
    So, I do not think the problem is that the client has prematurely aborted its download. WebStone doesn't work that way. I think something has gone awry on the server side, and this worries me.

  • How to run a servlet in Tomcat 5.0 server

    HI Everybody,
    I want to know how to run the servlet file on my tomcat 5.0 server. that is where to place a class file and deployment details.
    Thanks In ADVANCE

    Sourav_cs wrote:
    I am a biginner to start servlet i get confusion to configure servlet in tomcat 5 where it should be saved in tomcat directory and how to execute that as first timeHi,
    goto
    tomcat 5.0\webappsnow create a folder here. this is your webapplication project name. Let's suppose it as "TestApp"
    inside this create directories as follows :
    TestApp
            |
            |-----JSP/htmls( if you have any )
            |
            |-----WEB-INF(File Folder)
                       |
                       |-----web.xml
                       |-----lib ( Directory. place all the .jar files which are required for this project(if any) )
                       |-----classes ( .class files. )[all of your java code should be placed here.](servlets / beans/ pojo )this is the general Directory structure of a web application. now you've to place the compiled .class file of your servlet in the "TestApp\WEB-INF\classes" directory. make sure that you've configured the servlet in Deploment Desctiptor, i.e, web.xml.
    now start the server and type the url like : "http://localhost:8080/TestApp/TestServlet"
    the port no. 8080 is the default port no. of tomcat. you have to give your port no. if u've modified it. and TestServlet is the <url-pattern> of your servlet.
    go through some tutorials .. then you can easily know that
    Diablo

Maybe you are looking for

  • How to move the custom hooks in /etc/rc.d/functions.d to systemd

    I have a few scripts placed in /etc/rc.d/functions.d that were launched during the boot process. Now I moved to systemd but I have not found any documentation about how to implement those hooks in the new boot process. As far as I got I need to write

  • File Size Discrepancy Between Photoshop & the Finder

    I'm trying to be as brief as I can, so here goes. The specific application (PS) is irrelevant, I think. This is about why an app shows one file size & the Finder shows a different file size. In this case, it's a huge difference, due to the file being

  • ECC Best Practice for BOBJ

    Hi Guys, Can anyone please provide me the documents for ECC best practice for BOBJ. particularly the best practice to define the Infosets in ECC? Thanks much for your help VJ

  • Installing windows 7 drivers on the notebook pavilion g6-2400ca

    Hi, i just installed windows 7 instead of windows 8 on my notebook pavilion g6 2400ca, and i'm missing some drivers. Here are the needed drivers, can you help please? Bluetooth controller: PCI\VEN_1814&DEV_3298&REV_00 PCI\VEN_1814&DEV_3298 PCI\VEN_18

  • Adobe Creative Suite 3 und Vista Home Premium

    Hallo, ich habe einen PC mit Vista Home Premium. Heute habe ich versucht die Adobe Creatve Suite 3 Premium zu installieren. Die Installation läuft auch durch. Aber das Aktivierungsfenster öffnet sich nicht. Wenn ich den Acrobat 8 Professional öffne e