Problem with the Value property node (MacOS)
As far as I have tested it, Value Property nodes (and Value (signaling)) don't work in MacOS : The value property appears as a boolean, the value(signaling) as a cluster (width, height).
Even with boolean controls, the node is not working.
No such problem in LV 8.6.
Am-I missing something ? Is that some "intended use" ? Or simply a bug ?
Chilly Charly (aka CC)
E-List Master - Kudos glutton - Press the yellow button on the left...
Solved!
Go to Solution.
That sounds like some sort of indexing problem with the property nodes like somesort of corrupted installation. What if you just delete the property node and recreate it?
I dropped a numeric control and looked at the shortcut menu for the list of property nodes. Right below Value and Value (signalling) are Visible (which would be a boolean) and Xcontrol, which when you step down through the submenus, the first choice is Container bounds, a cluster of Width and Height. So these 2 datatypes that are 2 lower on the list match the ones you are getting.
What happens if you pick another property node a few elements up or down on the shortcut menu? Does is happen for some other properties, and if so, are thereany properties that are okay?
Here is what my property nodes look like for a numeric and I draggged the box up and down to show the natural order of the property nodes. Note that I have scripting installed, so there are a few more property nodes (and the blue box at the top) that you might not have.
PS. Check you signature. The Kudos button is now moved to the left since the forum upgrade.
Attachments:
Example_VI_BD.png 4 KB
Similar Messages
-
Unable to use correctly the value property node in a re-entrant VI
Hi everybody,
I am using labview 6.1 and developing an application which call a reentrant SubVI. However when I use the Value Property Node (which I need : the use of local terminal isn't possible in my final application) in the re-entrant SubVI, i get the initial value of the control, not the current value !?
Is there anybody to explain me why and how to solve this problem ?
I have attached 3 VIs for a better explanation.
Thanks.
Attachments:
Master.vi 9 KB
Slave.vi 23 KB
globales.vi 7 KBYou just need to create a local variable instead of a property node to read the value of the control that was passed in. Popup on the control and select Create >> Local Variable. Or just wire the control to where you need it. Data flow is still working; Feroz just explained an idosyncracy of how property nodes work in reentrant VIs.
BTW - I don't mean to turn this into a sales opportunity, but you might want to check out the VI Analyzer Toolkit. It reports the following for a reentrant VI that uses property nodes:
"You are using an implicit property node in this reentrant VI. This can result in unexpected block diagram behavior, as a reentrant VI will occupy multiple data spaces but will maintain only a single front panel. You should consid
er either making this VI non-reentrant, or eliminating the use of implicit property nodes."
I'm not sure how many people would know what the message means, but they would be forewarned and hopefully check into it further (e.g. test with this specifically in mind).
I filed a bug report to have this investigated further and at least documented better.
Roy -
Why is the Value Property Node of a Typedef control not typedef itself?
This is not preventing me from progressing, but I am puzzled by what I am seeing on one of my diagrams (LV 2011).
I have a typedef control which I am reading around my diagram and passing to some subVI. For this purpose I create a read "Value" Property Node and pass the value to the subVI.
The subVI uses the same typedef control as that in my calling VI but nonetheless there is a coersion dot on my calling VI's diagram when I connect the "Value" to the subVI connector. Why?
The closest to this discussion I found was this old one, but it did not end up with a final answer.... It turns out that the typedef control I am talking about is an enum, but that does not matter.
As a matter of fact, if you connect the Value output of a Property Node to a sequence and create a subVI from that sequence, the corresponding control has lost any link with the typedef. In other words, the Value property node of a typedef control is not a typedef. Why?[...] Why?
Because you haven't posted an idea here.
Well.. maybe you or somebody else has and I missed it, after all there's more than 14k ideas so for just for LabVIEW.. What? Who said that means there's a lot of room for improvement in LabVIEW??
Jokes appart, if there is an idea, please give the link.
When my feet touch the ground each morning the devil thinks "bloody hell... He's up again!" -
I'am having problem with a graph property node by using format & precision
I would like to display an amount of data in a waveform graph and to choose the X scale to display absolute time (whitout date information) or scaled decimal value.
Absolute time is a must because the scaling should reflect the acquisition time and not only a value in hour, minute and second.
Using the property node I can choose between 10 differents formats (0-Decimal, 1-Scientific, 2-Engineering, 3-Binary, 4-Octal, 5-Hexadecimal, 6-Relative Time, 7-Time and Date, 8-SI, and 9-Custom).
Format 7 - Time and Date should be a good choice but LabVIEW set automatically system time AND system date without any possibilities to change anything.
Trying format 9 - Custom ends everytime with error 1077 (invalid property value).
Any help to explain me how to use the format Custom or to give me a solution to switch between time (no date) and decimal scaling is appreciate.
ThankIn addition to the Xscale.Format property node, you also need to set the XScale.FormatString (see a little below the Format entry).
Use %<%.0X>T as format string.
Chilly Charly (aka CC)
E-List Master - Kudos glutton - Press the yellow button on the left... -
CSS problem with the clear property
This is my actual page
http://www.martcol.co.uk/abba/
and I want to swap the paragraphs around. This is what I come up
with
http://www.martcol.co.uk/abba/test/test01.php
I reckon I am getting muddle with the whole clearing the
float thing.
Many thanks
Martin
Actually, I think it only breaks up in Firefox - bear in mind
I only tested in IE6 and FFhttp://martcol.co.uk/abba/pages/patch.php
Oh dear, another problem with my floated elements and the
clear property....
Martin
I think I have this now. Not sure why but picking away at it
has it fixed. -
Problem with the click property in an embeded component
The following code snipit causes the -- 1180: Call to a possibly undefined method myLink. -- compile time error. I've tried making the method public and that doesn't help, so can anyone tell me what's going wrong?
<mx:TileList x="148" y="10" width="411" height="302" rowHeight="140" columnWidth="190"
dataProvider="{clientsList}" backgroundColor="#E9EEF0" rollOverColor="#b1b5b6" click="myLink('{data.link}')">
<mx:itemRenderer>
<mx:Component>
<mx:VBox horizontalAlign="center" verticalAlign="middle" height="140" width="200" horizontalScrollPolicy="off" verticalScrollPolicy="off">
<mx:Image source = "{data.image}" width="120" height="100" toolTip="{data.text}" click="myLink('{data.link}')"/>
<mx:Text width="100%" text="{data.name}" textAlign="center" height="18" fontSize="12" fontFamily="Myriad Pro"/>
</mx:VBox>
</mx:Component>
</mx:itemRenderer>
</mx:TileList>Here tis:
<?xml version="1.0"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml">
<mx:Script>
<![CDATA[
public function myLink(url:String):void{
navigateToURL(new URLRequest('http://www.' + url), '_blank');
]]>
</mx:Script>
<mx:XML xmlns="" id="clientsList">
<items>
<item>
<name>Google's Headquarters</name>
<image>google.png</image>
<link>google.com</link>
<text>A picture of Google's headquarters.</text>
</item>
<item>
<name>Yahoo's Headquarters</name>
<image>yahoo.png</image>
<link>yahoo.com</link>
<text>A picture of Yahoo's headquarters.</text>
</item>
</items>
</mx:XML>
<mx:TileList x="148" y="10" width="411" height="302"
rowHeight="140" columnWidth="190" dataProvider="{clientsList..item}"
backgroundColor="#E9EEF0" rollOverColor="#b1b5b6">
<mx:itemRenderer>
<mx:Component>
<mx:VBox horizontalAlign="center" verticalAlign="middle"
height="140" width="200" horizontalScrollPolicy="off"
verticalScrollPolicy="off">
<mx:Image source = "{data.image}" width="120" height="100"
toolTip="{data.text}" click="outerDocument.myLink(String(data.link));"/>
<mx:Text width="100%" text="{data.name}" textAlign="center"
height="18" fontSize="12" fontFamily="Myriad Pro"/>
</mx:VBox>
</mx:Component>
</mx:itemRenderer>
</mx:TileList>
</mx:Application> -
Function module based generic extractor - Problem with the selection
Hi all
The following is my code in the function module. I am able to get the entire data if i dont give any selections and the number of records is also correct. But when i select a MATNR value, it returns 0 records where as it needs to return 3 records. If i give selection based on bukrs, werks, lgort its working fine. But if i give selection based on MATNR, then it is not working.... I think there is a problem in the bold part of my code. If i debug, LS_MATNR is having the correct value which indicates that there is no problem with the value being passed to LS_MATNR from my selection screen of my datasource in RSA3. Even GT_WERKS is also having data. Please help.
OPEN CURSOR WITH HOLD S_CURSOR FOR
SELECT MARA~MANDT
MARA~MATNR
MARC~WERKS
MARD~LGORT
MARA~MEINS
MARD~LABST
MARD~EINME
MARD~SPEME
MARD~RETME
MARD~INSME
MARD~UMLME
MARD~VMLAB
MARD~VMEIN
MARD~VMSPE
MARD~VMRET
MARD~VMINS
MARD~VMUML
MARC~XCHPF
MARD~KLABS
MARD~KEINM
MARD~KSPEM
MARD~KINSM
from MARA inner join MARC on
MARAMANDT = MARCMANDT AND
MARAMATNR = MARCMATNR
inner join MARD on
MARAMANDT = MARDMANDT AND
MARAMATNR = MARDMATNR
AND MARCWERKS = MARDWERKS
for all entries in gt_werks
where MARC~werks EQ gt_werks-werks
AND MARA~MATNR in LS_MATNR.
ENDIF. "First data package ?
Fetch records into interface table.
named E_T_'Name of extract structure'.
FETCH NEXT CURSOR S_CURSOR
APPENDING CORRESPONDING FIELDS
OF TABLE E_T_DATA
PACKAGE SIZE S_S_IF-MAXSIZE.try this
select marc~matnr MARC~WERKS into t_marc for all entries in gt_werks
where werks EQ gt_werks-werks and lvorm = space.
if t_marc is not initial.
select MARD~LGORT MARD~WERKS MARA~MEINS MARD~LABST MARD~EINME
MARD~SPEME MARD~RETME MARD~INSME MARD~UMLME
MARD~VMLAB MARD~VMEIN MARD~VMSPE MARD~VMRET
MARD~VMINS MARD~VMUML MARC~XCHPF MARD~KLABS
MARD~KEINM MARD~KSPEM MARD~KINSM MARA~MEINS from
mard inner join MARA on mard~matnr = mara~matnr
for all entries in t_marc where mard~matnr = t_marc-matnr and mard-werks = t_marc-matnr
and mard~lvorm = space. -
How do I use the Index Values property node with a multidimensional array.
I am using a 2D array to store operator inputs on my front panel. I only want to display one element to the operator at a time. I am trying to use the Index Values property node to change the displayed element. However, I can only get the Rows index to work. How do I direct the Columns index as well? The help says to use one per dimension. I need clarification on what this is talking about. I've tried adding a second element to the property node, 2 seperate property nodes, and diferent wiring techniques. (series, parallel)
If you only wire up one of the inputs (col or row) what you get out is a 1D array of either the column or row. If you wire controls to both, then you will get one element out of the array. Getting a single element in a 2D array requires you to specify both a row and column.
Message Edited by Dennis Knutson on 02-08-2007 08:34 AM
Attachments:
Index 2D Array.PNG 2 KB -
Hi .
I was creating the pass the values t in temp tables though s sis package vs2012 .
First I was taken on executive SQL TASK.
IN EXCUTIVE SQL TASK . I was write the stored proce:
Sp;
reate procedure USP_GETEMP2333
AS
begin
Select eid,ename,dept,salary from emp
end;
create table #temp(eid int,ename varchar(20),dept varchar(20),salary int)
insert into #temp
exec USP_GETMP02333
go.
It was executive correctly.
I was taken another sequence container. In the sequence container iam creating one executive sql
In 2<sup>nd</sup> excutive sql task: sql statements is
if object_id('emp_fact_sal') is not null
drop table emp_fact_sal
select eid,ename as emp_name,sal_bar=
case when salary<=5000 then 'l'
when salary >5000 and salary<=7000 then 'm'
else
'h'
end
into emp_fact_sal from #temp.
and one falt flies it was taken to designation .
iam changing all connection properties:
in oldeb connection:
in excutive sal task properties .
delay validation is true,
and retain connection maner is also true,
and package mode is 64 bit is false.
But iwas excutive in 2<sup>nd</sup> excutive ql task .
Iam getting this type of errors,
[Execute SQL Task] Error: Executing the query " if object_id('emp_fact_sal') is not null
drop ta..." failed with the following error: "Invalid object name '#Temp'.". Possible failure reasons: Problems with the query, "ResultSet" property not set correctly, parameters not set correctly, or connection not established
correctly.
Please help meArthur suggestion works but you shouldnt even be doing this on a SQL Task.
Use a data flow task. You'll have better control over the data that is being transfered and get better performance because no staging table will be used.
Just because there are clouds in the sky it doesn't mean it isn't blue. But someone will come and argue that in addition to clouds, birds, airplanes, pollution, sunsets, daltonism and nuclear bombs, all adding different colours to the sky, this
is an undocumented behavior and should not be relied upon. -
Hi
DECLARE @XMLA nvarchar(3000)
, @DateSerial nvarchar(35);
-- Change date to format YYYYMMDDHHMMSS
SET @DateSerial = CAST(GETDATE() AS DATE);
--SELECT @DateSerial
Set @XMLA =
N' <Batch xmlns="http://schemas.microsoft.com/analysis services/2003/engine">
<ErrorConfiguration xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:ddl2="http://schemas.microsoft.com/analysisservices/2003/engine/2"
xmlns:ddl2_2="http://schemas.microsoft.com/analysisservices/2003/engine/2/2" xmlns:ddl100_100="http://schemas.microsoft.com/analysisservices/2008/engine/100/100" xmlns:ddl200="http://schemas.microsoft.com/analysisservices/2010/engine/200"
xmlns:ddl200_200="http://schemas.microsoft.com/analysisservices/2010/engine/200/200">
<KeyErrorLimit>-1</KeyErrorLimit>
<KeyNotFound>IgnoreError</KeyNotFound>
<NullKeyNotAllowed>IgnoreError</NullKeyNotAllowed>
</ErrorConfiguration>
<Parallel>
<Process xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:ddl2="http://schemas.microsoft.com/analysisservices/2003/engine/2" xmlns:ddl2_2="http://schemas.microsoft.com/analysisservices/2003/engine/2/2"
xmlns:ddl100_100="http://schemas.microsoft.com/analysisservices/2008/engine/100/100" xmlns:ddl200="http://schemas.microsoft.com/analysisservices/2010/engine/200" xmlns:ddl200_200="http://schemas.microsoft.com/analysisservices/2010/engine/200/200"
xmlns:ddl300="http://schemas.microsoft.com/analysisservices/2011/engine/300" xmlns:ddl300_300="http://schemas.microsoft.com/analysisservices/2011/engine/300/300">
<Object>
<DatabaseID>MultidimensionalProject5</DatabaseID>
<CubeID>giri</CubeID>
<MeasureGroupID>Fact Internet Sales</MeasureGroupID>
</Object>
<Type>ProcessFull</Type>
<WriteBackTableCreation>UseExisting</WriteBackTableCreation>
</Process>
</Parallel>
</Batch>';
EXEC (@XMLA) At SHALL-PCAdventureWorksDw ;
iam executive the query when iam getting below error.
[Execute SQL Task] Error: Executing the query "DECLARE
@XMLA nvarchar(3000)
, @DateSerial nvarch..." failed with the following error: "Incorrect syntax near '-'.". Possible failure reasons: Problems with the query, "ResultSet" property not set correctly, parameters not set
correctly, or connection not established correctly.
how to solve this error;
please help meWhat are you trying to do? What sort of data source is SHALL-PCAdventureWorksDw?
When you use EXEC() AT, I would execpt to see an SQL string to be passed to EXEC(), but you are passing an XML string????
If you explain why you think this would work in the first place, maybe we can help you.
Erland Sommarskog, SQL Server MVP, [email protected] -
Problems with numeric values in the barcode
Hi
I have a problem with the data from a numeric field, when it is encoded in the barcode the validation pattern seems to be ignored.
I have set the validation pattern of the numeric field to be
num{9999}
And when I enter a value like "0200" it is displayed in the form as "0200", which is correct.
BUT in the barcode the value is captured as "200", which i NOT what I want. I need all four characters to be in the barcode. Even when the first one i 0 (zero).
How can I do that?
KirstineCan you send the form to [email protected] and I will have a look. Please include a description of the issue in the email as the email and this forum are not tied together.
paul -
Facing problem with the code for sending an .xls attachment via email, a field value contains leading zeros but excel automatically removes these from display i.e. (00444 with be displayed as 444).kindly guide .
Hi Chhayank,
the problem is not the exported xls. If you have a look inside with Notepad or something like that, you will see that your leading zeros are exported correct.Excel-settings occurs this problem, it is all about how to open the document. If you use the import-assistant you will have no problems because there are options available how to handle the different columns.
Another solution might be to get familiar with ABAP2XLS-Project. I got in my mind, that there is a method implemented, that will help you solving this problem. But that is not a five minute job
~Florian -
Set chart value (property node) from a waveform ARRAY?!?
Hi!
In Labview 8.0 I want to send data to a front panel chart via its value property node. This works just fine if I wire a single waveform to the value property (attachment1). However, if I wire it with a waveform array (attachment2) it fails. Is there any workaround?
Thanks in advance,
Rudolf
Attachments:
attachment1.PNG 3 KB
attachment2.PNG 3 KBThe reason I was showing this with only one graph was that
the
two-graph version failed for me. I had tried having separate data
sources, of course. Just to be sure I have rebuilt the VI from scratch
as per your diagram (see attached image and VI) and run it again with
the same results:
The failure was not in my inability to see the
plot but rather in an error message (attachment) which would only
occur if I tried to wire more than a single plot into the value node.
I subsequently also tried doing this using 1D and 2D DBL arrays and
observed a similar problem: the 1D case works fine, the 2D case throws
"insane object" errors and crashes labview entirely.
Message Edited by frumpel on 04-05-2007 10:53 AM
Attachments:
test1.vi 16 KB
block-diagram.PNG 33 KB
error-message.PNG 15 KB -
Problems with the Proxy Programme--Please help
Hi All,
I have written a simple proxy server in the form of a servlet. I changed the proxy config of my browser to connect to this servlet hosted on the default context(http://localhost:8080) of the Tomcat 5.0.25 . Well , this servlet internally connects to the proxy of the corporate LAN . The logic that I have applied is as follows. The servlet gets the request from the client (ie the browser in this case) , extracts the headers and contents from the request, sets them to a new request that it forms and finally send this new request to the proxy. When the proxy responds, the servlet collects the response headers and contents adn writes them in its response. To sum up , this servlet transparently carries the requests and responses between the client(browser) and the corporate LAN proxy. Now the problem is this. Let's say , now I am accessing http://www.google.com.The browser sends a request to my servlet with the following headers as they are extracted by my servlet.
ProxyServer:::>posting request
ProxyServer:::>headerValue::> headerName = accept : headerValue=*/*
ProxyServer:::>headerValue::> headerName = referer : headerValue=http://www.google.com/
ProxyServer:::>headerValue::> headerName = accept-language : headerValue=en-us
ProxyServer:::>headerValue::> headerName = proxy-connection : headerValue=Keep-Alive
ProxyServer:::>headerValue::> headerName = user-agent : headerValue=Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0; UB1.4_IE6.0_SP1; .NET CLR 1.0.3705; .NET CLR 1.1.4322)
ProxyServer:::>headerValue::> headerName = host : headerValue=www.google.com
ProxyServer:::>headerValue::> headerName = cookie : headerValue=PREF=ID=1be27c0a74f198ca:TM=1082058853:LM=1082058853:S=bu6ORrygzm8AUkm8
ProxyServer:::>postRequest
I set these headers into a new connection opened to the proxy and post a fresh request to the proxy,which, in turn responds with the following headers.
ProxyServer:::>posted request successfully
ProxyServer:::>writing response
ProxyServer:::>writeResponse-->headerName = Proxy-Connection : headerValue = [close]
ProxyServer:::>writeResponse-->headerName = Content-Length : headerValue = [257]
ProxyServer:::>writeResponse-->headerName = Date : headerValue = [Tue, 13 Jul 2004 14:01:40 GMT]
ProxyServer:::>writeResponse-->headerName = Content-Type : headerValue = [text/html]
ProxyServer:::>writeResponse-->headerName = Server : headerValue = [NetCache appliance (NetApp/5.5R2)]
ProxyServer:::>writeResponse-->headerName = Proxy-Authenticate : headerValue = [Basic realm="Charlotte - napxyclt2"]
ProxyServer:::>writeResponse-->headerName = null : headerValue = [HTTP/1.1 407 Proxy Authentication Required]
ProxyServer:::>writeResponse exiting
ProxyServer:::>wrote response successfully
I write these headers back to the client. According to what I was thinking, the client ie the browser would open a new dialog box asking for username/password owing to the presence of the "Proxy-Authenticate " header. But it does not happen that way. Rather the browser stops responsding and displays a blank page. Does anyone know why it happens this way? I am pasting the server prog below for everybody's reference.
package server.proxy;
//import all servlet related classes
import javax.servlet.*;
import javax.servlet.http.*;
import java.util.*;
import java.io.*;
import java.net.*;
import server.resources.*;
//My Proxy server --->Currently it is very simplea and relies on
//other proxy servers of an already connected network.
public class ProxyServer extends HttpServlet
//stores the resource bundle
private ServerResBundle resBundle = null;
//checks for the mode of operation
private boolean proxySet = false;
private String proxy = null;
//storing the original System out/err etc
private PrintStream sysOutOrig = null;
private PrintStream sysErrOrig = null;
private InputStream sysInOrig = null;
//initialise certain features that are required later
public void init() throws ServletException
try
//initialise the resource bundle
this.initResBundle();
System.out.println("ProxyServer:::>res bundle init");
//set the mode of operation
this.setMode();
System.out.println("ProxyServer:::>mode set");
//set the system out and err --System.setOut etc
this.setSystemOutErr();
System.out.println("ProxyServer:::>in/out/err set");
}//End try
catch(Exception e)
System.out.println("Exception in init..."+(e.getMessage()));
throw new ServletException(e);
}//Edn
catch(Throwable e)
System.out.println("Irrecoverable Error...");
throw new ServletException(e);
}//End
}//End init
//method to init the resource bundle;
private void initResBundle()
this.resBundle = ServerResBundle.getBundle();
}//End
//method to set the mode of the server--proxy or direct
private void setMode()
//read the target proxy property from the bundle and
//if it is set,take that URL
String temp = (String)(this.resBundle.getResource(ResKeys.PROXY_SERVER));
if ( (temp != null) && (temp.length() > 0) )
this.proxySet = true;
this.proxy = temp;
temp = null;
}//End
}//End
//method to set the system out and err etc
private void setSystemOutErr() throws Exception
//keep a copy of the original system out and error
this.sysOutOrig = System.out;
this.sysErrOrig = System.err;
try
//read the options adn if they are set, take the values directly
String newOutStr = (String)(this.resBundle.getResource(ResKeys.SYSTEM_OUT));
String newErrStr = (String)(this.resBundle.getResource(ResKeys.SYSTEM_ERR));
if ((newOutStr != null) && (newOutStr.length() > 0))
System.setOut(new PrintStream(new FileOutputStream(new File(newOutStr),true),true));
}//End if
if ((newErrStr != null) && (newErrStr.length() > 0))
System.setErr(new PrintStream(new FileOutputStream(new File(newErrStr),true),true));
}//End if
}//End
catch(Exception e)
//restore the stuff
System.setOut(this.sysOutOrig);
System.setErr(this.sysErrOrig);
}//End
}//End
//this is where the proxy functionalities will be embedded
public void service(HttpServletRequest req,HttpServletResponse resp)
throws ServletException,java.io.IOException
//conenction URL
URL target = null;
//conenction to the remote object
URLConnection targetConn = null;
//stores the OOS and the OIS
ObjectOutputStream oos = null;
ObjectInputStream ois = null;
try
//check for the mode of operation
if (proxySet)
URLConnection objects go through two phases: first they are created, then they are connected.
After being created, and before being connected, various options can be specified
(e.g., doInput and UseCaches). After connecting, it is an error to try to set them.
Operations that depend on being connected, like getContentLength, will implicitly perform the connection,
if necessary.
//for the URL to the proxy
target=new URL(this.proxy);
//conenct to the proxy
targetConn = target.openConnection();
//set the details of the connectuon
targetConn.setDoInput(true);
targetConn.setDoOutput(true);
targetConn.setUseCaches(false);
// If true, this URL is being examined in a context in which it makes sense to allow user interactions such as popping up an authentication dialog. If false, then no user interaction is allowed
targetConn.setAllowUserInteraction(true);
//connect to the remote object
// targetConn.connect();//call this only when all the request properties are set
System.out.println("ProxyServer:::>posting request");
//post the received request to the URL
this.postRequest(targetConn,req);
System.out.println("ProxyServer:::>posted request successfully");
System.out.println("ProxyServer:::>writing response");
//receive the response
//write the received response to the client
this.writeResponse(targetConn,resp);
System.out.println("ProxyServer:::>wrote response successfully");
}//End if
else
//currently this functionality is not supported
throw new ServletException(
(String)(this.resBundle.getResource(ResKeys.ERR_FUNC_NOTSUPPORTED)));
}//End
}//End try
catch(Exception e)
if(e instanceof ServletException)
throw (ServletException)e;
}//End
if (e instanceof IOException)
throw (IOException)e;
}//End
//wrap it up in ServletException
throw new ServletException(e);
}//End
}//End
//method to write the response back to the client
private void writeResponse(URLConnection targetConn,HttpServletResponse resp)
throws ServletException
//get all the header fields from the response connection and set them to the
//response of the servlet
Map headerFields = null;
Iterator headerFieldEntries = null;
Map.Entry header = null;
//stores the input stream to the conn
BufferedReader brConn = null;
//stores the writer to the response
PrintWriter prResp = null;
//checks if the proxy authentication needed or not
boolean proxyAuthReqd = false;
try
//juste ensuring that the proxy authentication is reset
proxyAuthReqd = false;
if( (targetConn != null) && (resp != null) )
//Returns an unmodifiable Map of the header fields.
//The Map keys are Strings that represent the response-header field names.
//Each Map value is an unmodifiable List of Strings that represents the corresponding
//field values
headerFields = targetConn.getHeaderFields();
//Returns a set view of the mappings contained in this map
Set temp = headerFields.entrySet();
//Returns an iterator over the elements in this set
headerFieldEntries = temp.iterator();
if (headerFieldEntries != null)
while (headerFieldEntries.hasNext())
Object tempHeader = headerFieldEntries.next();
if (tempHeader instanceof Map.Entry)
header = (Map.Entry)tempHeader;
Object headerName = header.getKey();
Object headerValue=header.getValue();
System.out.println("ProxyServer:::>writeResponse-->headerName = "+headerName+" : headerValue = "+headerValue);
//do not select the key-value pair if both the key adn the value are null
if ( ( headerName == null) && (headerValue == null) )
continue;
}//Enmd
if (headerValue != null)
List headerValList = null;
if (headerValue instanceof List)
headerValList = (List)headerValue;
}//End
if(headerValList != null)
for (int i=0;i<headerValList.size();i++)
Object headerValueStr = headerValList.get(i);
if (headerValueStr instanceof String)
//note that the header-key can not be null for addHeader
//I have made this temporary provision to make the programme work.
resp.addHeader(( (headerName==null)? ("null_header"+i) :(String)headerName),
(String)headerValueStr);
//check if the proxy authentication required or not
if (((String)headerValueStr).
indexOf(resp.SC_PROXY_AUTHENTICATION_REQUIRED+"") != -1)
System.out.println("ProxyServer:::>writeResponse-->proxy auth needed");
//proxy authentication is needed
proxyAuthReqd = true;
}//End
}//Ednd of
else if (headerValueStr == null)
resp.addHeader(( (headerName==null)? null :(String)headerName),
null);
}//End
}//End for
}//End if
}//End if
}//End
}//End while
}//End if
//get the writer to the client
prResp = resp.getWriter();
System.out.println("ProxyServer:::>writeResponse-->proxyAuthReqd="+proxyAuthReqd);
//juste test a simple header
System.out.println("Proxy-Authenticate = "+(resp.containsHeader("Proxy-Authenticate")));
//if the proxy asks you for authentication,pass on the same to the client
//from whom you have received the request.When this flag is true,the connection
//is closed by the remotehost adn hence any attempt to open in input steram
//results in an error ie IOException
if (!proxyAuthReqd)
//now get the content adn write it to the response too
brConn = new BufferedReader(new InputStreamReader(
targetConn.getInputStream()));
String tempStr = null;
while ((tempStr = brConn.readLine())!=null)
prResp.println(tempStr);
}//End while
//close the connections
brConn.close();
}//End if
else
prResp.println("Proxy Authentication needed...");
}//End
//close the streams
prResp.flush();
prResp.close();
}//End if
System.out.println("ProxyServer:::>writeResponse exiting\n");
}//End try
catch(Exception e)
throw new ServletException(e);
}//End
}//End
//method to post request to the internet
private void postRequest(URLConnection targetConn,HttpServletRequest req)
throws ServletException
//extract the header parameters and the body content from the incoming request
//and set them to the new connection
Enumeration reqHeaders = null;
//reads the incoming request's content
BufferedReader brReqRd = null;
PrintWriter prResWt = null;
//stores temp header names and values
String headerName = null;
String headerValue = null;
try
if( (targetConn != null) && (req != null) )
reqHeaders = req.getHeaderNames();
//extract a header adn set it to the new connection
while (reqHeaders.hasMoreElements())
headerName = (String)(reqHeaders.nextElement());
headerValue = req.getHeader(headerName);
targetConn.setRequestProperty(headerName,headerValue);
System.out.println("ProxyServer:::>headerValue::> headerName = "+headerName+" : headerValue="+headerValue);
}//End
System.out.println("ProxyServer:::>postRequest\n");
//establis the actual connection
//calling this method bfore the above loop results in IllegalStateException
targetConn.connect();
//NOTE : try reading from and writing into OIS and OOS respectively
//now read the contents and write them to the connection
// brReqRd = req.getReader(); //this hangs for some reason
brReqRd = new BufferedReader(new InputStreamReader(req.getInputStream()));
System.out.println("Got the reader..brReqRd = "+brReqRd);
if (brReqRd != null)
String temp = null;
//establish the printwriter
// prResWt = new PrintWriter(targetConn.getOutputStream(),true);
prResWt = new PrintWriter(targetConn.getOutputStream());
System.out.println("trying to read in a loop from brReqRd.. ready="+(brReqRd.ready()));
while( (brReqRd.ready()) && ((temp=brReqRd.readLine()) != null) )
System.out.println("In while::>temp = "+temp);
prResWt.println(temp);
}//Emd while
//close the streams adn go back
brReqRd.close();
prResWt.flush();
prResWt.close();
}//End
}//End outer if
System.out.println("ProxyServer:::>postRequest exiting\n");
}//End try
catch(Exception e)
throw new ServletException(e);
}//End
}//End
}//EndHi serlank ,
Thanks for your reply. Well , I initially I thought of not pasting the code,as it was too long. But I could not help it,as I thought I must show in code what I exactly meant. That's why I followed a description of my problem with the code. You could probably have copied the code and pasted it in one of your favourite editors to take a look at it. Did you,by any chance, try to read it on the browser? And as regards reposting the same message, I can say that I did it as I felt the subject was not quite appropriate in the first posting and I was not sure as to how I could delete/alter the posting. I am not asking for a code-fix,but some suggestions from some one who might ever have come across such a thing.Anyway, lemme know if you have any idea on it. Thanks... -
Component Creation - how to work the VALUE property
Hey all,
Have an 80% working component to solve one of my problems (reference http://swforum.sun.com/jive/thread.jspa?threadID=53379&tstart=30, yeah not much there ;-).
*Taglib class
*TLD
*Component class
*faces-config.xml
*Renderer
DT:
*sun-faces-config.xml
*BeanInfoBase classes generated with Rave tools.
Now, my problem is I want to pass the value/data from one object to my object (bind the data). I'm not having much success with this one piece. Can anyone point me to an example or show an example of how to pass **value** property in such a way that the data from, say a textbox, can be shown all the way through to the Renderer?
A full example would be best, I've added the value attribute into the TLD, and is-bindable in the sun-faces-config, and various coding attempts but still missing some pieces.
p.s. yes, I've examined the calendar example, the datedisplayer/datepicker example, and half a dozen other ones...still looking :-)
thanks!
-DIn case I'm not making it clear:
Creating a custom component. I want to bind to a database field, a bean field, or to another JSF component the data. The only way I have found to 'bind' is through the value property located in Java Studio Creator (i.e., you click on the ... or the arrow beside 'value' for the object, and you can select what you want to bind).
How does one take that 'value' bound information and show the real value in the Renderer class?
example:
Bind custom-object 'value property' to an HtmlTextInputBox that has the value "This is a test".
Render "this is a test" or whatever is entered in the text box to the webpage with the custom-object.
Bind custom-object 'value property' to a Sessionbean property called 'myNum'.
Render the value of 'myNum' to the webpage with the custom-object.
Bind custom-object 'value property' to the field 'mydbdata' in a database.
Render the value of mydbdata to the webpage with the custom-object.
USECASE:
Starting with the tld, how does one accomplish this 'complex' feat?
*TLD
*Taglib class
*faces-config.xml
*component class
*renderer class
so the end result is:
RENDERER:
encodeEnd(....
writer.write("my bound value is: " + howtogettheboundvalue);
...
Maybe you are looking for
-
TS4002 How do I re-add an existing iCloud email account to iPad 2?
I set up iCloud email OK on my new iPad 2. I did not previously have a MobileMe account. When the email stopped working (I got repeated messages to say server unavailable) I followed Apple instructions to delete the account from the iPad with the int
-
TV Series download restrictions...
What restrictions are there to the movies/TV series that I download? Can I burn them to DVD, or am I limited to playing them on my PC or iPod?
-
IDS 5.0 SP2 + Solaris 8 password problem
Iplanet version : iDS 5.0 SP2 + Solaris 8 Password: user must change password after reset : yes user may change password : yes allow changes in 0 days keep password history : yes remeber 6 password Password expires after 90 days send warning 7 days b
-
500 Internal Server Error java.lang.NullPointerException
500 Internal Server Error java.lang.NullPointerException at com.idealake.RBI.struts.login.LoginAction.execute(LoginAction.java:72) at org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:421) at org.apache.
-
i am in saudi arabia. i want to purchase an app from U.S. store ? How can i get it ? As soon as i put my apple id, it takes me to saudi store.