当前位置: 编程技术>综合
本页文章导读:
▪Servlet 规范笔记—基于http协议的servlet 在上一章节,我们大概的描述了servlet的规范以及servlet和servlet容器的概念和用途,我们清楚的知道servlet容器提供了接收来自client端的请求,然后根据请求进行处理(如.........
▪Android AlertDialog警告对话框实现 今天看了一下Android AlertDialog警告对话框实现相关知识,查询资料自己编写了一个,下面就分享一下
文章来源:好岸园it技术网
http://www.hopean.com
对话框通知主要是当需要用户做出确定或其他某种.........
▪Oracle 11g RAC CRS-4535/ORA-15077 新安装了Oracle 11g rac之后,不知道是什么原因导致第二个节点上的crsd无法启动?其错误消息是CRS-4535: Cannot communicate with Cluster Ready Services。其具体的错误信息还需要查看crsd.log日.........
[1]Servlet 规范笔记—基于http协议的servlet
来源: 互联网 发布时间: 2013-11-05
在上一章节,我们大概的描述了servlet的规范以及servlet和servlet容器的概念和用途,我们清楚的知道servlet容器提供了接收来自client端的请求,然后根据请求进行处理(如:执行对应的servlet生成动态内容,或读取静态资源等),最后将client请求的资源响应给client端。在以上过程中,有一点需要注意,那就是根据servlet容器的作用,client端和server端需要交互传输数据,而在internet上的数据传输一定是基于某种传输协议的,如http、ftp等.
而上一章描述的Servelt规范是不基于协议的。 在这一章,我们将主要描述基于Http协议传输的servlet接口规范。 以下是基于Http 协议的Servlet结构图.
通过以上servlet结构类图,有以下几点我们是需要注意的:
HttpServlet在Servlet规范上的增强
HttpServlet是满足Servlet规范、基于Http作为传输协议而设计的一个接口。所以,它不仅满足Servlet规范,继承了Servlet中的所有功能(接口方法),并且,它还具有自己的一些特有的功能,而这些功能即是专门用来处理通过http所传输的信息的。这么说可能有点晦涩难懂,还是举几个例子吧: 例如HttpServlet中不仅仅有service方法,它还包含有doGet、doPost、doPut等一系列方法,如果你熟悉http协议,你应该清楚,http请求类型有post、get、put、delete等,而httpServlet中doGet、doPost方法就是专门用来处理相关的http请求类型.
再举个例子,如果你仔细看看HttpServletRequest接口,你就会发现,除了继承ServletRequest中的方法外,它还有getHeader、getMethod方法,而getHeader就是专门用来获得http的头(header)信息的,getMethod就是专门用来获得client基于http协议请求的方式的,如post、get等。
ServletRequestWrapper和HttpServletRequestWrapper的作用是什么?
看看ServletRequestWrapper的类结构图,你可能会发现它有两个特点:1,它实现了ServletRequest接口; 2,ServletRequestWrapper 类里有一个对ServletRequest对象的引用. 发现了吧,很明显,这就是java设计模式中的装饰模通过式嘛。结合装饰模式的作用可知,ServletRequestWrapper/HttpServletRequestWrapper提供了一种对ServletRequest/HttpServletRequest进行装饰和扩展的作用。例如,如果你想在调用ServletRequest.setAttribute方法前需要记录这次操作的日志,则可以通过创建个自定义的Servlet,集成ServletRequestWrapper,然后重写setAttribute方法即可.
ServletResponseWrapper和HttpServletResponseWrapper的作用是什么?
作用和上描述类似。 ServletResponseWrapper长被用来将本该响应给client端的信息提取出来,然后作进一步修饰或增强。如比较常用的页面布局框架SiteMesh就是采用这种机制来捕获页面内容,然后对这些内容进行装饰。
作者:xtu_xiaoxin 发表于2013-1-5 14:33:15 原文链接
阅读:0 评论:0 查看评论
[2]Android AlertDialog警告对话框实现
来源: 互联网 发布时间: 2013-11-05
今天看了一下Android AlertDialog警告对话框实现相关知识,查询资料自己编写了一个,下面就分享一下
文章来源:好岸园it技术网 http://www.hopean.com
对话框通知主要是当需要用户做出确定或其他某种选择时使用. 贴出代码
strings.xml
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="app_name">FileManage</string>
<string name="hello_world">Hello world!</string>
<string name="menu_settings">Settings</string>
<string name="button">弹出对话框</string>
</resources>
main.xml
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".MainActivity" >
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/button"
android:id="@+id/button"
/>
</RelativeLayout>
下面是java代码
MainActivity.java
package com.example.filemanage;
import android.app.Activity;
import android.app.AlertDialog;
import android.content.DialogInterface;
import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.view.Menu;
public class MainActivity extends Activity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
Button button = (Button)findViewById(R.id.button);
button.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
AlertDialog.Builder builder =
new
AlertDialog.Builder(MainActivity.this);
builder.setTitle("hopean.com")
.setMessage("你确定要访问 我们网站吗?")
.setCancelable(false)
.setPositiveButton("确定",
new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int id)
{
//创建一个访问“http://www.hopean.com”网站的意图,
//该意图会告知系统打开浏览器,并访问该网址。
Intent intent =
new Intent(Intent.ACTION_VIEW,Uri.parse("http://www.hopean.com"));
startActivity(intent);
}
})
.setNegativeButton("取消",
new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int id)
{
dialog.cancel(); //删除对话框
}
});
AlertDialog alert = builder.create();//创建对话框
alert.show();//显示对话框
}
});
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.activity_main, menu);
return true;
}
}
源码下载:AlertDialogDemo
作者:gloryFlow 发表于2013-1-5 14:28:46 原文链接
阅读:36 评论:0 查看评论
[3]Oracle 11g RAC CRS-4535/ORA-15077
来源: 互联网 发布时间: 2013-11-05
新安装了Oracle 11g rac之后,不知道是什么原因导致第二个节点上的crsd无法启动?其错误消息是CRS-4535: Cannot communicate with Cluster Ready Services。其具体的错误信息还需要查看crsd.log日志才知道。
1、环境
[root@linux2 ~]# cat /etc/issue
Enterprise Linux Enterprise Linux Server release 5.5 (Carthage)
Kernel \r on an \m
[root@linux2 bin]# ./crsctl query crs activeversion
Oracle Clusterware active version on the cluster is [11.2.0.1.0]
#注意下文中描述中使用了grid与root用户操作不同的对象。
2、错误症状
[root@linux2 bin]# ./crsctl check crs
CRS-4638: Oracle High Availability Services is online
CRS-4535: Cannot communicate with Cluster Ready Services #CRS-4535
CRS-4529: Cluster Synchronization Services is online
CRS-4533: Event Manager is online
[root@linux2 bin]# ps -ef | grep d.bin #下面的查询中没有crsd.bin
root 3886 1 1 09:50 ? 00:00:11 /u01/app/11.2.0/grid/bin/ohasd.bin reboot
grid 3938 1 0 09:51 ? 00:00:04 /u01/app/11.2.0/grid/bin/oraagent.bin
grid 4009 1 0 09:51 ? 00:00:00 /u01/app/11.2.0/grid/bin/gipcd.bin
grid 4014 1 0 09:51 ? 00:00:00 /u01/app/11.2.0/grid/bin/mdnsd.bin
grid 4028 1 0 09:51 ? 00:00:02 /u01/app/11.2.0/grid/bin/gpnpd.bin
root 4040 1 0 09:51 ? 00:00:03 /u01/app/11.2.0/grid/bin/cssdmonitor
root 4058 1 0 09:51 ? 00:00:04 /u01/app/11.2.0/grid/bin/cssdagent
root 4060 1 0 09:51 ? 00:00:00 /u01/app/11.2.0/grid/bin/orarootagent.bin
grid 4090 1 2 09:51 ? 00:00:15 /u01/app/11.2.0/grid/bin/ocssd.bin
grid 4094 1 0 09:51 ? 00:00:02 /u01/app/11.2.0/grid/bin/diskmon.bin -d -f
root 4928 1 0 09:51 ? 00:00:00 /u01/app/11.2.0/grid/bin/octssd.bin reboot
grid 4945 1 0 09:51 ? 00:00:02 /u01/app/11.2.0/grid/bin/evmd.bin
root 6514 5886 0 10:00 pts/1 00:00:00 grep d.bin
[root@linux2 bin]# ./crsctl stat res -t -init
--------------------------------------------------------------------------------
NAME TARGET STATE SERVER STATE_DETAILS
--------------------------------------------------------------------------------
Cluster Resources
--------------------------------------------------------------------------------
ora.asm
1 ONLINE ONLINE linux2 Cluster Reconfigura
tion
ora.crsd
1 ONLINE OFFLINE #crsd处于offline状态
ora.cssd
1 ONLINE ONLINE linux2
ora.cssdmonitor
1 ONLINE ONLINE linux2
ora.ctssd
1 ONLINE ONLINE linux2 OBSERVER
ora.diskmon
1 ONLINE ONLINE linux2
ora.drivers.acfs
1 ONLINE OFFLINE #acfs处于offline状态
ora.evmd
1 ONLINE ONLINE linux2
ora.gipcd
1 ONLINE ONLINE linux2
ora.gpnpd
1 ONLINE ONLINE linux2
ora.mdnsd
1 ONLINE ONLINE linux2
#下面查看crsd对应的日志文件
[grid@linux2 ~]$ view $ORACLE_HOME/log/linux2/crsd/crsd.log
2013-01-05 10:28:27.107: [GIPCXCPT][1768145488] gipcShutdownF: skipping shutdown, count 1, from [ clsgpnp0.c : 1021],
ret gipcretSuccess (0)
2013-01-05 10:28:27.107: [ OCRASM][1768145488]proprasmo: Error in open/create file in dg [OCR_VOTE] #打开磁盘组错误
[ OCRASM][1768145488]SLOS : SLOS: cat=7, opn=kgfoAl06, dep=15077, loc=kgfokge
ORA-15077: could not locate ASM instance serving a required diskgroup #出现了ORA错误
2013-01-05 10:28:27.107: [ OCRASM][1768145488]proprasmo: kgfoCheckMount returned [7]
2013-01-05 10:28:27.107: [ OCRASM][1768145488]proprasmo: The ASM instance is down #实例处于关闭状态
2013-01-05 10:28:27.107: [ OCRRAW][1768145488]proprioo: Failed to open [+OCR_VOTE]. Returned proprasmo() with [26].
Marking location as UNAVAILABLE.
2013-01-05 10:28:27.107: [ OCRRAW][1768145488]proprioo: No OCR/OLR devices are usable #OCR/OLR设备不可用
2013-01-05 10:28:27.107: [ OCRASM][1768145488]proprasmcl: asmhandle is NULL
2013-01-05 10:28:27.107: [ OCRRAW][1768145488]proprinit: Could not open raw device
2013-01-05 10:28:27.107: [ OCRASM][1768145488]proprasmcl: asmhandle is NULL
2013-01-05 10:28:27.107: [ OCRAPI][1768145488]a_init:16!: Backend init unsuccessful : [26]
2013-01-05 10:28:27.107: [ CRSOCR][1768145488] OCR context init failure. Error: PROC-26: Error while accessing the
physical storage ASM error [SLOS: cat=7, opn=kgfoAl06, dep=15077, loc=kgfokge
ORA-15077: could not locate ASM instance serving a required diskgroup
] [7]
2013-01-05 10:28:27.107: [ CRSD][1768145488][PANIC] CRSD exiting: Could not init OCR, code: 26
2013-01-05 10:28:27.107: [ CRSD][1768145488] Done.
[root@linux2 bin]# ps -ef | grep pmon #查看pmon进程,此处也表明ASM实例没有启动
root 7447 7184 0 10:48 pts/2 00:00:00 grep pmon
#从上面的分析可知,应该是ASM实例没有启动的原因导致了crsd进程无法启动
3、解决
[grid@linux2 ~]$ asmcmd
Connected to an idle instance.
ASMCMD> startup #启动asm实例
ASM instance started
Total System Global Area 283930624 bytes
Fixed Size 2212656 bytes
Variable Size 256552144 bytes
ASM Cache 25165824 bytes
ASM diskgroups mounted
ASMCMD> exit
#Author : Robinson
#Blog : http://blog.csdn.net/robinson_0612
#再次查看集群资源的状态
[root@linux2 bin]# ./crsctl stat res -t -init
--------------------------------------------------------------------------------
NAME TARGET STATE SERVER STATE_DETAILS
--------------------------------------------------------------------------------
Cluster Resources
--------------------------------------------------------------------------------
ora.asm
1 ONLINE ONLINE linux2 Started
ora.crsd
1 ONLINE INTERMEDIATE linux2
ora.cssd
1 ONLINE ONLINE linux2
ora.cssdmonitor
1 ONLINE ONLINE linux2
ora.ctssd
1 ONLINE ONLINE linux2 OBSERVER
ora.diskmon
1 ONLINE ONLINE linux2
ora.drivers.acfs
1 ONLINE OFFLINE
ora.evmd
1 ONLINE ONLINE linux2
ora.gipcd
1 ONLINE ONLINE linux2
ora.gpnpd
1 ONLINE ONLINE linux2
ora.mdnsd
1 ONLINE ONLINE linux2
#启动acfs
[root@linux2 bin]# ./crsctl start res ora.drivers.acfs -init
CRS-2672: Attempting to start 'ora.drivers.acfs' on 'linux2'
CRS-2676: Start of 'ora.drivers.acfs' on 'linux2' succeeded
#之后所有的状态都处于online状态
[root@linux2 bin]# ./crsctl stat res -t -init
--------------------------------------------------------------------------------
NAME TARGET STATE SERVER STATE_DETAILS
--------------------------------------------------------------------------------
Cluster Resources
--------------------------------------------------------------------------------
ora.asm
1 ONLINE ONLINE linux2 Started
ora.crsd
1 ONLINE ONLINE linux2
ora.cssd
1 ONLINE ONLINE linux2
ora.cssdmonitor
1 ONLINE ONLINE linux2
ora.ctssd
1 ONLINE ONLINE linux2 OBSERVER
ora.diskmon
1 ONLINE ONLINE linux2
ora.drivers.acfs
1 ONLINE ONLINE linux2
ora.evmd
1 ONLINE ONLINE linux2
ora.gipcd
1 ONLINE ONLINE linux2
ora.gpnpd
1 ONLINE ONLINE linux2
ora.mdnsd
1 ONLINE ONLINE linux2
有关grid相关故障链接:
Troubleshooting CRSD Start up Issue [ID 1323698.1]
How to Troubleshoot Grid Infrastructure Startup Issues [ID 1050908.1]
更多参考
有关Oracle RAC请参考
使用
最新技术文章: