Changing referer inside a servlet

Hi,
I have a servlet which send some html content to the client browser. from there it gets redirected to some site where i get the referer and the Url address of my servlet. Is there any was by which i can change the referer inside my servlet or the html content i send. so that after the redirection from the browser i need to see the referer which i have set.
Thanks in advance !
Pushpak

try this:
String referer = "blablabla";
response.setHeader("Referer", referer);
NB: you must do this before writing the content of your response body.

Similar Messages

  • How do i create a single instance of a class inside a servlet ?

    how do i create a single instance of a class inside a servlet ?
    public void doGet(HttpServletRequest request,HttpServletResponseresponse) throws ServletException, IOException {
    // call a class here. this class should create only single instance, //though we know servlet are multithreaded. if, at any time 10 user comes //and access this servlet still there would one and only one instance of //that class.
    How do i make my class ? class is supposed to write some info to text file.

    i have a class MyClass. this class creates a thread.
    i just want to run MyClass only once in my servlet. i am afriad, if there are 10 users access this servlet ,then 10 Myclass instance wouldbe created. i just want to avoid this. i want to make only one instance of this class.
    How do i do ?
    they have this code in the link you provided.
    public class SingletonObject
      private SingletonObject()
        // no code req'd
      public static SingletonObject getSingletonObject()
        if (ref == null)
            // it's ok, we can call this constructor
            ref = new SingletonObject();          
        return ref;
      public Object clone()
         throws CloneNotSupportedException
        throw new CloneNotSupportedException();
        // that'll teach 'em
      private static SingletonObject ref;
    }i see, they are using clone !, i dont need this. do i ? shouldi delete that method ?
    where do i put my thread's run method in this snippet ?

  • Why can´t i change language inside PsCC from Danish to English? Instead of going into Program:Adobe. Locales: rename file from .tw10428.dat into tw10428.bat file??

    Why can´t i change language inside PsCC from Danish to English? Instead of going into Program:Adobe. Locales: rename file from .tw10428.dat into tw10428.bat file??

    Creative Cloud Help / Adjust the install language | Creative Cloud applications | CCM -
    http://helpx.adobe.com/creative-cloud/kb/change-installed-language.html

  • How to Buffer JSP Output Inside A Servlet

    Hello, we are trying to Process a JSP page inside a servlet and then do more processing and finnaly add the JSP output to the response output stream. I know there is a RequestDispatcher that lets you include a JSP page. However as far as I know all you can do with the RequestDispatcher is either include the JSP (which does not buffer it but simply adds it to the output stream) or forward to the JSP page. Any ideas? Thanks, - dk

    http://forum.java.sun.com/thread.jsp?forum=33&thread=377214

  • UOM changes automatically inside the system

    Hi All,
       The UOM is changed automatically inside our system when it sends the PO,
    It is sent 1 box=12 pieces but it gets changed to 1 box=36 pieces in the system,
    Please help how does this happen  and what to do to rectify this.
    thanks in advance.

    Check you mateial master
    additional data- UOM tab that the conversion defined as per your requirements or not?
    if every thing is correct here than check the mateirla master change log if some one changed and change back to original or not?
    all looks fine than check for the OSS note for you system version.

  • Foreground color change from inside a class

    Hey,
    For a project I'm working on, I wrote a class that extends awt.Label. In this new class, I had to override the paramString() method to return what I wanted it to. This all works great. What I was wondering, is whether or not it was possible to change the foreGround color of the label from inside the class decleration. I was thinking maybe whenever the paramString() method was called. Any help would be appreciated.
    Thanks,
    Jarrod

    Gday,
    I you use the mothed setForeground(Color c) it should set the foreground colour (color for you Americans) to what you would like.
    see for more info
    http://java.sun.com/j2se/1.3/docs/api/java/awt/Component.html#setForeground(java.awt.Color)
    or
    http://java.sun.com/j2se/1.4/docs/api/java/awt/Component.html#setForeground(java.awt.Color)
    if you have jdk1.4
    You dont need to make this method in your class just call it when you want. ie
    setForground(Color.RED);
    or
    Color c = new Color(255, 0, 0);
    setForeground(c);
    Good luck,
    Jack 573

  • Is it possoble change interval inside field

    How change line interval in Report 6i interval inside a field with Vertical Elasticity=Variable?
    Or it is inpossible? Did I ever have to create fields for every line
    and split data to them?
    Anatoly.

    Choose Format->Text Spacing and choose approptiate interval.
    This changes interval for all lines of the field.
    It is impossible (afaik) to have, for example, 1/2 interfal between 1st and 2nd lines and 1 1/2 interval between 2nd and 3rd lines of one field.
    In this case you have to split text between fields.

  • Accessing a binding from inside a servlet

    Hey all,
    So I'm attempting to access a binding from a servlet instead of using the ApplicationModule approach which is recognized as a bad idea (http://blogs.oracle.com/jdevotnharvest/2010/11/when_to_use_createrootapplicationmodule_in_oracle_adf.html). However, when the code is executing in the servlet the line BindingContent.getCurrentBindingsEntry() returns null! I think there's something missing in my configuration that's causing ADFm to not recognize the servlet as having a binding file. Anything stand out?
    So inside of a servlet I have the following:
    public class RSSNewsServlet extends HttpServlet {
    public void doGet(HttpServletRequest request,
    HttpServletResponse response)
    throws ServletException, IOException {
    BindingContext bctx = BindingContext.getCurrent();
    BindingContainer bindings = bctx.getCurrentBindingsEntry();
    DCBindingContainer bindingsImpl = (DCBindingContainer)bindings;
    DCIteratorBinding dciter = bindingsImpl.findIteratorBinding("AllPapers1Iterator");
    Row [] rows = dciter.getAllRowsInRange();
    Web.xml:
    <filter-mapping>
    <filter-name>adfBindings</filter-name>
    <servlet-name>NewsServlet</servlet-name>
    <servlet-name>Faces Servlet</servlet-name>
    <dispatcher>FORWARD</dispatcher>
    <dispatcher>REQUEST</dispatcher>
    </filter-mapping>
    <servlet>
    <servlet-name>NewsServlet</servlet-name>
    <servlet-class><path-to-servlet>.RSSNewsServlet</servlet-class>
    </servlet>
    <servlet-mapping>
    <servlet-name>NewsServlet</servlet-name>
    <url-pattern>/servlet/news.rss</url-pattern>
    </servlet-mapping>
    newsServletPageDef.xml:
    <?xml version="1.0" encoding="UTF-8" ?>
    <pageDefinition xmlns="http://xmlns.oracle.com/adfm/uimodel"
    version="11.1.1.56.60" id="newsServletPageDef"
    Package="<path-to-pagedefs>pageDefs">
    <parameters/>
    <executables>
    <variableIterator id="variables"/>
    <iterator Binds="AllPapers1" RangeSize="25"
    DataControl="GatewayNewsAppModuleDataControl"
    id="AllPapers1Iterator"/>
    </executables>
    <bindings>
    <tree IterBinding="AllPapers1Iterator" id="AllPapers1">
    <nodeDefinition DefName="<path-to-model>AllPapers"
    Name="AllPapers10">
    <AttrNames>
    <Item Value="PapId"/>
    <Item Value="PapTitle"/>
    <Item Value="PapPublishDate"/>
    <Item Value="PapExpireDate"/>
    <Item Value="PapAuthor"/>
    <Item Value="PapType"/>
    <Item Value="PapIssueDate"/>
    <Item Value="PapFileName"/>
    <Item Value="PapUserName"/>
    <Item Value="PapPostedDate"/>
    <Item Value="PapModifiedDate"/>
    <Item Value="PapNeverExpire"/>
    <Item Value="PapFile"/>
    </AttrNames>
    </nodeDefinition>
    </tree>
    </bindings>
    </pageDefinition>
    DataBindings.cpx:
    <pageMap>
    <page path="/servlet/news.rss" usageId="MyAlmacTemplate_view_newsServletPageDef"/>
    </pageMap>
    <pageDefinitionUsages>
    <page id="MyAlmacTemplate_view_newsServletPageDef"
    path="com.almac.aurora.gateway.pageDefs.newsServletPageDef"/>
    </pageDefinitionUsages>

    when the code is executing in the servlet the line BindingContent.getCurrentBindingsEntry() returns null!The method BindingContext.getCurrentBindingsEntry() returns from the requestScope the variable with key "bindings". When using ADF Faces this variable is set at ADF Faces' Prepare Model phase (by the PageLifecycleImpl.prepareModel() method). But when using a plain servlet this variable is not set (because the ADF Faces' page lifecycle is not executed) and this is the reason why you get a null result. As a workaround you can use the following code in your servlet:
    BindingContext bctx = BindingContext.getCurrent();
    DCBindingContainer pagedef = bctx.findBindingContainerByPath(request.getServletPath());
    bctx.setCurrentBindingsEntry(pagedef); // Invoke this method only if for some reason you need the "bindings" variable set in the environmentDimitar

  • Change path inside and outside areas in vector mask

    Hey all PS/CS lovers,
         That's probably an easy one, yet, being rather new to this, I have to ask.
         So I have this vector mask on a layer, and while singing along to the Beatles I'm editing paths on it. Well, all it is is a rectangle to reframe a photo, nothing crazy. But that rectangle is too big to my taste - so I just draw another, smaller one inside it and plan on deleting the first one.
         But ! The second, smaller rectangle is viewed as a takeout from the first one (so its inside is considered "black" mask-wise, i.e. cut out, and its outside is "white", i.e. kept in). Thus, when deleting the first, bigger one, the entirety of the picture appears, except for the part I want in the middle, that's cut out ! Yes - that's the opposite of what I want.
         Now, I tried using the path selection tool and changing the fill color of the rectangle, but you can't ... So, how do you invert inside and outside of a closed path ? Thanks in advance !
    Charles

    So, how do you invert inside and outside of a closed path ?
    Select the Path with the Path Selection Tool and in the Options Bar change the Path Operations setting.

  • How to change color inside single item? [SOLVED]

    I'd like to change background color inside item (on blue for ex.: see http://www.marussig.si/weblib/screen.jpg ) . The problem is that the block is multiline block but I have to change the color just on one line in one column. Is this possible? If I use set_item_propery syntaks, the whole item changes the color what I don't want to do.
    thanks for help!
    m.

    emails between two posters is no solution. This forum needs solutions, which each user can participate from. So please refer to a web-space, where your solution is downloadable.

  • How do I change font inside the Form's text fields

    I went through tutorials on lynda.com and succesfuly layed out my form.
    However I can not figure out how to make a change from a default Times Roman in the forms fields to a different typeface.
    I assigned object styles, followed by paragraph styles but nothing happens. I also can not change font color inside the text fields.
    Anyone knows how to change these attributes?

    There are literally hundreds and thousands of improvements or changes that could be made to InDesign.
    Your comments here won't get to the product manager who decides which of those to implement in the next version. This is a forum of users like you, but if you post at the link below and make a good case, you'll have a better chance of getting what you want:
    Adobe - Feature Request/Bug Report Form

  • Change properties inside dynamic stack plots

    Is there any way in LabView 8.2 now to change the properties of indicators inside an array or cluster?  I want to change the properties of the waveforms inside DynamicStackPlots (http://zone.ni.com/devzone/cda/epd/p/id/3024).  I see on this forum back in 2005 this was last discussed.  I have also tried making a cluster of waveforms (instead of an array of clusters) from which you can at least separately access properties (allowing you to make specific waveforms not visible, yielding dynamic stack plot functionality).  But you STILL cannot modify, say, the plot min range, label, scale... etc.
    All ideas welcome!
    Thanks,
    Adam

    Hi, Adam.
    This question seems to pop up every once in a while. The answers are different for arrays and clusters:
    Clusters
    You can access the properties using an explicitly-linked property node (IE, one that takes a control reference as an input). You can obtain a reference to the controls in one of two ways:
      - Right-click on the control (inside the cluster) and select Create»Reference.
      - Create a property node for the cluster and access the Controls[ ] property. This will give you an array of references to the controls inside the cluster, and you can pass that into the explicitly-linked property node. (You may have to use a To More Specific Class VI if you want to access properties that apply to only graphs.)
    Arrays
    Since arrays are for holding a large quantity of indentical data types, the properties for all elements of the array must be the same. If you really want to sidestep this functionality, however, you can always create an array of references to controls. If you wanted to do that, you'd have to create all your controls individually and then create references for them one by one. Once the references are created you can pass them into a Build Array VI. To alter the properties of any particular control, you'd use an explicitly-linked property node and pass in the appropriate reference.
    Let me know if any part of this isn't clear. Have a nice evening!
    Message Edited by sarahk on 10-25-2006 04:35 PM
    Sarah K.
    Search PME
    National Instruments
    Attachments:
    clusterControlReference.GIF ‏6 KB

  • How remove (or change) children inside a JTree

    hi,
    I did a program where there are informations with a structure of dependence that should be showed inside JTree components.
    I realized this purpose in my program .
    But I am findind very difficult (after having put the information inside the JTre in the start) to show them again inside the JTrees when they are changed.
    I don't know how to remove or change the informations after they are put on the children of the JTree using the methods that I found in the documentation to reach this purpose...
    I need some help ...
    To explain well my problem, and facilitate the helpers, I post some code that show my problem..
    The program show a GUI with some JTrees.
    The informations are contained in two strings, and in the GUI are also two buttons that can load the informations inside the JTree when they are clicked.
    Thank you in advance
    regards
    tonyMrsangelo
    public class JTree_TryToUseIt_ChangingNodes extends javax.swing.JFrame {
        private PanelFulViewConteiner jPanelFulViewConteiner;
        Dimension dimPrefArcPanels = new Dimension(910, 150);
        Dimension dimMinArcPanels = new Dimension(700, 100);
        Dimension dimPrefSemiArcPanels = new Dimension(850, 140);
        Dimension dimMinSemiArcPanels = new Dimension(550, 90);
        Dimension dimPrefBodyXpicPanels = new Dimension(900, 150);
        Dimension dimMinBodyXpicPanels = new Dimension(700, 150);
        Dimension treePrefDim = new Dimension(90, 110); //
        Dimension treeMinDim = new Dimension(60, 110);
        PanelToShowTrees panel_trees;
        public JTree_TryToUseIt_ChangingNodes() {
            getContentPane().setLayout(new GridBagLayout());
            GridBagConstraints gBC = new GridBagConstraints();
            jPanelFulViewConteiner = new PanelFulViewConteiner();
            gBC.gridx = 0;
            gBC.gridy = 0;
            gBC.gridwidth = 10;
            add(jPanelFulViewConteiner, new GridBagConstraints());
            gBC.gridx = 0;
            gBC.gridy = 1;
            gBC.gridwidth = 10;
            pack();
            panel_trees = this.jPanelFulViewConteiner.jPanelFulContainerTop.panelToShowTrees;
            setDefaultCloseOperation(EXIT_ON_CLOSE);
            setLocation(50, 50);
            setVisible(true);
        private void fillTrees(String[] strings) {
            collapseTrees();
            removeNodes();
            for (int index = 0; index < strings.length; index++) {
                DefaultMutableTreeNode dmt = new DefaultMutableTreeNode(strings[index]);
                String knotStr = strings[index].substring(0, 1);
                int knot = -1;
                try {
                    knot = Integer.parseInt(knotStr);
                } catch (NumberFormatException e) {
                panel_trees.root_Node[knot].add(dmt);
                panel_trees.validate();
                panel_trees.repaint();
            collapseTrees();
        void collapseTrees() {
            for (int i = 0; i < 8; i++) {
                panel_trees.jTree.collapseRow(0);
    panel_trees.jTree[i].expandRow(0);
    panel_trees.validate();
    panel_trees.repaint();
    void removeNodes() {
    for (int i = 0; i < 8; i++) {
    panel_trees.jTree[i].removeAll();
    panel_trees.validate();
    panel_trees.repaint();
    public static void main(String args[]) {
    JTree_TryToUseIt_ChangingNodes xx = new JTree_TryToUseIt_ChangingNodes();
    class PanelFulViewConteiner extends JPanel {
    PanelFulContainerTop jPanelFulContainerTop;
    PanelFulContainerBottom jPanelFulContainerBottom;
    public PanelFulViewConteiner() {
    GridBagLayout gbl = new GridBagLayout();
    this.setLayout(gbl);
    GridBagConstraints gBC = new GridBagConstraints();
    jPanelFulContainerTop = new PanelFulContainerTop();
    gBC.gridx = 0;
    gBC.gridy = 0;
    add(jPanelFulContainerTop, gBC);
    jPanelFulContainerBottom = new PanelFulContainerBottom();
    gBC.gridx = 0;
    gBC.gridy = 2;
    add(jPanelFulContainerBottom, gBC);
    class PanelFulContainerTop extends JPanel {
    PanelToShowTrees panelToShowTrees;
    public PanelFulContainerTop() { // costruttore
    this.setMinimumSize(dimMinArcPanels);
    this.setPreferredSize(dimPrefArcPanels);
    setLayout(new FlowLayout());
    panelToShowTrees = new PanelToShowTrees();
    add(panelToShowTrees);
    }// costruttore
    class PanelFulContainerBottom extends JPanel {
    JButton but1 = new JButton("load string1");
    JButton but2 = new JButton("load string2");
    String[] str1 = {"0-AAA", "0-BBBBBB", "2-CCCCC", "2-DDDDDD", "2-EEEEEEE", "5-FFFFFF", "5-GGGGGG", "5-HHHHHH", "7-IIIIII", "7-KKKKKKK", "7-LLLLLL", "7-MMMMMM"};
    String[] str2 = {"0-aaaaa", "0-bbbbb", "0-cccc", "2-ddddd", "2-eeee", "3-ffffff", "3-gggggg", "3-hhhhh", "4-iiiiii", "4-kkkkk", "7-lllllll", "7-mmmmm", "7-nnnnn"};
    public PanelFulContainerBottom() {// costruttore
    this.setMinimumSize(dimMinArcPanels);
    this.setPreferredSize(dimPrefArcPanels);
    add(but1);
    but1.addActionListener(new ActionListener() {
    public void actionPerformed(ActionEvent e) {
    fillTrees(str1);
    add(but2);
    but2.addActionListener(new ActionListener() {
    public void actionPerformed(ActionEvent e) {
    fillTrees(str2);
    class PanelToShowTrees extends JPanel {
    JScrollPane jScrollPane[];
    JTree jTree[];
    DefaultMutableTreeNode[] root_Node;
    public PanelToShowTrees() {
    this.setMinimumSize(dimMinSemiArcPanels);
    this.setPreferredSize(dimPrefSemiArcPanels);
    setLayout(new FlowLayout());
    jScrollPane = new JScrollPane[8];
    jTree = new JTree[8];
    root_Node = new DefaultMutableTreeNode[8];
    for (int i = 0; i < 8; i++) {
    root_Node[i] = new DefaultMutableTreeNode(" " + (8 - i));
    jTree[i] = new JTree(root_Node[i]);
    jScrollPane[i] = new JScrollPane();
    jScrollPane[i].setViewportView(jTree[i]);
    add(jScrollPane[i]);
    jScrollPane[i].setPreferredSize(treePrefDim);
    jScrollPane[i].setMinimumSize(treeMinDim);
    jTree[i].addTreeSelectionListener(new TreeSelectionListener() {
    public void valueChanged(TreeSelectionEvent e) {
    showContentOfTheTree(e);
    private void showContentOfTheTree(TreeSelectionEvent e) {
    String stringaGotFromEvent = e.getPath().toString();
    JOptionPane.showMessageDialog(rootPane, "found =---> " + stringaGotFromEvent);

    hi Andre,
    thank you for answering me.
    I have not much practice with JTrees so I find some difficulty to use it...
    After I got your advice, I made changed a little the design of my program..
    This it is a program for management of a dentist office, and I would show in 8 JTrees (every jTree root represents the teeth in a dental arch) the treatments that each tooth got.
    How I said, the 8 JTree roots are representing the teeth, and in this architecture the problem is:
    - to add a node to a tree root to indicate a treatment for that tooth;
    - to delete all the children from a jTree root before beginning to add new child, before writing again treatments, when the informations are changed.
    Following your help, I made this two functions to reach this purpose:
    private void assingTreatmentToTooth(int toothNmbr, String strTreatment) {
            DefaultMutableTreeNode newChild = new DefaultMutableTreeNode(strTreatment); // new treatment to add
            DefaultTreeModel model = (DefaultTreeModel) panel_trees.jTreeXdentalRoots[toothNmbr].getModel(); // get model for the root Tree
            DefaultMutableTreeNode parentNode = (DefaultMutableTreeNode) model.getRoot();
            model.insertNodeInto(newChild, parentNode, 0); // always assign 0 as first node
        } // assingTreatmentToTooth()
    private void removeTreatmentFromAtooth(int toothNmbr, int childNmbr) {
            DefaultTreeModel model = (DefaultTreeModel) panel_trees.jTreeXdentalRoots[toothNmbr].getModel();  // get model for the root Tree
            DefaultMutableTreeNode child = (DefaultMutableTreeNode) model.getChild(model, childNmbr);
            model.removeNodeFromParent(child);
        } // removeTreatmentToTooth()when the second function is executed, I get this error:
    Exception in thread "AWT-EventQueue-0" java.lang.ClassCastException: javax.swing.tree.DefaultTreeModel cannot be cast to javax.swing.tree.TreeNode
    at the line : DefaultMutableTreeNode child = (DefaultMutableTreeNode) model.getChild(model, childNmbr);
    DefaultMutableTreeNode child = (DefaultMutableTreeNode) model.getChild(model, childNmbr);
    could you tell me what is wrong ?
    regards
    TonyMrsangelo

  • Change color inside mask

    hey guys how can i change the color inside a mask? i mean when i trace a mask with rectangle selection i have the yellow border and inside i hve in example the black color if i want to hide something
    how can i make the color inside in example white and not black?

    First of all you need to understand what is going on when you apply a mask.
    Mask cuts hole in a layer (guess, proper word to your current mask settings is 'Subtract').
    If the footage on which you apply the mask is a single layer in your composition, you see the composition background in the 'hole'.
    Therefore, you can either change your composition background colour or place a solid with desired colour below your footage.
    If the footage is not the only layer in a composition, but you still want to see some solid colour inside a hole, whereas other things on a background remain preserved, you can e.g. duplicate your footage with mask, replace lower instanse with a solid (painted to your favourite colour) and invert 'Subtract' to 'Add'.

  • Font size changes randomly inside mail received (sent with Mac Mail)

    Hello! Here is a random issue on Mac Mail Leopard, seems few people already experimented the issue but no one found a correct solution:
    When i send a mail to somebody, we can randomly notice a change of the font size (from 9px to 12px) in the received mail. This appears mostly in sentences after others sentences containing some bold text.
    Note that I use the Calibri font, which is correctly set for the whole mail.
    Appart from starting to write inside the signature to avoid any problem, i didn't find a way yet to fix that issue. But I imagine that if it would be a bug in the software, Apple would have fix it for decades ?..
    So anyone could give an explanation? Thank u!

    Thanks baltwo and Tom. I'll try sending as a PDF file as well.
    Also, I did a test per Tom's instructions about reformatting text. First, I copied text from another email and then pasted it in a new message. I highlighted all the text where I wanted to increase the text size and left one paragraph unchanged.
    I sent the email to the recipient that's having these issues where she replied back with my forwarded email.
    All the text where I increased the point size shrunk and the text that I left alone was actually okay - Weird! I also noticed that the font style changed on their end. By the way, the recipient uses Microsoft Outlook as their email browser.

Maybe you are looking for