<commit_before><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Imcms public API 1.0 beta 2 samples</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>

<body>
<H1>Imcms public API 1.0 beta 2 samples</H1>

<h2> Documentation </h2>
The documentation consists of this page and the jsp-pages that this page links to.
For documentation on the different classes that is used in the jsp-pages, <br>
see the <a href="docs/">java doc</a> for details.

<h3>Warning!</h3>
The following links works differently depending on the user's permissions on the corresponding admin-pages. That is, what
user you are logged in as, and what administrative permissions that user has.<br>
That means that even though you don't specify a user in most of the API:s method, usually the current logged in user
is passed as an invisible parameter.<br>
If you're not logged in as any user, you get a NullpointerException when trying any of the following jsp-pages.
When logged out, the only link that should work is the sample of exception handling at the bottom of this document.</p>
<p>

<h3>How to use this examples</h3>
When you click on a jsp-link below that page is going to be run, and produce a result.<br>
To see the actual code, pleas open the page in your favourite java/jsp editing environment.<br>

<h3>Who you are</h3>
First, make sure that you are logged in, <a href="../login/index.html">../login/index.html</a><br>
To see what user you are logged in as, <a href="logged_in_user.jsp">logged_in_user.jsp</a><br>
Log out (and become an non-logged in user), <a href="../servlet/LogOut">../servlet/LogOut</a>
</p>

<h3>Users</h3>
To see what users that exists in the system, <a href="user_listing.jsp">user_listing.jsp</a><br>

<h3>Roles</h3>
List all roles, <a href="role_list_all.jsp">role_list_all.jsp</a><br>
Add, <a href="role_create_role.jsp">role_create_role.jsp</a><br>
Delete, <a href="role_delete_role.jsp">role_delete_role.jsp</a><br>
<br>
List users with different roles, <a href="role_get_user_with_role.jsp">role_get_user_with_role.jsp</a><br>

<h3>Document</h3>
The following samples is modifying document 1001.<br>
It currently looks like this, <a href="../servlet/GetDoc?meta_id=1001">document</a><br>
<br>
Get the information about the document, <a href="document_get_document_info.jsp">document_get_document_info.jsp</a><br>
Change the document information, <a href="document_change_document_info.jsp">document_change_document_info.jsp</a><br>
<br>
Show template for a document, <a href="document_show_templates.jsp">document_show_templates.jsp</a><br>
Change template for a document, <a href="document_change_template.jsp">document_change_template.jsp</a><br>
<br>
Get the first document field from the document, <a href="document_get_text_from_field.jsp">document_get_text_from_field.jsp</a><br>
Change the first and the second field, <a href="document_set_text_field.jsp">document_set_text_field.jsp</a><br>
Clear the first and the second field, </a><a href="document_clear_text_field.jsp">document_clear_text_field.jsp</a><br>
<br>
To create a new text dokument that is linked from the document above, <a href="document_create_new_text_document.jsp">document_create_new_text_document.jsp</a><br>
<br>

<h3>Documents and permissions </h3>
You can manipulate documents in various ways. To do so the current user has to have specific roles, that in turn has to
have specific rights. <a href="document_permissions.jsp">document_permissions.jsp</a><br>
There are two different levels of configurable "restricted" permissions that can be modified.
To see what specified "Restricted One" permissions a page has, see <a href="document_permission_show_restricted_1.jsp">document_permission_show_restricted_1.jsp</a><br>

This doesn't work yet:<br>
(To change the "Restricted One" permission,<a href="document_permission_change_restricted_1.jsp">document_permission_change_restricted_1.jsp</a>)<br>
<br>

<H3>NoPermissionException and exception handling in jsp-pages</H3>
<P>
If the user that is accessing the page doesn't have the right permissions a NoPermissionException is thrown from the methods.
There are two normal ways to handle this. <BR>
1. In the jsp pages page-tag set the errorpage attribute and let that page handle the response to the user<BR>
2. Use try/catch in an normal Java way.<BR>
In this sample page, the first choice is made; see restrictedoperations.jsp and error.jsp files for details.
</body>
</html>

<commit_msg>Bug 1267: Changed the explanation of NoPermissionException at the bottom.<commit_after><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Imcms public API 1.0 beta 2 samples</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>

<body>
<H1>Imcms public API 1.0 beta 2 samples</H1>

<h2> Documentation </h2>
The documentation consists of this page and the jsp-pages that this page links to.
For documentation on the different classes that is used in the jsp-pages, <br>
see the <a href="docs/">java doc</a> for details.

<h3>Warning!</h3>
The following links works differently depending on the user's permissions on the corresponding admin-pages. That is, what
user you are logged in as, and what administrative permissions that user has.<br>
That means that even though you don't specify a user in most of the API:s method, usually the current logged in user
is passed as an invisible parameter.<br>
If you're not logged in as any user, you get a NullpointerException when trying any of the following jsp-pages.
When logged out, the only link that should work is the sample of exception handling at the bottom of this document.</p>
<p>

<h3>How to use this examples</h3>
When you click on a jsp-link below that page is going to be run, and produce a result.<br>
To see the actual code, pleas open the page in your favourite java/jsp editing environment.<br>

<h3>Who you are</h3>
First, make sure that you are logged in, <a href="../login/index.html">../login/index.html</a><br>
To see what user you are logged in as, <a href="logged_in_user.jsp">logged_in_user.jsp</a><br>
Log out (and become an non-logged in user), <a href="../servlet/LogOut">../servlet/LogOut</a>
</p>

<h3>Users</h3>
To see what users that exists in the system, <a href="user_listing.jsp">user_listing.jsp</a><br>

<h3>Roles</h3>
List all roles, <a href="role_list_all.jsp">role_list_all.jsp</a><br>
Add, <a href="role_create_role.jsp">role_create_role.jsp</a><br>
Delete, <a href="role_delete_role.jsp">role_delete_role.jsp</a><br>
<br>
List users with different roles, <a href="role_get_user_with_role.jsp">role_get_user_with_role.jsp</a><br>

<h3>Document</h3>
The following samples is modifying document 1001.<br>
It currently looks like this, <a href="../servlet/GetDoc?meta_id=1001">document</a><br>
<br>
Get the information about the document, <a href="document_get_document_info.jsp">document_get_document_info.jsp</a><br>
Change the document information, <a href="document_change_document_info.jsp">document_change_document_info.jsp</a><br>
<br>
Show template for a document, <a href="document_show_templates.jsp">document_show_templates.jsp</a><br>
Change template for a document, <a href="document_change_template.jsp">document_change_template.jsp</a><br>
<br>
Get the first document field from the document, <a href="document_get_text_from_field.jsp">document_get_text_from_field.jsp</a><br>
Change the first and the second field, <a href="document_set_text_field.jsp">document_set_text_field.jsp</a><br>
Clear the first and the second field, </a><a href="document_clear_text_field.jsp">document_clear_text_field.jsp</a><br>
<br>
To create a new text dokument that is linked from the document above, <a href="document_create_new_text_document.jsp">document_create_new_text_document.jsp</a><br>
<br>

<h3>Documents and permissions </h3>
You can manipulate documents in various ways. To do so the current user has to have specific roles, that in turn has to
have specific rights. <a href="document_permissions.jsp">document_permissions.jsp</a><br>
There are two different levels of configurable "restricted" permissions that can be modified.
To see what specified "Restricted One" permissions a page has, see <a href="document_permission_show_restricted_1.jsp">document_permission_show_restricted_1.jsp</a><br>

This doesn't work yet:<br>
(To change the "Restricted One" permission,<a href="document_permission_change_restricted_1.jsp">document_permission_change_restricted_1.jsp</a>)<br>
<br>

<H3>NoPermissionException and exception handling in jsp-pages</H3>
<P>
If the user that is accessing the page doesn't have the right permissions a NoPermissionException is thrown from the methods.
There are two normal ways to handle this. <BR>
1. In the jsp pages page-tag set the errorpage attribute and let that page handle the response to the user<BR>
2. Use try/catch in an normal Java way.<BR>
All the above pages is using the first method.
</body>
</html>


{'fraction_non_alphanumeric': 0.10953436807095343, 'fraction_numerical': 0.01130820399113082, 'mean_word_length': 5.752245508982036, 'pattern_counts': {'":': 0, '<': 229, '<?xml version=': 0, '>': 229, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1068830', 'n_tokens_mistral': 2871, 'n_tokens_neox': 2771, 'n_words': 1030}