Tuesday, 19 July 2016

ERROR 403 - FORBIDDEN

ERROR 403 - FORBIDDEN

Why am I seeing this page?

403 errors usually mean that the server does not have permission to view the requested file or resource.These errors are often caused by IP Deny rules, File protections, or permission problems.
In many cases this is not an indication of an actual problem with the server itself but rather a problem with the information the server has been instructed to access as a result of the request. This error is often caused by an issue on your site which may require additional review by our support teams.
Our support staff will be happy to assist you in resolving this issue. Please contact our Live Support or reply to any Tickets you may have received from our technicians for further assistance.

Is there anything that I can do?

There are a few common causes for this error code including problems with the individual script that may be executed upon request. Some of these are easier to spot and correct than others.

File and Directory Ownership

The server you are on runs applications in a very specific way in most cases. The server generally expects files and directories be owned by your specific user cPanel user. If you have made changes to the file ownership on your own through SSH please reset the Owner and Group appropriately.

File and Directory Permissions

The server you are on runs applications in a very specific way in most cases. The server generally expects files such as HTML, Images, and other media to have a permission mode of 644. The server also expects the permission mode on directories to be set to 755 in most cases.
(See the Section on Understanding Filesystem Permissions.)
Note: If the permissions are set to 000, please contact our support team using the ticket system. This may be related to an account level suspension as a result of abuse or a violation of our Terms of Service.

IP Deny Rules

In the .htaccess file, there may be rules that are conflicting with each other or that are not allowing an IP address access to the site.
If you would like to check a specific rule in your .htaccess file you can comment that specific line in the .htaccess by adding # to the beginning of the line. You should always make a backup of this file before you start making changes.
For example, if the .htaccess looks like
Order deny,allow
allow from all
deny from 192.168.1.5
deny from 192.168.1.25
Then try something like this
Order allow,deny
allow from all
#deny from 192.168.1.5
deny from 192.168.1.25
Our server administrators will be able to advise you on how to avoid this error if it is caused by process limitations. Please contact our Live Support or open a Ticket. Be sure to include the steps needed for our support staff to see the 403 error on your site.

Understanding Filesystem Permissions

Symbolic Representation

The first character indicates the file type and is not related to permissions. The remaining nine characters are in three sets, each representing a class of permissions as three characters. The first set represents the user class. The second set represents the group class. The third set represents the others class.
Each of the three characters represent the read, write, and execute permissions:
  • r if reading is permitted, - if it is not.
  • w if writing is permitted, - if it is not.
  • x if execution is permitted, - if it is not.
The following are some examples of symbolic notation:
  • -rwxr-xr-x a regular file whose user class has full permissions and whose group and others classes have only the read and execute permissions.
  • crw-rw-r-- a character special file whose user and group classes have the read and write permissions and whose others class has only the read permission.
  • dr-x------ a directory whose user class has read and execute permissions and whose group and others classes have no permissions.

Numeric Representation

Another method for representing permissions is an octal (base-8) notation as shown. This notation consists of at least three digits. Each of the three rightmost digits represents a different component of the permissions:usergroup, and others.
Each of these digits is the sum of its component bits As a result, specific bits add to the sum as it is represented by a numeral:
  • The read bit adds 4 to its total (in binary 100),
  • The write bit adds 2 to its total (in binary 010), and
  • The execute bit adds 1 to its total (in binary 001).
These values never produce ambiguous combinations. each sum represents a specific set of permissions. More technically, this is an octal representation of a bit field – each bit references a separate permission, and grouping 3 bits at a time in octal corresponds to grouping these permissions by usergroup, andothers.
Permission mode 0755
4+2+1=7
Read, Write, eXecute
4+1=5
Read, eXecute
4+1=5
Read, eXecute
Permission mode 0644
4+2=6
Read, Write
4
Read
4
Read

How to modify your .htaccess file

The .htaccess file contains directives (instructions) that tell the server how to behave in certain scenarios and directly affect how your website functions.
Redirects and rewriting URLs are two very common directives found in a .htaccess file, and many scripts such as WordPress, Drupal, Joomla and Magento add directives to the .htaccess so those scripts can function.
It is possible that you may need to edit the .htaccess file at some point, for various reasons.This section covers how to edit the file in cPanel, but not what may need to be changed.(You may need to consult other articles and resources for that information.)

There are Many Ways to Edit a .htaccess File

  • Edit the file on your computer and upload it to the server via FTP
  • Use an FTP program's Edit Mode
  • Use SSH and a text editor
  • Use the File Manager in cPanel
The easiest way to edit a .htaccess file for most people is through the File Manager in cPanel.

How to Edit .htaccess files in cPanel's File Manager

Before you do anything, it is suggested that you backup your website so that you can revert back to a previous version if something goes wrong.

Open the File Manager

  1. Log into cPanel.
  2. In the Files section, click on the File Manager icon.
  3. Check the box for Document Root for and select the domain name you wish to access from the drop-down menu.
  4. Make sure Show Hidden Files (dotfiles)" is checked.
  5. Click Go. The File Manager will open in a new tab or window.
  6. Look for the .htaccess file in the list of files. You may need to scroll to find it.

To Edit the .htaccess File

  1. Right click on the .htaccess file and click Code Edit from the menu. Alternatively, you can click on the icon for the .htaccess file and then click on the Code Editor icon at the top of the page.
  2. A dialogue box may appear asking you about encoding. Just click Edit to continue. The editor will open in a new window.
  3. Edit the file as needed.
  4. Click Save Changes in the upper right hand corner when done. The changes will be saved.
  5. Test your website to make sure your changes were successfully saved. If not, correct the error or revert back to the previous version until your site works again.
  6. Once complete, you can click Close to close the File Manager window.

How to modify file and directory permissions

The permissions on a file or directory tell the server how in what ways it should be able to interact with a file or directory.
This section covers how to edit the file permissions in cPanel, but not what may need to be changed.(See the section on what you can do for more information.)

There are Many Ways to Edit a File Permissions

  • Use an FTP program
  • Use SSH and a text editor
  • Use the File Manager in cPanel
The easiest way to edit file permissions for most people is through the File Manager in cPanel.

How to Edit file permissions in cPanel's File Manager

Before you do anything, it is suggested that you backup your website so that you can revert back to a previous version if something goes wrong.

Open the File Manager

  1. Log into cPanel.
  2. In the Files section, click on the File Manager icon.
  3. Check the box for Document Root for and select the domain name you wish to access from the drop-down menu.
  4. Make sure Show Hidden Files (dotfiles)" is checked.
  5. Click Go. The File Manager will open in a new tab or window.
  6. Look for the file or directory in the list of files. You may need to scroll to find it.

To Edit the Permissions

  1. Right click on the file or directory and click Change Permissions from the menu.
  2. A dialogue box should appear allowing you to select the correct permissions or use the numerical value to set the correct permissions.
  3. Edit the file permissions as needed.
  4. Click Change Permissions in the lower left hand corner when done. The changes will be saved.
  5. Test your website to make sure your changes were successfully saved. If not, correct the error or revert back to the previous version until your site works again.
  6. Once complete, you can click Close to close the File Manager window.

Friday, 8 January 2016

Enterprise Beans in JAVA

What is Enterprise Beans
A Java EE component is called an Enterprise Beans which implements the EJB technology and runs inside an EJB container. Enterprise Beans are the server side component where the application's business logic is encapsulated. The business logic can be explained as, it is line of statement called code which is written for completing the requirements of application.
What is EJB Container
EJB container is a specification within the Application Server that runs the Enterprise Beans. Services provided by the EJB container is System-level services. In such type of services it provides the transaction and security to its enterprise beans. In addition they also provides for the Resource and life cycle management, remote accessibility, concurrency control, collision etc.
Benefits of Enterprise Beans
Generally, Enterprise beans is used for creating large, distributed applications. This is because of various reasons these are as follows :
  • The first reason is the services that are provided by the EJB container to enterprise beans i.e. System-level services that helps the developer to focus on solving the business problems.
  • The second reason is elaborated from first reason that the bean is responsible for application's business logic not for the client. So, a client developer can focus on only its presentation.
  • The third reason is enterprise bean's portability feature i.e. the enterprise beans components can be easily or conveniently portable.

When use Enterprise Java Bean?
  1. Application needs Remote Access. In other words, it is distributed.
  2. Application needs to be scalable. EJB applications supports load balancing, clustering and fail-over.
  3. Application needs encapsulated business logic. EJB application is separated from presentation and persistent layer.



Types of Enterprise Java Bean
There are 3 types of enterprise bean in java.
Session Bean
Session bean contains business logic that can be invoked by local, remote or webservice client.
Message Driven Bean
Like Session Bean, it contains the business logic but it is invoked by passing message.
Entity Bean
It encapsulates the state that can be persisted in the database. It is deprecated. Now, it is replaced with JPA (Java Persistent API).

Session Bean
 These types of beans directly interact with the client and contains business logic of the business application.
Session bean encapsulates business logic only, it can be invoked by local, remote and webservice client.
It can be used for calculations, database access etc.
The life cycle of session bean is maintained by the application server (EJB Container).
Types of Session Bean
There are 3 types of session bean.
1) Stateless Session Bean: It doesn't maintain state of a client between multiple method calls.
2) Stateful Session Bean: It maintains state of a client across multiple requests.
3) Singleton Session Bean: One instance per application, it is shared between clients and supports concurrent access.

Stateless Session Bean
Stateless Session bean is a business object that represents business logic only. It doesn't have state (data).
In other words, conversational state between multiple method calls is not maintained by the container in case of stateless session bean.
The stateless bean objects are pooled by the EJB container to service the request on demand.
It can be accessed by one client at a time. In case of concurrent access, EJB container routes each request to different instance.
Stateful Session Bean
Stateful Session bean is a business object that represents business logic like stateless session bean. But, it maintains state (data).
In other words, conversational state between multiple method calls is maintained by the container in stateful session bean.
Message-Driven Bean :
 Message-Driven Bean permits the Java Enterprise Edition applications for processing messages asynchronously. Message-Driven beans likewise the JMS message listener, that receives the JMS messages rather than events.

Disadvantages of EJB
  1. Requires application server
  2. Requires only java client. For other language client, you need to go for webservice.
  3. Complex to understand and develop ejb applications.


what is mean by JSF -JAVA

What is JSF?
  Java Server Faces
JSF technology is a framework for developing, building server side User Interface Components and using them in a web application.JSF technology is based on the Model View Controller (MVC) architecture for separating logic from presentation.
What is MVC Design Pattern?
MVC design pattern designs an application using three separate modules:
Module
Description
Model
Carries Data and login
View
Shows User Interface
Controller
Handles processing of an application.

Purpose of MVC design pattern is to separate model and presentation to enable developers to set focus on their core skills and collaborate more clearly.
Web Designers have to concentrate only on view layer rather than model and controller layer. Developers can change the code for model and typically need not to change view layer. Controllers are used to process user actions. In this process layer model and views may be changed.
Benefits Of JSF
JSF has various benefits these are as :
  • The  MVC architecture facilitate to separate the behavior from presentation.
  • JSF provides the facility to link the separate pieces of the development process to a single piece by offering a simple programming model.
  • JSF provides the built-in support of Ajax, bookmarking, and page-load actions.
  • Provides more security.
  • Reusability of codes.
JSF Integration
JSF can be integrated with other frameworks like, Spring, JDBC etc. 
Basic JSF Tags
JSF provides a standard HTML tag library. These tags get rendered into corresponding html output.
For these tags you need to use the following namespaces of URI in html node.
<html
   xmlns="http://www.w3.org/1999/xhtml"
   xmlns:h="http://java.sun.com/jsf/html"
> 
Following are important Basic Tags in JSF 2.0:
S.N.
Tag & Description
1
h:inputText
Renders a HTML input of type="text", text box.
2
h:inputSecret
Renders a HTML input of type="password", text box.
3
h:inputTextarea
Renders a HTML textarea field.
4
h:inputHidden
Renders a HTML input of type="hidden".
5
h:selectBooleanCheckbox
Renders a single HTML check box.
6
h:selectManyCheckbox
Renders a group of HTML check boxes.
7
h:selectOneRadio
Renders a single HTML radio button.
8
h:selectOneListbox
Renders a HTML single list box.
9
h:selectManyListbox
Renders a HTML multiple list box.
10
h:selectOneMenu
Renders a HTML combo box.
11
h:outputText
Renders a HTML text.
12
h:outputFormat
Renders a HTML text. It accepts parameters.
13
h:commandButton
Renders a HTML input of type="submit" button.
14
h:Link
Renders a HTML anchor.