In cases, where we want to connect to VM running servers from HOST OS, we need to disable the iptable firewall permission in Linux.
Use following command to disable firewall in Linux. In root access, execute the command.
IPV4 firewall
/etc/init.d/iptables stop
IPV6 firewall
/etc/init.d/ip6tables stop
NOTE :- In VM player set network adapter to host-only mode to create private network with host and VM OS.
Monday, May 9, 2016
Monday, April 4, 2016
Monday, August 31, 2015
Grep files from file list
Following Linux script can be used to grep files from file list. Suppose you have file name list in "test2" file. Then, you can use following script to grep files in current location and copy these files to "/home/sujith/files/.
for k in `cat /home/sujith/test2`;
do echo $k;
cp *$k /home/sujith/files/.;
done
for k in `cat /home/sujith/test2`;
do echo $k;
cp *$k /home/sujith/files/.;
done
String Substring Linux
Suppose file "test" has strings with "-" separator. If you need to get the second part of the string into "test2" file, you can use the following command.
test
=======
90463619-15723905D.pdf
90465573-15728095D.pdf
91028582-16080834D.pdf
16080834D.pdf
15728095D.pdf
cat test |awk -F"-" '{print $2}' > test2
test
=======
90463619-15723905D.pdf
90465573-15728095D.pdf
91028582-16080834D.pdf
test2
=======
15723905D.pdf16080834D.pdf
15728095D.pdf
cat test |awk -F"-" '{print $2}' > test2
Monday, August 24, 2015
Insert URL in PDF using iReport
You can add a URL into your PDF file using following iReport xml file. PDF will show "Click Here!" text and URl will redirect to "http://www.google.com".
<textField hyperlinkType="Reference" hyperlinkTarget="Blank">
<reportElement x="5" y="5" width="200" height="15"/>
<textElement/>
<textFieldExpression class="java.lang.String"><![CDATA["Click Here!"]]></textFieldExpression>
<hyperlinkReferenceExpression><![CDATA["http://www.google.com"]]></hyperlinkReferenceExpression>
</textField>
<textField hyperlinkType="Reference" hyperlinkTarget="Blank">
<reportElement x="5" y="5" width="200" height="15"/>
<textElement/>
<textFieldExpression class="java.lang.String"><![CDATA["Click Here!"]]></textFieldExpression>
<hyperlinkReferenceExpression><![CDATA["http://www.google.com"]]></hyperlinkReferenceExpression>
</textField>
Access Referenced Managed Bean in JSF
Following code can be used to reference one manged bean from another.
@ManagedBean(name="usingBean")
@RequestScoped
public class UsingBean
{
@ManagedProperty(value="#{neededBean}")
private NeededBean neededBean;
public NeededBean getNeededBean()
{
return neededBean;
}
public void setNeededBean(NeededBean neededBean)
{
this.neededBean = neededBean;
}
}
Now, you can use the following methods to call referenced managed bean property in JAVA class.
ELContext elContext = FacesContext.getCurrentInstance().getELContext();
NeededBean neededBean
= (NeededBean) FacesContext.getCurrentInstance().getApplication()
.getELResolver().getValue(elContext, null, "neededBean");
---------------------------------- or --------------------------------------------
FacesContext facesContext = FacesContext.getCurrentInstance();
NeededBean neededBean
= (NeededBean)facesContext.getApplication()
.createValueBinding("#{neededBean}").getValue(facesContext);
Reference site :- https://myfaces.apache.org/wiki/core/user-guide/jsf-and-myfaces-howtos/backend/accessing-one-managed-bean-from-another.html
@ManagedBean(name="usingBean")
@RequestScoped
public class UsingBean
{
@ManagedProperty(value="#{neededBean}")
private NeededBean neededBean;
public NeededBean getNeededBean()
{
return neededBean;
}
public void setNeededBean(NeededBean neededBean)
{
this.neededBean = neededBean;
}
}
Now, you can use the following methods to call referenced managed bean property in JAVA class.
ELContext elContext = FacesContext.getCurrentInstance().getELContext();
NeededBean neededBean
= (NeededBean) FacesContext.getCurrentInstance().getApplication()
.getELResolver().getValue(elContext, null, "neededBean");
---------------------------------- or --------------------------------------------
FacesContext facesContext = FacesContext.getCurrentInstance();
NeededBean neededBean
= (NeededBean)facesContext.getApplication()
.createValueBinding("#{neededBean}").getValue(facesContext);
Reference site :- https://myfaces.apache.org/wiki/core/user-guide/jsf-and-myfaces-howtos/backend/accessing-one-managed-bean-from-another.html
Thursday, June 11, 2015
Restful Web Service Parameters
@PathParam
The @PathParam annotation binds the value of a path segment to a resource method parameter. For example, the following method would intercept an HTTP GET like http://server:port/login/12345 and convert the PathParam "12345" into the String "id"
@Path("/")
public class LoginService
{
@GET
@Path("login/{zip}")
public String login(@PathParam("zip") String id) {
return "Id is " +id;
}
}
As for @FormParam, you can embed the @PathParam declaration at class level, if you prefer.
@QueryParam
The @QueryParam annotation binds the value of a path segment to a resource method parameter. For example, the following method would intercept an HTTP GET like http://server:port/login?zip=12345 and inject the query parameter "zip" into the method parameter "zip"
@Path("/")
public class LoginService
{
@GET
@Path("login/{zip}")
public String login(@QueryParam("zip") String zip) {
return "Id is " +id;
}
}
QueryParam can be convenientely used with the DefaultValue annotation so that you can avoid a null pointer exception if no query parameter is passed.
@GET
@Path("login/{zip}")
public String login(@DefaultValue("11111") @QueryParam("zip") String zip) {
return "Id is " +id;
}
As for @FormParam, you can embed the @PathParam declaration at class level, if you prefer.
@HeaderParam
The @HeaderParam annotation extracts information from the HTTP header and binds it to a method parameter. Example:
@GET
public String callService(@HeaderParam("User-Agent") String whichBrowser) {
...
}
@CookieParam
The @CookieParam annotation reads an information stored as a cookie and binds it to a method parameter. Example:
@GET
public String callService(@CookieParam("sessionid") String sessionid) {
...
}
@MatrixParam
The @MatrixParam annotation can be used to bind an expression containing several property=value to a method parameter. For example, supposing you were to invoke an URL like http://server:port/login;name=francesco;surname=marchioni
@GET
public String callService(@MatrixParam("name") String name,
@MatrixParam("surname") String surname) {
...
}
Reference :- http://www.mastertheboss.com/jboss-frameworks/resteasy/resteasy-tutorial-part-two-web-parameters
The @PathParam annotation binds the value of a path segment to a resource method parameter. For example, the following method would intercept an HTTP GET like http://server:port/login/12345 and convert the PathParam "12345" into the String "id"
@Path("/")
public class LoginService
{
@GET
@Path("login/{zip}")
public String login(@PathParam("zip") String id) {
return "Id is " +id;
}
}
As for @FormParam, you can embed the @PathParam declaration at class level, if you prefer.
@QueryParam
The @QueryParam annotation binds the value of a path segment to a resource method parameter. For example, the following method would intercept an HTTP GET like http://server:port/login?zip=12345 and inject the query parameter "zip" into the method parameter "zip"
@Path("/")
public class LoginService
{
@GET
@Path("login/{zip}")
public String login(@QueryParam("zip") String zip) {
return "Id is " +id;
}
}
QueryParam can be convenientely used with the DefaultValue annotation so that you can avoid a null pointer exception if no query parameter is passed.
@GET
@Path("login/{zip}")
public String login(@DefaultValue("11111") @QueryParam("zip") String zip) {
return "Id is " +id;
}
As for @FormParam, you can embed the @PathParam declaration at class level, if you prefer.
@HeaderParam
The @HeaderParam annotation extracts information from the HTTP header and binds it to a method parameter. Example:
@GET
public String callService(@HeaderParam("User-Agent") String whichBrowser) {
...
}
@CookieParam
The @CookieParam annotation reads an information stored as a cookie and binds it to a method parameter. Example:
@GET
public String callService(@CookieParam("sessionid") String sessionid) {
...
}
@MatrixParam
The @MatrixParam annotation can be used to bind an expression containing several property=value to a method parameter. For example, supposing you were to invoke an URL like http://server:port/login;name=francesco;surname=marchioni
@GET
public String callService(@MatrixParam("name") String name,
@MatrixParam("surname") String surname) {
...
}
Reference :- http://www.mastertheboss.com/jboss-frameworks/resteasy/resteasy-tutorial-part-two-web-parameters
Subscribe to:
Posts (Atom)